4A Server -  2.0
 All Classes Namespaces Files Functions Variables Enumerator
cz.vutbr.fit.knot.annotations.documentCloner.DocumentClone Class Reference

Class provides document clonning with new content, iniciated from NLP. More...

Collaboration diagram for cz.vutbr.fit.knot.annotations.documentCloner.DocumentClone:
Collaboration graph

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< AnnotationgetAllAnnotations (CloneParams params)
 
List< BaseAttributegetAllAttributes (Integer id)
 

Private Attributes

MatcherProvider exactMatcherProvider
 
MatcherProvider nearestMatcherProvider
 
MatcherProvider sequenceMatcherProvider
 

Detailed Description

Class provides document clonning with new content, iniciated from NLP.

Class provides document clonning with new content, iniciated from NLP.

Author
Martin Petr (xpetrm05)

Definition at line 56 of file DocumentClone.java.

Constructor & Destructor Documentation

cz.vutbr.fit.knot.annotations.documentCloner.DocumentClone.DocumentClone ( )

Constructor

Definition at line 78 of file DocumentClone.java.

Member Function Documentation

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.

Parameters
requestrequest from servlet
Returns
message for server

Definition at line 106 of file DocumentClone.java.

Here is the call graph for this function:

boolean cz.vutbr.fit.knot.annotations.documentCloner.DocumentClone.createNewDocument ( CloneParams  params) throws RuntimeException
private

Method creates a new document by the source document.

Parameters
paramsobject with parameters of request
Returns
true if creating of new document ends with success
Exceptions
RuntimeExceptionif creating new document fails

Definition at line 241 of file DocumentClone.java.

Here is the call graph for this function:

Here is the caller graph for this function:

AnnotDocument cz.vutbr.fit.knot.annotations.documentCloner.DocumentClone.findDocumentInDB ( String  uri)
private

Method finds document in database by given uri. If don't find returns null.

Parameters
uriUri of document
Returns
document that is specified by given uri or null

Definition at line 551 of file DocumentClone.java.

Here is the call graph for this function:

Here is the caller graph for this function:

List<Annotation> cz.vutbr.fit.knot.annotations.documentCloner.DocumentClone.getAllAnnotations ( CloneParams  params)
private

Method finds all annotation belongs to old document. If don't find returns null.

Parameters
paramsobject with parameters of request
Returns
list of annotations that belongs to old document

Definition at line 571 of file DocumentClone.java.

Here is the caller graph for this function:

List<BaseAttribute> cz.vutbr.fit.knot.annotations.documentCloner.DocumentClone.getAllAttributes ( Integer  id)
private

Method finds all attributes of annotation. If don't find returns null.

Parameters
idId of annotation
Returns
Returns list of attributes that belongs to given annotation

Definition at line 588 of file DocumentClone.java.

Here is the caller graph for this function:

String cz.vutbr.fit.knot.annotations.documentCloner.DocumentClone.getJsonParameter ( JSONObject  jsonResponse,
String  parameterName 
) throws RuntimeException
private

Method parse specific request parameter in JSON string. If there is more then one parameter with given name, is returned first found.

Parameters
jsonResponseJSON object with parameters
parameterNameName of specific parameter
Returns
value of parameter
Exceptions
RuntimeExceptionif parsing of JSON parameters fails

Definition at line 393 of file DocumentClone.java.

Here is the caller graph for this function:

boolean cz.vutbr.fit.knot.annotations.documentCloner.DocumentClone.isAuthorized ( CloneParams  params)
private

Method checks if request come from authorized server.

Parameters
paramsobject with parameters of request
Returns
true value indicate thet server is authorized, false indicates unauthorized request

Definition at line 169 of file DocumentClone.java.

Here is the caller graph for this function:

boolean cz.vutbr.fit.knot.annotations.documentCloner.DocumentClone.makeNewAnnotations ( List< Annotation oldAnnotations,
CloneParams  params 
) throws RuntimeException
private

The method creates a new annotation according to the source document.

Parameters
oldAnnotationsList of old annotations to clone
paramsobject with parameters of request
Returns
true if copying of new annotations ends with success
Exceptions
RuntimeExceptionif creating new annotations fails

Definition at line 282 of file DocumentClone.java.

Here is the call graph for this function:

Here is the caller graph for this function:

void cz.vutbr.fit.knot.annotations.documentCloner.DocumentClone.parseDocument ( CloneParams  params)
private

Method parse given document and save it to CloneParams object. Method throws exception if error occurs.

Parameters
paramsobject with parameters of request

Definition at line 417 of file DocumentClone.java.

Here is the caller graph for this function:

boolean cz.vutbr.fit.knot.annotations.documentCloner.DocumentClone.parseJSON ( CloneParams  params) throws RuntimeException
private

Method parse JSON string to parameters and save them to params object. If problem occurs during parsing, method throws exception with message.

Parameters
paramsobject with parameters of request
Returns
method returns true if parsing ends with succes otherwise returns false
Exceptions
RuntimeExceptionif 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.

Here is the call graph for this function:

Here is the caller graph for this function:

String cz.vutbr.fit.knot.annotations.documentCloner.DocumentClone.readMessage ( CloneParams  params)
private

Method reads content of POST message.

Parameters
paramsobject with parameters of request
Returns
string with content of message

Definition at line 370 of file DocumentClone.java.

Here is the caller graph for this function:

boolean cz.vutbr.fit.knot.annotations.documentCloner.DocumentClone.updateAnnotation ( Annotation  annotation,
CloneParams  params 
)
private

Updates fragments in annotation. (Method copied from CoreFuncMOdule)

Parameters
annotationAnnotation to update
paramsParameters from request
Returns
If annotation was updated, returns true, if no update needed or error occurred, returns false

Definition at line 437 of file DocumentClone.java.

Here is the call graph for this function:

Here is the caller graph for this function:

Member Data Documentation

MatcherProvider cz.vutbr.fit.knot.annotations.documentCloner.DocumentClone.exactMatcherProvider
private

Provider of matchers for finding fragments (exact matches only)

Definition at line 67 of file DocumentClone.java.

MatcherProvider cz.vutbr.fit.knot.annotations.documentCloner.DocumentClone.nearestMatcherProvider
private

Provider of matchers for finding fragments (nearest matches only)

Definition at line 70 of file DocumentClone.java.

final String cz.vutbr.fit.knot.annotations.documentCloner.DocumentClone.NEW_DOCUMENT_CONTENT_PARAM = "content"
static

Name of new document content parameter in JSON string

Definition at line 64 of file DocumentClone.java.

final String cz.vutbr.fit.knot.annotations.documentCloner.DocumentClone.NEW_DOCUMENT_URI_PARAM = "newDocumentUri"
static

Name of new document uri parameter in JSON string

Definition at line 61 of file DocumentClone.java.

final String cz.vutbr.fit.knot.annotations.documentCloner.DocumentClone.OLD_DOCUMENT_URI_PARAM = "oldDocumentUri"
static

Name of old document uri parameter in JSON string

Definition at line 58 of file DocumentClone.java.

MatcherProvider cz.vutbr.fit.knot.annotations.documentCloner.DocumentClone.sequenceMatcherProvider
private

Provider of matchers for finding fragments (sequence iterator)

Definition at line 73 of file DocumentClone.java.


The documentation for this class was generated from the following file: