4A Server -
2.0
|
Document, annotations and types manipulation functionality. More...
Public Member Functions | |
CoreFuncModule () | |
String | processRequestBeforePersist (RequestInfo requestInfo) |
String | processRequestAfterPersist (RequestInfo requestInfo, boolean persistFailed) |
String | messagesFromFlier (Flier flier, EditorSession session) |
MatcherProvider | getMatcherProvider () |
synchronized void | lockDocumentUsage () throws InterruptedException |
synchronized void | unlockDocumentUsage () |
String | getModuleName (int lang) |
String | getModuleDescription (int lang) |
Static Public Member Functions | |
static String | cleanUpURI (String uri) throws URISyntaxException |
static ArrayList< String > | getUserSources (User user) |
static ArrayList< Annotation > | getLinkedAnnotationsDB (Annotation annot) |
static ArrayList< Annotation > | getDifference (ArrayList< Annotation > annotListA, ArrayList< Annotation > annotListB) |
static ArrayList< Annotation > | getRelatedAnnotations (ArrayList< Annotation > approvedAnnot, ArrayList< Annotation > unapprovedAnnot, EditorSession session) |
Private Member Functions | |
void | findLinkingAnnotationsIds (Annotation remAnnot, List< Integer > closed) |
boolean | typeInClientCache (AnnotType type, ArrayList< String > queries) |
boolean | containsMoreThanTwoAsterisks (String pattern, String wildcard) |
String | makeAddedAnnotMsg (ArrayList< Annotation > addedAnnotations, EditorSession session, Flier flier, boolean proto11) |
String | makeDeletedAnnotMsg (ArrayList< Annotation > deletedAnnotations, ArrayList< Annotation > deletedNestedAnnotations, EditorSession session, boolean proto11) |
boolean | isSubscribedToLinkingAnnot (EditorSession session, Annotation remAnnot, ArrayList< Annotation > deletedAnnotations) |
String | makeChangedAnnotMsg (ArrayList< Annotation > changedAnnotations, EditorSession session, boolean proto11) |
ArrayList< Annotation > | addWithoutDuplicity (ArrayList< Annotation > listOfOld, ArrayList< Annotation > listOfNew) |
void | addNestedToRemoved (Annotation annot, List< Annotation > removedNested) |
String | getAttrOnto (RequestInfo requestInfo) |
boolean | isTypeInGroups (AnnotType annotType, EditorSession session) |
String | getQueriedSubscriptions (RequestInfo requestInfo) |
String | getQueSubsLike (ArrayList< String > qString) |
String | getQueriedTypes (RequestInfo requestInfo) |
String | getQueriedTypeExact (String qString, RequestInfo requestInfo) |
String | getQueriedTypeLike (String qString, RequestInfo requestInfo) |
String | getAllInterestingAnnotations (RequestInfo requestInfo) |
void | updateAllExisting (RequestInfo requestInfo) |
boolean | updateAnnotation (Annotation annotation, RequestInfo requestInfo) |
void | checkAddedAndEdited (RequestInfo requestInfo) |
boolean | checkReqAttrsInAnnot (Annotation annot, RequestInfo requestInfo) |
int | checkAnnotationFragments (Annotation annotation, AnnotDocument annotDoc, RequestInfo requestInfo, Boolean cmpErr, Integer updFr) |
double | isAnnotationsAffected (AnnotDocument doc, AnnotDocument newDoc, RequestInfo requestInfo) |
double | isAnnotationAffected (Annotation annotation, AnnotDocument newDoc, RequestInfo requestInfo) |
double | fragmentTreshold (Fragment origFragment, UpdatableFragment foundFragment) |
void | synchronizeDocument (RequestInfo requestInfo) |
void | synchronizeStructuredDocument (AnnotDocument doc, AnnotDocument newDoc, RequestInfo requestInfo) |
void | reSynchronizeDocument (RequestInfo requestInfo) |
void | reSynchronizeStructuredDocument (AnnotDocument doc, AnnotDocument newDoc, RequestInfo requestInfo) |
void | synchronizeLinearizedDocument (AnnotDocument doc, AnnotDocument newDoc, RequestInfo requestInfo) |
void | reSynchronizeLinearizedDocument (AnnotDocument doc, AnnotDocument newDoc, RequestInfo requestInfo) |
void | generateTextModificationsToFlier (String oldVersion, String newVersion, boolean linearized, RequestInfo requestInfo) |
String | updateDocument (RequestInfo requestInfo) |
ArrayList< Annotation > | getRelatedAnnotations (ArrayList< Annotation > annotations) |
ArrayList< Annotation > | getAnnotsForUpdate (ArrayList< Annotation > annotations, ArrayList< Annotation > updatedAnnots) |
ArrayList< String > | getAllNestedIdentificators (Annotation annot) |
ArrayList< Annotation > | getLinkedAnnotations (ArrayList< Annotation > approvedAnnotations) |
void | updateAnnotationLinks (Annotation annot, RequestInfo requestInfo) |
boolean | canBeDocumentModified (RequestInfo requestInfo) |
Static Private Member Functions | |
static int | getLowestProtocolFromSessionList (RequestInfo requestInfo) |
static void | updateTmpIdRefInNested (Annotation nestedAnn, RequestInfo requestInfo) |
Private Attributes | |
MatcherProvider | matcherProvider |
MatcherProvider | exactMatcherProvider |
MatcherProvider | nearestMatcherProvider |
MatcherProvider | sequenceMatcherProvider |
Static Private Attributes | |
static boolean | documentUsageLocked = false |
Document, annotations and types manipulation functionality.
This module implements core document, annotations and types manipulation functionality.
Definition at line 60 of file CoreFuncModule.java.
cz.vutbr.fit.knot.annotations.modules.CoreFuncModule.CoreFuncModule | ( | ) |
Constructor
Definition at line 87 of file CoreFuncModule.java.
|
private |
Adds nested annotations of the given annotation to list of removed nested annotations
annot | current annotation thats nested annotation will be added to list |
removedNested | list of removed nested annotations |
Definition at line 1022 of file CoreFuncModule.java.
|
private |
Method merges the two arrays of annotations into a array list without duplicates.
listOfOld | first array of annotations |
listOfNew | second array of annotations |
Definition at line 991 of file CoreFuncModule.java.
|
private |
If document can be modified by this request, returns true, false otherwise
requestInfo | Informations about client request |
Definition at line 3386 of file CoreFuncModule.java.
|
private |
Checks whether added and changed annotations have good fragments and required attributes
requestInfo | Informations about client request |
Definition at line 1600 of file CoreFuncModule.java.
|
private |
Check whether annotated fragments in given annotation are good (can be found in synchronized document)
annotation | Annotation to check |
annotDoc | Synchronized document |
requestInfo | Informations about client request |
cmpErr | In this object this method returns, whether there are errors of searching fragments (maybe synchronization error) |
updFr | In this object this method returns count of updated fragments |
Definition at line 1831 of file CoreFuncModule.java.
|
private |
Checks whether annotation have all required attributes filled
annot | Annotation to check |
requestInfo | Informations about client request |
Definition at line 1760 of file CoreFuncModule.java.
|
static |
Normalizes URI and removes id of session and other mess.
uri | URI to clean up |
Definition at line 2568 of file CoreFuncModule.java.
|
private |
Checks whether wildcard contains more than one asterisk
pattern | Pattern string |
wildcard | Wildcard string |
Definition at line 772 of file CoreFuncModule.java.
|
private |
Finds all annotations linking this patricular annotation using database query. Result of the search is stored to list "closed" and is later added to the removed annotation. The method is nescessery for removing annotations that user client have but is not subscribed to, e.g. target of the annotation link.
remAnnot | Initial removed annotation that is possible target of the annotation link |
closed | list of unique IDs of all found linking annotations |
Definition at line 686 of file CoreFuncModule.java.
|
private |
Treshold method which tells you how much is the fragment changed.
origFragment | |
foundFragment |
Definition at line 2209 of file CoreFuncModule.java.
|
private |
Generates text modifications and saves them into flier.
oldVersion | Old version of document against which to generate text modifications. |
newVersion | New version of document. |
linearized | Specifies whether should be generated linearized text modifications or structured. |
requestInfo | Informations about client request |
Definition at line 2673 of file CoreFuncModule.java.
|
private |
Creates message with annotations interesting for client Annotations are returned in element add of annotations message.
requestInfo | Informations about client request |
Definition at line 1353 of file CoreFuncModule.java.
|
private |
Definition at line 3100 of file CoreFuncModule.java.
|
private |
Gets annotations for update
annotations | List of Annotations |
updatedAnnots | List of updated Annotations |
Definition at line 3050 of file CoreFuncModule.java.
|
private |
Returns serialized attributes of unknown types of annotation from ontology
requestInfo | Informations about client request |
Definition at line 1038 of file CoreFuncModule.java.
|
static |
Returns difference of the annotation lists ( A / B ).
annotListA | List A |
annotListB | List B |
Definition at line 3179 of file CoreFuncModule.java.
|
private |
Update all annotations with relationships to given approved annotations in list.
approvedAnnotations | list of approved annotations |
Definition at line 3122 of file CoreFuncModule.java.
|
static |
Gets linked annotation attributes from db which links input annotation
annot | input annotations |
Definition at line 3153 of file CoreFuncModule.java.
|
staticprivate |
Gets the lowest version of the protocol used in the clients where is the actual session document used.
requestInfo | actual requestInfo |
Definition at line 2700 of file CoreFuncModule.java.
MatcherProvider cz.vutbr.fit.knot.annotations.modules.CoreFuncModule.getMatcherProvider | ( | ) |
Gets provider of matchers for finding fragments
Definition at line 1414 of file CoreFuncModule.java.
String cz.vutbr.fit.knot.annotations.modules.CoreFuncModule.getModuleDescription | ( | int | lang | ) |
Returns description of this module. It will be part of information about server functions.
lang | Requested language of description |
Implements cz.vutbr.fit.knot.annotations.comet.AnnotServerModule.
Definition at line 2558 of file CoreFuncModule.java.
String cz.vutbr.fit.knot.annotations.modules.CoreFuncModule.getModuleName | ( | int | lang | ) |
Returns name of this module. Name will be included in XML element attribute so usable characters are restricted.
lang | Requested language of name |
Implements cz.vutbr.fit.knot.annotations.comet.AnnotServerModule.
Definition at line 2546 of file CoreFuncModule.java.
|
private |
Creates message with types of subscriptions requested (queried) by client
requestInfo | Informations about client request |
Definition at line 1116 of file CoreFuncModule.java.
|
private |
Gets type of annotations with given URI serialized in XML
qString | URI of requested type of annotations |
requestInfo | Informations about client request |
Definition at line 1277 of file CoreFuncModule.java.
|
private |
Gets type of annotations with URI matching given pattern serialized in XML Character % is used as wildcard.
qString | Pattern of URI of requested type of annotations |
requestInfo | Informations about client request |
Definition at line 1308 of file CoreFuncModule.java.
|
private |
Creates message with types of annotations requested (queried) by client
requestInfo | Informations about client request |
Definition at line 1200 of file CoreFuncModule.java.
|
private |
Gets subscriptions from dababase based upon terms in arrayList Character % is used as wildcard.
qString | ArrayList of strings filled with patterns |
Definition at line 1158 of file CoreFuncModule.java.
|
private |
Return all annotations that are related with annotations in list
annotations | list of annotations to search |
Definition at line 3016 of file CoreFuncModule.java.
|
static |
Return all annotations that are related with annotations in lists for session in parameter (not related only to approvedAnnot list but also to something to which is user subscribed)
approvedAnnot | approved annotation list |
unapprovedAnnot | unapproved annotation list |
session | session |
Definition at line 3208 of file CoreFuncModule.java.
|
static |
Gets the user sources
user | user |
Definition at line 2992 of file CoreFuncModule.java.
|
private |
Checks whether annotation will be affected by updating annotated copy of document to new version If annotation can be automatically updated (all fragments found), it's not treated as affection.
annotation | Checked annotation |
newDoc | New version of annotated document |
requestInfo | Informations about client request |
Definition at line 2098 of file CoreFuncModule.java.
|
private |
Checks whether annotations of document will be affected by updating annotated copy of document to new version If annotation can be automatically updated (all fragments found), it's not treated as affection.
doc | Old version of annotated document |
newDoc | New version of annotated document |
requestInfo | Informations about client request |
Definition at line 2068 of file CoreFuncModule.java.
|
private |
Checks if removed annotation is linked by annotation that user client is subscribed to. The client can display annotations that the user is not subscribed to in case that the annotation is a target of the annotation link.
session | User session |
remAnnot | Removed annotation which is inspected for linking annotations and their subscribtion status |
deletedAnnotations | List of all removed annotations obtained from a flier |
Definition at line 895 of file CoreFuncModule.java.
|
private |
Checks whether type come under user groups of logged in user
annotType | Checked type of annotation |
session | Client session |
Definition at line 1090 of file CoreFuncModule.java.
synchronized void cz.vutbr.fit.knot.annotations.modules.CoreFuncModule.lockDocumentUsage | ( | ) | throws InterruptedException |
Locks document usage
InterruptedException |
Definition at line 2303 of file CoreFuncModule.java.
|
private |
Method takes all added annotations and detects whether client require these annotations. Then method make message from required annotations.
addedAnnotations | array of added annotations |
session | informations about client session |
flier | Flier, which has been sent to all comet handlers. |
proto11 | minimal protocol version |
Definition at line 786 of file CoreFuncModule.java.
|
private |
Method takes all changed annotations and detects whether client require these annotations. Then method make message from required annotations.
changedAnnotations | array of changed annotations |
session | informations about client session |
proto11 | minimal protocol version |
Definition at line 939 of file CoreFuncModule.java.
|
private |
Method takes all deleted annotations and detects whether client require these annotations. Then method make message from required annotations.
deletedAnnotations | array of deleted annotations |
deletedNestedAnnotations | array of deleted nested annotations |
session | informations about client session |
proto11 | minimal protocol version |
Definition at line 845 of file CoreFuncModule.java.
String cz.vutbr.fit.knot.annotations.modules.CoreFuncModule.messagesFromFlier | ( | Flier | flier, |
EditorSession | session | ||
) |
This method is called for each sleeping comet handler when he receives flier (part of informations about this or another client request).
flier | Flier, which has been sent to all comet handlers. |
session | Session associated with comet handler. |
Implements cz.vutbr.fit.knot.annotations.comet.AnnotServerModule.
Definition at line 464 of file CoreFuncModule.java.
String cz.vutbr.fit.knot.annotations.modules.CoreFuncModule.processRequestAfterPersist | ( | RequestInfo | requestInfo, |
boolean | persistFailed | ||
) |
This method is called when client sent message, these message has been processed and changes in entities are persisted. Composed response is sent to client after calling this method from all modules. It performs:
requestInfo | Informations about client request |
persistFailed | True if changes not persisted, false otherwise. |
Implements cz.vutbr.fit.knot.annotations.comet.AnnotServerModule.
Definition at line 204 of file CoreFuncModule.java.
String cz.vutbr.fit.knot.annotations.modules.CoreFuncModule.processRequestBeforePersist | ( | RequestInfo | requestInfo | ) |
This method is called when client sent message and these message has been processed. Changes in types, annotations and in other entities are persisted after calling this method from all modules. It performs:
requestInfo | Informations about client request |
Implements cz.vutbr.fit.knot.annotations.comet.AnnotServerModule.
Definition at line 132 of file CoreFuncModule.java.
|
private |
Resynchronizes document
requestInfo | Informations about client request |
Definition at line 2468 of file CoreFuncModule.java.
|
private |
|
private |
Resynchronizes document
doc | Old version of document |
newDoc | New version of document |
requestInfo | Informations about client request |
Definition at line 2506 of file CoreFuncModule.java.
|
private |
Synchronizes document
requestInfo | Informations about client request |
Definition at line 2235 of file CoreFuncModule.java.
|
private |
|
private |
Synchronizes structured document
doc | persisted annotated document whether exists, otherwise null |
newDoc | New version of annotated document |
requestInfo | Informations about client request |
Definition at line 2325 of file CoreFuncModule.java.
|
private |
Client has a cache containing a history of type tree queries. It can request for the whole types tree or any subtree. Flier contains added and modified types. Method decides if the user will receive type from the flier for cache update. Type is send only when user previously asked for the subtree that the new/modified type is a part of.
type | New modified or added type obtained from a flier |
queries | History of type query request strings, may contain wildcard char |
Definition at line 714 of file CoreFuncModule.java.
synchronized void cz.vutbr.fit.knot.annotations.modules.CoreFuncModule.unlockDocumentUsage | ( | ) |
Unlocks document usage
Definition at line 2313 of file CoreFuncModule.java.
|
private |
Updates all annotations for synchronized document (eg. after modification of document)
requestInfo | Informations about client request |
Definition at line 1424 of file CoreFuncModule.java.
|
private |
Updates fragments in annotation
annotation | Annotation to update |
requestInfo | Informations about client request |
Definition at line 1456 of file CoreFuncModule.java.
|
private |
Checks all AnnotationLink attributes for values and updates refferences if attribute value is null and tmpId value of attribute != null.
annot | Annotation for check. |
requestInfo | Informations about client request |
Definition at line 3270 of file CoreFuncModule.java.
|
private |
Updates document with text modifications from request. If update finishes with success, stores text modifications into flier. If update fails, generates reverse text modifications.
requestInfo | Informations about client request |
Definition at line 2725 of file CoreFuncModule.java.
|
staticprivate |
Recursively Checks all AnnotationLink attributes in NestedAnnotations for values and updates refferences if attribute value is null and tmpId value of attribute != null.
nestedAnn | Nested Annotation link |
requestInfo | Informations about client request |
Definition at line 3329 of file CoreFuncModule.java.
|
staticprivate |
Specifies whether is document usage locked
Definition at line 82 of file CoreFuncModule.java.
|
private |
Provider of matchers for finding fragments (exact matches only)
Definition at line 69 of file CoreFuncModule.java.
|
private |
Provider of matchers for finding fragments
Definition at line 65 of file CoreFuncModule.java.
|
private |
Provider of matchers for finding fragments (nearest matches only)
Definition at line 73 of file CoreFuncModule.java.
|
private |
Provider of matchers for finding fragments (sequence iterator)
Definition at line 77 of file CoreFuncModule.java.