com.levigo.jadice.annotation
Class Annotations

java.lang.Object
  extended by com.levigo.jadice.annotation.Annotations

public class Annotations
extends Object

This class contains various utility methods for annotations.


Constructor Summary
Annotations()
           
 
Method Summary
static void clearModified(Document document)
          Resets the "modified"-indicator for all annotations of the given document.
static void clearModified(Page page)
          Resets the "modified"-indicator for all annotations of the given page.
static Collection<Annotation> get(Page page)
          Returns a list all annotations of given page.
static List<AnnotationCustomizer> getAnnotationCustomizers()
           
static AnnotationPageSegment getAnnotationPageSegment(Page page)
          Returns the annotation page segment of given page.
static AnnotationPageSegment getAnnotationPageSegment(Page page, boolean create)
          Returns the annotation page segment of given page.
static AnnotationProfile getAnnotationProfile(Document doc, Page page)
          This is a convenience method to retrieve an applicable AnnotationProfile.
static boolean isAnnotated(Document document)
          Returns whether the given document is annotated.
static boolean isAnnotated(Page page)
          Returns whether the given page is annotated.
static boolean isModified(Document document)
          Returns whether the annotations of given document are modified.
static boolean isModified(Page page)
          Returns whether the annotations of given page are modified.
static void runCustomizers(Annotation a, AnnotationPageSegment ps, Collection<AnnotationCustomizer> customizers)
          This method executes all AnnotationCustomizer implementations with the given annotation object.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

Annotations

public Annotations()
Method Detail

get

public static Collection<Annotation> get(Page page)
Returns a list all annotations of given page.

Caveat: this method simply returns the annotations on the first annotation page segment found on the given page using the ordering of Page.getPageSegments(). However, the latter is problematic as the default implementation does not return the segments in any predictable order but in order of the hash map they are maintained in. Future implementations will exhibit a clarified but different behavior.

Parameters:
page - the page the annotations should be retrieved
Returns:
Collection containing all annotations of the page
Throws:
IllegalArgumentException - if page is null

getAnnotationProfile

public static AnnotationProfile getAnnotationProfile(Document doc,
                                                     Page page)
This is a convenience method to retrieve an applicable AnnotationProfile.

First of all the page will be examined whether it already provides an annotation profile. If so, it will be returned. Otherwise the document will be checked whether the document provide a profile. If so it will be returned. If not, the annotation default profile will be returned.

Caveat: this method only considers the first annotation page segment found on the given page using the ordering of Page.getPageSegments(). However, the latter is problematic as the default implementation does not return the segments in any predictable order but in order of the hash map they are maintained in. Future implementations will exhibit a clarified but different behavior.

Returns:
an applicable annotation profile. See also AnnotationProfile.get(Page), AnnotationProfile.get(Document) and AnnotationProfile.getDefaultProfile()

getAnnotationPageSegment

public static AnnotationPageSegment getAnnotationPageSegment(Page page)
Returns the annotation page segment of given page. If no annotation page segment is contained in given page null will be returned.

Caveat: this method simply returns the first annotation page segment found on the given page using the ordering of Page.getPageSegments(). However, the latter is problematic as the default implementation does not return the segments in any predictable order but in order of the hash map they are maintained in. Future implementations will exhibit a clarified but different behavior.

Parameters:
page - the page the annotation page segement should be retrieved
Returns:
the annotation page segment of given page or null if not available.
Throws:
IllegalArgumentException - if page is null

getAnnotationPageSegment

public static AnnotationPageSegment getAnnotationPageSegment(Page page,
                                                             boolean create)
Returns the annotation page segment of given page. If no annotation page segment is contained in given page, the parameter create decides whether an annotation page segment for given page should be created or not. Caveat: this method simply returns the first annotation page segment found on the given page using the ordering of Page.getPageSegments(). However, the latter is problematic as the default implementation does not return the segments in any predictable order but in order of the hash map they are maintained in. Future implementations will exhibit a clarified but different behavior.

Parameters:
page - the page the annotation page segment should be retrieved
create - whether an annotation page segment should be created
Returns:
the annotation page segment of given page. If not available and the create is true, a new one will be created and returned. Otherwise null will be returned.
Throws:
IllegalArgumentException - if page is null

