4A Server -
2.0
|
Class provides document clonning with new content, iniciated from NLP. More...
Public Member Functions | |
DocumentClone () | |
String | cloneDocument (HttpServletRequest request) |
Static Public Attributes | |
static final String | OLD_DOCUMENT_URI_PARAM = "oldDocumentUri" |
static final String | NEW_DOCUMENT_URI_PARAM = "newDocumentUri" |
static final String | NEW_DOCUMENT_CONTENT_PARAM = "content" |
Private Member Functions | |
boolean | isAuthorized (CloneParams params) |
boolean | parseJSON (CloneParams params) throws RuntimeException |
boolean | createNewDocument (CloneParams params) throws RuntimeException |
boolean | makeNewAnnotations (List< Annotation > oldAnnotations, CloneParams params) throws RuntimeException |
String | readMessage (CloneParams params) |
String | getJsonParameter (JSONObject jsonResponse, String parameterName) throws RuntimeException |
void | parseDocument (CloneParams params) |
boolean | updateAnnotation (Annotation annotation, CloneParams params) |
AnnotDocument | findDocumentInDB (String uri) |
List< Annotation > | getAllAnnotations (CloneParams params) |
List< BaseAttribute > | getAllAttributes (Integer id) |
Private Attributes | |
MatcherProvider | exactMatcherProvider |
MatcherProvider | nearestMatcherProvider |
MatcherProvider | sequenceMatcherProvider |
Class provides document clonning with new content, iniciated from NLP.
Class provides document clonning with new content, iniciated from NLP.
Definition at line 56 of file DocumentClone.java.
cz.vutbr.fit.knot.annotations.documentCloner.DocumentClone.DocumentClone | ( | ) |
Constructor
Definition at line 78 of file DocumentClone.java.
String cz.vutbr.fit.knot.annotations.documentCloner.DocumentClone.cloneDocument | ( | HttpServletRequest | request | ) |
Method provides clone of old document to new document with new content. Method check if server is approved to send request for clone. Method also clone annotations of old document.
request | request from servlet |
Definition at line 106 of file DocumentClone.java.
|
private |
Method creates a new document by the source document.
params | object with parameters of request |
RuntimeException | if creating new document fails |
Definition at line 241 of file DocumentClone.java.
|
private |
Method finds document in database by given uri. If don't find returns null.
uri | Uri of document |
Definition at line 551 of file DocumentClone.java.
|
private |
Method finds all annotation belongs to old document. If don't find returns null.
params | object with parameters of request |
Definition at line 571 of file DocumentClone.java.
|
private |
Method finds all attributes of annotation. If don't find returns null.
id | Id of annotation |
Definition at line 588 of file DocumentClone.java.
|
private |
Method parse specific request parameter in JSON string. If there is more then one parameter with given name, is returned first found.
jsonResponse | JSON object with parameters |
parameterName | Name of specific parameter |
RuntimeException | if parsing of JSON parameters fails |
Definition at line 393 of file DocumentClone.java.
|
private |
Method checks if request come from authorized server.
params | object with parameters of request |
Definition at line 169 of file DocumentClone.java.
|
private |
The method creates a new annotation according to the source document.
oldAnnotations | List of old annotations to clone |
params | object with parameters of request |
RuntimeException | if creating new annotations fails |
Definition at line 282 of file DocumentClone.java.
|
private |
Method parse given document and save it to CloneParams object. Method throws exception if error occurs.
params | object with parameters of request |
Definition at line 417 of file DocumentClone.java.
|
private |
Method parse JSON string to parameters and save them to params object. If problem occurs during parsing, method throws exception with message.
params | object with parameters of request |
RuntimeException | if it fails to find the request parameters |
Simple example of JSON string:
{ "oldDocumentUri": "oneValue", "newDocumentUri": "oneValue", "content": "abcd content cdef" }
Definition at line 204 of file DocumentClone.java.
|
private |
Method reads content of POST message.
params | object with parameters of request |
Definition at line 370 of file DocumentClone.java.
|
private |
Updates fragments in annotation. (Method copied from CoreFuncMOdule)
annotation | Annotation to update |
params | Parameters from request |
Definition at line 437 of file DocumentClone.java.
|
private |
Provider of matchers for finding fragments (exact matches only)
Definition at line 67 of file DocumentClone.java.
|
private |
Provider of matchers for finding fragments (nearest matches only)
Definition at line 70 of file DocumentClone.java.
|
static |
Name of new document content parameter in JSON string
Definition at line 64 of file DocumentClone.java.
|
static |
Name of new document uri parameter in JSON string
Definition at line 61 of file DocumentClone.java.
|
static |
Name of old document uri parameter in JSON string
Definition at line 58 of file DocumentClone.java.
|
private |
Provider of matchers for finding fragments (sequence iterator)
Definition at line 73 of file DocumentClone.java.