public interface AnnotationsInterface
Modifier and Type | Method and Description |
---|---|
ContentHandlerResult |
deleteAnnotation(ContentHandlerInput input)
Called when the client has requested to delete the specified annotation layer.
|
ContentHandlerResult |
getAnnotationContent(ContentHandlerInput input)
Returns the content for the specified annotation layer and document key in the form of a
byte array.
|
ContentHandlerResult |
getAnnotationNames(ContentHandlerInput input)
Returns an array of annotation layer names for the specified
document key and client instance key.
|
ContentHandlerResult |
getAnnotationProperties(ContentHandlerInput input)
Returns the properties for a specified annotation layer key in the form
of a hashtable.
|
ContentHandlerResult |
saveAnnotationContent(ContentHandlerInput input)
This method gets called when annotation data for the specified
annotation file is ready to be saved.
|
ContentHandlerResult getAnnotationNames(ContentHandlerInput input) throws VirtualViewerAPIException
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;
}
input
- ContentHandlerInput containing the following values:
Key | Type | Description |
---|---|---|
KEY_DOCUMENT_ID | java.lang.String | The key representing the document. Can be retrieved with . |
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
|
KEY_HTTP_SERVLET_REQUEST | javax.servlet.http.HttpServletRequest | Request that called this method. Can be retrieved with
|
Key | Type | Description |
---|---|---|
KEY_ANNOTATION_NAMES | java.lang.String[] | An array of all the annotation layer keys for the document. |
VirtualViewerAPIException
- if content handler throws exceptionContentHandlerResult getAnnotationContent(ContentHandlerInput input) throws VirtualViewerAPIException
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 + "." + annotationKey + ".ann";
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;
}
}
input
- ContentHandlerInput containing the following values:
Key | Type | Description |
---|---|---|
KEY_ANNOTATION_ID | java.lang.String | The key for the requested annotation layer. Can be retrieved with . |
KEY_DOCUMENT_ID | java.lang.String | The key representing the document. Can be retrieved with . |
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
|
KEY_HTTP_SERVLET_REQUEST | javax.servlet.http.HttpServletRequest | Request that called this method. Can be retrieved with
|
Key | Type | Description |
---|---|---|
KEY_ANNOTATION_CONTENT | byte[] | Contents of the annotation layer file. |
VirtualViewerAPIException
- if content handler throws exceptionContentHandlerResult getAnnotationProperties(ContentHandlerInput input) throws VirtualViewerAPIException
input
- ContentHandlerInput containing the following values:
Key | Type | Description |
---|---|---|
KEY_ANNOTATION_ID | java.lang.String | The key for the requested annotation layer. Can be retrieved with . |
KEY_DOCUMENT_ID | java.lang.String | The key representing the document. Can be retrieved with . |
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
|
KEY_HTTP_SERVLET_REQUEST | javax.servlet.http.HttpServletRequest | Request that called this method. Can be retrieved with
|
Key | Type | Description |
---|---|---|
KEY_ANNOTATION_PROPERTIES | java.util.Hashtable | Map of the specified annotation layer's properties |
VirtualViewerAPIException
- if content handler throws exceptionContentHandlerResult saveAnnotationContent(ContentHandlerInput input) throws VirtualViewerAPIException
input
- ContentHandlerInput containing the following values:
Key | Type | Description |
---|---|---|
KEY_ANNOTATION_ID | java.lang.String | The key for the annotation layer to be saved. Can be retrieved with . |
KEY_ANNOTATION_CONTENT | byte[] | Annnotation data to be saved. Can be retrieved with . |
KEY_ANNOTATION_PROPERTIES | java.util.Hashtable | Map of annotation properties to be saved. Can be retrieved with . |
KEY_DOCUMENT_ID | java.lang.String | The key representing the document. Can be retrieved with . |
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
|
KEY_HTTP_SERVLET_REQUEST | javax.servlet.http.HttpServletRequest | Request that called this method. Can be retrieved with
|
VirtualViewerAPIException
- if content handler throws exceptionContentHandlerResult deleteAnnotation(ContentHandlerInput input) throws VirtualViewerAPIException
input
- ContentHandlerInput containing the following values:
Key | Type | Description |
---|---|---|
KEY_ANNOTATION_ID | java.lang.String | The key for the annotation layer to be deleted. Can be retrieved with . |
KEY_DOCUMENT_ID | java.lang.String | The key representing the document. Can be retrieved with . |
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
|
KEY_HTTP_SERVLET_REQUEST | javax.servlet.http.HttpServletRequest | Request that called this method. Can be retrieved with
|
VirtualViewerAPIException
- if content handler throws exceptionCopyright © 2019 Snowbound Software Corporation. All rights reserved.