isAnnotated

public static boolean isAnnotated(Document document)
Returns whether the given document is annotated.

Caveat: this method only considers the first annotation page segment found on the document's pages using the ordering of Page.getPageSegments(). However, the latter is problematic as the default implementation does not return the segments in any predictable order but in order of the hash map they are maintained in. Future implementations will exhibit a clarified but different behavior.

Parameters:
document - the document the annotation lookup should be done for
Returns:
true if at least one page of the document has annotations
Throws:
IllegalArgumentException - if document is null

isAnnotated

public static boolean isAnnotated(Page page)
Returns whether the given page is annotated.

Caveat: this method only considers the first annotation page segment found on the given page using the ordering of Page.getPageSegments(). However, the latter is problematic as the default implementation does not return the segments in any predictable order but in order of the hash map they are maintained in. Future implementations will exhibit a clarified but different behavior.

Parameters:
page - the page the annotation lookup should be done for
Returns:
true if at least one annotation is contained in the page
Throws:
IllegalArgumentException - if page is null

isModified

public static boolean isModified(Document document)
Returns whether the annotations of given document are modified.

Caveat: this method only considers the first annotation page segment found on the given page using the ordering of Page.getPageSegments(). However, the latter is problematic as the default implementation does not return the segments in any predictable order but in order of the hash map they are maintained in. Future implementations will exhibit a clarified but different behavior.

Parameters:
document - the document the annotation lookup should be done for
Returns:
true if at least one page contains modified annotations
Throws:
IllegalArgumentException - if document is null

isModified

public static boolean isModified(Page page)
Returns whether the annotations of given page are modified.

Caveat: this method only considers the first annotation page segment found on the given page using the ordering of Page.getPageSegments(). However, the latter is problematic as the default implementation does not return the segments in any predictable order but in order of the hash map they are maintained in. Future implementations will exhibit a clarified but different behavior.

Parameters:
page - the page the annotation lookup should be done for
Returns:
true if the page contains at least one modified annotation
Throws:
IllegalArgumentException - if page is null

clearModified

public static void clearModified(Document document)
Resets the "modified"-indicator for all annotations of the given document.

This method should not be used for FileNet based annotation formats (IS, P8). In that case the annotations should be reloaded from the archive to obtain changes made by the archive / developer during the saving process. Make sure to remove the annotations from the whole document before reloading.

Caveat: this method only resets the first annotation page segment found on the given document's pages using the ordering of Page.getPageSegments(). However, the latter is problematic as the default implementation does not return the segments in any predictable order but in order of the hash map they are maintained in. Future implementations will exhibit a clarified but different behavior.

Parameters:
document - the document holding the annotations on which the operation shall be performed
Throws:
IllegalArgumentException - if document is null

clearModified

public static void clearModified(Page page)
Resets the "modified"-indicator for all annotations of the given page.

This method should not be used for FileNet based annotation formats (IS, P8). In that case the annotations should be reloaded from the archive to obtain changes made by the archive / developer during the saving process. Make sure to remove the annotations from the whole document before reloading.

Caveat: this method only resets the first annotation page segment found on the given page using the ordering of Page.getPageSegments(). However, the latter is problematic as the default implementation does not return the segments in any predictable order but in order of the hash map they are maintained in. Future implementations will exhibit a clarified but different behavior.

Parameters:
page - the page holding the annotations on which the operation shall be performed
Throws:
IllegalArgumentException - if page is null

getAnnotationCustomizers

public static List<AnnotationCustomizer> getAnnotationCustomizers()

runCustomizers

public static void runCustomizers(Annotation a,
                                  AnnotationPageSegment ps,
                                  Collection<AnnotationCustomizer> customizers)
This method executes all AnnotationCustomizer implementations with the given annotation object.

Parameters:
a - Annotation object
ps - AnnotationPageSegment instance (may be null)
customizers - Collection containing AnnotationCustomizer implementations


Copyright © 1995-2020 levigo holding gmbh. All Rights Reserved.