Interface AnnotationsInterface

  • All Known Implementing Classes:
    FileContentHandler, RestfulHttpContentHandler

    public interface AnnotationsInterface
    Defines base methods to save and retrieve annotations. These annotations include redactions, drawn shapes (ellipse, rectangle), straight and freehand lines and image rubber stamps.
    • Method Detail

      • getAnnotationNames

        ContentHandlerResult getAnnotationNames​(ContentHandlerInput input)
                                         throws VirtualViewerAPIException

        Returns an array of annotation layer names for the specified document key and client instance key.

        Example:

         
         public ContentHandlerResult getAnnotationNames(ContentHandlerInput input)
             throws VirtualViewerAPIException
         {
             String clientInstanceId = input.getClientInstanceId();
             String documentKey = input.getDocumentId();
             String[] arrayNames = new String[2];
             arrayNames[0] = "layerOne";
             arrayNames[1] = "layerTwo";
             ContentHandlerResult result = new ContentHandlerResult();
             result.put(ContentHandlerResult.KEY_ANNOTATION_NAMES, arrayNames);
             return result;
         }
         
         
        Parameters:
        input - ContentHandlerInput containing the following values:
        Every row is an expected value in the ContentHandlerInput. The first column is the string key for the value. The second column is the type of the value. The third column is the detailed description of the value.
        KeyTypeDescription
        KEY_DOCUMENT_ID java.lang.String The key representing the document. Can be retrieved with String documentId = input.getDocumentId(); .
        KEY_CLIENT_INSTANCE_ID java.lang.String Custom configurable value used to pass data from client to content handler. If not set then will be the session ID. Can be retrieved with String clientInstanceId = input.getClientInstanceId();
        KEY_HTTP_SERVLET_REQUEST javax.servlet.http.HttpServletRequest Request that called this method. Can be retrieved with HttpServletRequest request = input.getHttpServletRequest();
        Returns:
        ContentHandlerResult with the following values:
        Every row is an expected value in the ContentHandlerResult. The first column is the string key for the value. The second column is the type of the value. The third column is the detailed description of the value.
        KeyTypeDescription
        KEY_ANNOTATION_NAMES java.lang.String[] An array of all the annotation layer keys for the document.
        Throws:
        VirtualViewerAPIException - if content handler throws exception
      • getAnnotationContent

        ContentHandlerResult getAnnotationContent​(ContentHandlerInput input)
                                           throws VirtualViewerAPIException

        Returns the content for the specified annotation layer and document key in the form of a byte array.

        Example:

         
         // This example retrieves the annotation layer data from the local filesystem. The annotation file is assumed to 
         // be in a file named with the form <documentKey>.<annotationLayerKey>.ann.
         public ContentHandlerResult getAnnotationContent(ContentHandlerInput input)
             throws VirtualViewerAPIException
         {
             String clientInstanceId = input.getClientInstanceId();
             String documentKey = input.getDocumentId();
             String annotationKey = input.getAnnotationId();
             String annotationFilename = documentKey + &quot;.&quot; + annotationKey + &quot;.ann&quot;;
             String fullFilePath = gFilePath + annotationFilename;
             try
             {
                 File file = new File(fullFilePath);
                 byte[] bytes = getFileBytes(file);
                 ContentHandlerResult result = new ContentHandlerResult();
                 result.put(ContentHandlerResult.KEY_ANNOTATION_CONTENT, bytes);
                 return result;
             }
             catch (IOException e)
             {
                 return null;
             }
         }
         
         
        Parameters:
        input - ContentHandlerInput containing the following values:
        Every row is an expected value in the ContentHandlerInput. The first column is the string key for the value. The second column is the type of the value. The third column is the detailed description of the value.
        KeyTypeDescription
        KEY_ANNOTATION_ID java.lang.String The key for the requested annotation layer. Can be retrieved with String annotationId = input.getAnnotationId(); .
        KEY_DOCUMENT_ID java.lang.String The key representing the document. Can be retrieved with String documentId = input.getDocumentId(); .
        KEY_CLIENT_INSTANCE_ID java.lang.String Custom configurable value used to pass data from client to content handler. If not set then will be the session ID. Can be retrieved with String clientInstanceId = input.getClientInstanceId();
        KEY_HTTP_SERVLET_REQUEST javax.servlet.http.HttpServletRequest Request that called this method. Can be retrieved with HttpServletRequest request = input.getHttpServletRequest();
        Returns:
        ContentHandlerResult with the following values:
        Every row is an expected value in the ContentHandlerResult. The first column is the string key for the value. The second column is the type of the value. The third column is the detailed description of the value.
        KeyTypeDescription
        KEY_ANNOTATION_CONTENT byte[] Contents of the annotation layer file.
        Throws:
        VirtualViewerAPIException - if content handler throws exception
      • getAnnotationProperties

        ContentHandlerResult getAnnotationProperties​(ContentHandlerInput input)
                                              throws VirtualViewerAPIException
        Returns the properties for a specified annotation layer key in the form of a hashtable. Consult the Snowbound "Annotation Security FlexSnap: SI Specification" for more details.
        Parameters:
        input - ContentHandlerInput containing the following values:
        Every row is an expected value in the ContentHandlerInput. The first column is the string key for the value. The second column is the type of the value. The third column is the detailed description of the value.
        KeyTypeDescription
        KEY_ANNOTATION_ID java.lang.String The key for the requested annotation layer. Can be retrieved with String annotationId = input.getAnnotationId(); .
        KEY_DOCUMENT_ID java.lang.String The key representing the document. Can be retrieved with String documentId = input.getDocumentId(); .
        KEY_CLIENT_INSTANCE_ID java.lang.String Custom configurable value used to pass data from client to content handler. If not set then will be the session ID. Can be retrieved with String clientInstanceId = input.getClientInstanceId();
        KEY_HTTP_SERVLET_REQUEST javax.servlet.http.HttpServletRequest Request that called this method. Can be retrieved with HttpServletRequest request = input.getHttpServletRequest();
        Returns:
        ContentHandlerResult with the following values:
        Every row is an expected value in the ContentHandlerResult. The first column is the string key for the value. The second column is the type of the value. The third column is the detailed description of the value.
        KeyTypeDescription
        KEY_ANNOTATION_PROPERTIES java.util.Hashtable Map of the specified annotation layer's properties
        Throws:
        VirtualViewerAPIException - if content handler throws exception
      • saveAnnotationContent

        ContentHandlerResult saveAnnotationContent​(ContentHandlerInput input)
                                            throws VirtualViewerAPIException
        This method gets called when annotation data for the specified annotation file is ready to be saved.
        Parameters:
        input - ContentHandlerInput containing the following values:
        Every row is an expected value in the ContentHandlerInput. The first column is the string key for the value. The second column is the type of the value. The third column is the detailed description of the value.
        KeyTypeDescription
        KEY_ANNOTATION_ID java.lang.String The key for the annotation layer to be saved. Can be retrieved with String annotationId = input.getAnnotationId(); .
        KEY_ANNOTATION_CONTENT byte[] Annnotation data to be saved. Can be retrieved with byte[] annotationContent = input.getAnnotationContent(); .
        KEY_ANNOTATION_PROPERTIES java.util.Hashtable Map of annotation properties to be saved. Can be retrieved with Hashtable annotationProperties = input.getAnnotationProperties(); .
        KEY_DOCUMENT_ID java.lang.String The key representing the document. Can be retrieved with String documentId = input.getDocumentId(); .
        KEY_CLIENT_INSTANCE_ID java.lang.String Custom configurable value used to pass data from client to content handler. If not set then will be the session ID. Can be retrieved with String clientInstanceId = input.getClientInstanceId();
        KEY_HTTP_SERVLET_REQUEST javax.servlet.http.HttpServletRequest Request that called this method. Can be retrieved with HttpServletRequest request = input.getHttpServletRequest();
        Returns:
        ContentHandlerResult with no values currently expected.
        Throws:
        VirtualViewerAPIException - if content handler throws exception
      • deleteAnnotation

        ContentHandlerResult deleteAnnotation​(ContentHandlerInput input)
                                       throws VirtualViewerAPIException
        Called when the client has requested to delete the specified annotation layer.
        Parameters:
        input - ContentHandlerInput containing the following values:
        Every row is an expected value in the ContentHandlerInput. The first column is the string key for the value. The second column is the type of the value. The third column is the detailed description of the value.
        KeyTypeDescription
        KEY_ANNOTATION_ID java.lang.String The key for the annotation layer to be deleted. Can be retrieved with String annotationId = input.getAnnotationId(); .
        KEY_DOCUMENT_ID java.lang.String The key representing the document. Can be retrieved with String documentId = input.getDocumentId(); .
        KEY_CLIENT_INSTANCE_ID java.lang.String Custom configurable value used to pass data from client to content handler. If not set then will be the session ID. Can be retrieved with String clientInstanceId = input.getClientInstanceId();
        KEY_HTTP_SERVLET_REQUEST javax.servlet.http.HttpServletRequest Request that called this method. Can be retrieved with HttpServletRequest request = input.getHttpServletRequest();
        Returns:
        ContentHandlerResult with no values currently expected.
        Throws:
        VirtualViewerAPIException - if content handler throws exception