Content Management and Capture

 View Only
  • 1.  Daeja VIEWONE: Response filter to add Annotation

    Posted Tue March 26, 2024 02:46 PM

    Hi Friends,

    Requirement: I need to add annotation text dynamically in the Daeja VIEWONE viewer screen. I do not want to store Annotation objects in the repository. If the user prints the document the text must be also there in the print.
     
    What I did so far: 
    1.I implemented a response filter on the service "/v1/viewoneAction". Below is the code.
    public void filter(String serverType, PluginServiceCallbacks callbacks,
    			HttpServletRequest request, JSONObject jsonResponse) throws Exception {
    		logger = callbacks.getLogger();
    		logger.logDebug(ViewerTest.class, "filter", " **Enter filter7()** , Parameters - callbacks :: "+callbacks
    				+", request :: "+request+", jsonResponse :: "+jsonResponse);
    		String lsResponseHTML = (String) jsonResponse.get("responseHTML");
    		String lsTemp = lsResponseHTML.substring(0,lsResponseHTML.lastIndexOf("</object>"));
    		String lsAnnotationFile = "<param name=\"annotateEdit\" value=\"true\"/>\\r\\n<param name=\"annotationFile\" value=\"/Test/Config/hello.pl\"/>\r\n</object>\r\n";
    		String lsFinalResponseHTML = lsTemp + lsAnnotationFile;
    		logger.logDebug(ViewerTest.class, "filter", " lsFinalResponseHTML :: "+lsFinalResponseHTML);
    		jsonResponse.put("responseHTML", lsFinalResponseHTML);
    		logger.logDebug(ViewerTest.class, "filter", " final jsonResponse :: "+jsonResponse);
    	}
     
    2.Following is the code in the hello.pl.
    #!/usr/bin/perl
    print "Content-Type: text/html\n\n";
    print "<html><body>";
    print "<h1>Hello, CGI World!</h1>";
    print "</body></html>";
     
    Output: I could not see the annotation in the viewer. May be I am missing the concept. Could you please help me.


    ------------------------------
    RAVI KUMAR
    ------------------------------


  • 2.  RE: Daeja VIEWONE: Response filter to add Annotation

    Posted Wed March 27, 2024 06:48 AM

    Hi Friends,

    Any idea.



    ------------------------------
    RAVI KUMAR
    ------------------------------



  • 3.  RE: Daeja VIEWONE: Response filter to add Annotation

    Posted Thu March 28, 2024 01:53 PM

    Ravi -- Have you looked at this section in the Daeja documentation? https://www.ibm.com/docs/en/daeja-viewone/5.0.x?topic=options-edit-add-find-annotations



    ------------------------------
    RUTH Hildebrand-Lund
    ------------------------------



  • 4.  RE: Daeja VIEWONE: Response filter to add Annotation

    Posted Wed April 03, 2024 06:31 AM

    Hi RUTH,

    Thank you for the reply. I want to try with Daeja HTML api. I will also try with Daeja JavaScript api as you suggested and let you know.



    ------------------------------
    RAVI KUMAR
    ------------------------------



  • 5.  RE: Daeja VIEWONE: Response filter to add Annotation

    Posted Wed April 03, 2024 07:03 AM

    Hi,

    I have updated the response filter. Now I am passing the servlet for the parameter annotationFile. Please find below the latest response filter code and annotation output. This servlet generates text annotation output. But still the annotation does not work. Please suggest me how to implement this.

    Response Filter:

    public void filter(String serverType, PluginServiceCallbacks callbacks,
    			HttpServletRequest request, JSONObject jsonResponse) throws Exception {
    		logger = callbacks.getLogger();
    		logger.logDebug(ViewerTest.class, "filter", " **Enter filter7()** , Parameters - callbacks :: "+callbacks
    				+", request :: "+request+", jsonResponse :: "+jsonResponse);
    		String lsResponseHTML = (String) jsonResponse.get("responseHTML");
    		String lsTemp = lsResponseHTML.substring(0,lsResponseHTML.lastIndexOf("</object>"));
    		String lsAnnotationFile = "<param name=\"annotateEdit\" value=\"true\"/>\\r\\n<param name=\"annotationFile\" value=\"https://servername/AnnotationTest/TextAnnotation\"/>\r\n</object>\r\n";
    		String lsFinalResponseHTML = lsTemp + lsAnnotationFile;
    		logger.logDebug(ViewerTest.class, "filter", " lsFinalResponseHTML :: "+lsFinalResponseHTML);
    		jsonResponse.put("responseHTML", lsFinalResponseHTML);
    		logger.logDebug(ViewerTest.class, "filter", " final jsonResponse :: "+jsonResponse);
    	}

    Servlet Output:

    Viewer Settings after the plug-in deployment: 

    Current Output: I have updated annotateEdit and annotationFile parameters through response filter. The parameter annotateEdit enabled the Annotation toolbar. The annotationFile parameter also updated but no annotation is being displayed as expected.



    ------------------------------
    RAVI KUMAR
    ------------------------------



  • 6.  RE: Daeja VIEWONE: Response filter to add Annotation

    Posted Mon April 08, 2024 04:46 AM

    Hi Guys,

    Could you please check this.



    ------------------------------
    RAVI KUMAR
    ------------------------------



  • 7.  RE: Daeja VIEWONE: Response filter to add Annotation

    Posted Tue April 16, 2024 05:19 PM

    Yes Daeja's JS api is the right fit for this requirement. The user can call the <viewerObj>.addAnnotation method to display the data and then even print it. This functionality is already present in Daeja.

     

    This object is a Javascript object and it can be accessed by the application that is implementing the Daeja ViewONE. So in this case, Case manager or ICN has to be implement this addAnnotation method within their respective environment to display the content that the user desires.

     



    ------------------------------
    RAMA LINGAM
    ------------------------------