com.jurismarches.vradi.services
Class VradiStorageServiceImpl

java.lang.Object
  extended by com.jurismarches.vradi.services.VradiStorageServiceImpl
All Implemented Interfaces:
VradiStorageService

public class VradiStorageServiceImpl
extends java.lang.Object
implements VradiStorageService

Author:
morin

Nested Class Summary
static class VradiStorageServiceImpl.FormIdDateFormat
          Format of the automatically created form id
 
Field Summary
protected  java.util.Map<java.lang.Class,java.util.Map> cacheMap
          Cache of the entities
protected static java.lang.String channel
           
static java.lang.String DEFAULT_SENDING_PARAGRAPH
          default value of the sending paragraph : cannot be null or empty to be able to look for it in the solr index
static int DEFAULT_SENDING_STATUS
          default value of the sending status
protected static java.lang.String entry
           
protected static java.lang.String feed
           
protected static java.lang.String fieldPattern
          Pattern corresponding to a field name : a field name can contain any letter, number, blank, but no brackets neither "AND" or "OR".
protected static java.lang.String item
           
protected static java.lang.String notPattern
          Pattern corresponding to the "NOT" condition : "NOT "
protected  org.sharengo.wikitty.WikittyProxy proxy
          Proxy to store and retrieve the data
protected  java.util.List<java.lang.String> queriesInTheDB
          Cache of the queries in the database
protected static java.util.regex.Pattern queryPattern
          General pattern to parse the queries.
protected static java.lang.String rdf
           
static java.lang.String ROOT_THESAURUS_NAME
          Thesaurus root node name
static java.text.SimpleDateFormat RSS_DATE_FORMAT
          RSS date format
protected static java.lang.String valuePattern
          Pattern corresponding to a value : a value can contain any letter, number, blank, but no brackets.
protected  java.lang.String vradiDataDirName
          Vradi data directory
 
Constructor Summary
VradiStorageServiceImpl()
          Constructor : - creates (if not exists) the vradi data directory and the solr config file - init the proxy
 
Method Summary
protected  void addTokens(org.sharengo.wikitty.search.Search search, java.lang.String[] tokens, java.lang.String field, java.util.Map<java.lang.String,java.lang.String> caught)
          Add the equals or not equals conditions to the search
 void bindFormsToClients()
          Binds the clients with the forms found by their queries and not already sent
 void changeDataDir(java.lang.String newDataDir, java.lang.String oldDataDir)
          Changes the data directory
protected  void createQuery(org.sharengo.wikitty.search.Search search, java.util.Map<java.lang.String,java.lang.String> caught, java.lang.String sss, java.lang.String field)
          Add the AND or OR to the search
 void deleteEntity(org.sharengo.wikitty.BusinessEntity entity)
          Delete the entity from the database, the solr index and the cache
 void deleteForm(java.lang.String formId)
          Deletes a Form
protected  java.lang.Boolean equalsFieldValue(java.lang.String[] tokens, java.lang.String field, java.util.Map<java.lang.String,java.lang.String> caught, Form form, java.lang.Boolean and)
          Add the equals or not equals conditions to the search
 java.lang.String exportData()
          Export the data into an XML format
 void findForms(java.lang.String query, VradiFormPageDTO formPageDTO)
          Find the forms filtered by the parameter query
 void findForms(java.lang.String query, org.sharengo.wikitty.WikittyExtension extension, java.lang.String dateType, java.util.Date beginDate, java.util.Date endDate, java.util.List[] thesaurus, VradiFormPageDTO formPageDTO)
          Find the forms filtered by the parameter query
 java.util.List<Client> getAllClients()
          Retrieves all the clients from the cache
protected  java.util.List<org.sharengo.wikitty.BusinessEntity> getAllEntities(java.lang.Class clazz, java.lang.String ext)
          Retrieves from the cache all the entities whose class is clazz.
 java.util.List<Form> getAllForms()
          Get all the forms recorded
 java.util.List<org.sharengo.wikitty.WikittyExtension> getAllFormTypes()
          Get all the form types
 java.util.List<Group> getAllGroups()
          Retrieves all the groups from the cache
 java.util.List<org.sharengo.wikitty.TreeNode> getAllThesaurus()
           
 java.util.List<User> getAllUsers()
          Retrieves all the users from the cache
 java.util.List<XmlStream> getAllXmlStreams()
           
 java.util.List<org.sharengo.wikitty.TreeNode> getChildrenThesaurus(java.lang.String thesaurusId)
           
 Client getClient(java.lang.String clientId)
          Retrieves the client whose id is 'id'
 Client getClientByUserId(java.lang.String userId)
          Retrieves the client containing the user whose id is 'id'
 java.util.Map<Form,java.util.List<Client>> getClientsByForms(java.lang.String dateType, java.util.Date beginDate, java.util.Date endDate, org.sharengo.wikitty.WikittyExtension extension)
          Gets the client associated with each form
 java.util.List<User> getClientUsers(java.lang.String clientId)
          Retrieves the users from the client whose id is 'id'
 org.sharengo.wikitty.BusinessEntity getEntity(java.lang.String id, java.lang.Class clazz)
          Retrieve from the cache the entity of id 'id' and whose class is 'clazz' after having initialized the cache
 Form getForm(java.lang.String formId)
          Get the form whose id is id.
 java.util.List<Form> getForms(java.util.List<java.lang.String> formIds)
          Get the form whose id is id.
 java.util.List<VradiSendingDTO> getFormsByClients(java.lang.String dateType, java.util.Date beginDate, java.util.Date endDate, org.sharengo.wikitty.WikittyExtension extension, java.lang.Boolean receptionProof, java.lang.Boolean paragraph, int status)
          Gets the forms by client, status and sent date with a filter.
 java.lang.String getFormsFromXmlStream(XmlStream xmlStream, java.lang.String lastItemRecorded, VradiUser vradiUser)
          Creates and store forms from an Xml Stream by using the XmlStreamBinding to link xml stream field values with form fields.
 org.sharengo.wikitty.WikittyExtension getFormType(java.lang.String name)
          Get the last version of the extension named name
 java.util.Map<java.lang.String,org.sharengo.wikitty.FieldType> getFormTypeFields(java.lang.String name)
          Get the fields of a form type
 Group getGroup(java.lang.String groupId)
          Retrieves the group whose id is 'id'
 java.util.List<Client> getGroupClients(java.lang.String groupId)
          Retrieves the clients from the group whose id is 'id'
 java.util.List<Group> getGroupsByClientId(java.lang.String clientId)
          Retrieves the group containing the client whose id is 'id'
 java.util.List<Group> getGroupsByUserId(java.lang.String userId)
          Retrieves the group containing the user whose id is 'id'
 java.util.List<User> getGroupUsers(java.lang.String groupId)
          Retrieves the users from the group whose id is 'id'
 java.util.Map<org.sharengo.wikitty.TreeNode,java.lang.Integer> getNbFormsByThesaurus()
          Gets the number of forms associated with every thesaurus node
 int getNbFormsForThesaurus(java.lang.String thesaurusId)
          Gets the number of forms associated with the thesaurus node whose id is 'thesaurusId'
 java.util.List<java.lang.String> getQueriesReturningForm(Form form)
          Gets the recorded queries that returns the form 'form'.
 org.sharengo.wikitty.TreeNode getRootThesaurus()
           
 org.sharengo.wikitty.TreeNode getThesaurus(java.lang.String thesaurusId)
          Get the thesaurus node whose id is 'thesaurusId'
 User getUser(java.lang.String userId)
          Retrieves the user whose id is 'id'
 XmlFieldBinding getXmlFieldBinding(java.lang.String xmlFieldBindingId)
          Get the XmlFieldBinding whose id is 'xmlFieldBindingId'
 java.util.List<XmlFieldBinding> getXmlFieldBindings(XmlStream xmlStream)
          Get the XmlFieldBindings linked to xmlStream
 XmlStream getXmlStream(java.lang.String xmlStreamId)
          Get the XmlStream whose id is 'xmlStreamId'
 void importData(java.io.File file)
          Import data from an XML file
protected  java.lang.Class initCacheMap(java.lang.Class clazz)
          Initialize the cache of the entities whose class is clazz.
protected  java.lang.Boolean isQueryReturningForm(java.util.Map<java.lang.String,java.lang.String> caught, java.lang.String sss, java.lang.String field, Form form)
          Add the AND or OR to the search
 VradiUser logVradiUser(java.lang.String vradiUserName, java.lang.String vradiUserPassword)
          Logs a VradiUser with its username and password.
protected  java.util.Map<java.lang.String,java.lang.String> parseQuery(java.lang.String query)
          Separates the different token of the query into groups
 void reindexData()
          reindex the data (solr)
 org.sharengo.wikitty.BusinessEntity updateEntity(org.sharengo.wikitty.BusinessEntity entity)
          Updates the entity 'entity' in the database, the solr index and the cache.
 Form updateForm(Form form)
          Saves a form
 java.util.List<Form> updateForms(java.util.List<Form> forms)
          Saves a form list
 org.sharengo.wikitty.WikittyExtension updateFormType(java.lang.String name, java.util.Map<java.lang.String,org.sharengo.wikitty.FieldType> fields, java.lang.String requires, java.util.Map<java.lang.String,java.lang.String> tagValues)
          Inserts a form type.
 org.sharengo.wikitty.WikittyExtension updateFormType(org.sharengo.wikitty.WikittyExtension extension)
          Inserts a form type.
 void updateSendings(java.util.List<Sending> sendings)
          Update a list of Sending
 VradiUser updateVradiUser(VradiUser vradiUser)
          Updates a VradiUser
 java.util.List<XmlFieldBinding> updateXmlFieldBindings(java.util.List<XmlFieldBinding> bindings)
          Update a list of XmlFieldBinding
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

proxy

protected org.sharengo.wikitty.WikittyProxy proxy
Proxy to store and retrieve the data


fieldPattern

protected static final java.lang.String fieldPattern
Pattern corresponding to a field name : a field name can contain any letter, number, blank, but no brackets neither "AND" or "OR". The field name is followed by a double dot

See Also:
Constant Field Values

valuePattern

protected static final java.lang.String valuePattern
Pattern corresponding to a value : a value can contain any letter, number, blank, but no brackets.

See Also:
Constant Field Values

notPattern

protected static final java.lang.String notPattern
Pattern corresponding to the "NOT" condition : "NOT "

See Also:
Constant Field Values

queryPattern

protected static final java.util.regex.Pattern queryPattern
General pattern to parse the queries. A query is like : "field name:(value OR value OR value) AND field name:((value OR value) AND value)"


ROOT_THESAURUS_NAME

public static final java.lang.String ROOT_THESAURUS_NAME
Thesaurus root node name

See Also:
Constant Field Values

channel

protected static final java.lang.String channel
See Also:
Constant Field Values

entry

protected static final java.lang.String entry
See Also:
Constant Field Values

feed

protected static final java.lang.String feed
See Also:
Constant Field Values

item

protected static final java.lang.String item
See Also:
Constant Field Values

rdf

protected static final java.lang.String rdf
See Also:
Constant Field Values

RSS_DATE_FORMAT

public static final java.text.SimpleDateFormat RSS_DATE_FORMAT
RSS date format


DEFAULT_SENDING_STATUS

public static final int DEFAULT_SENDING_STATUS
default value of the sending status

See Also:
Constant Field Values

DEFAULT_SENDING_PARAGRAPH

public static final java.lang.String DEFAULT_SENDING_PARAGRAPH
default value of the sending paragraph : cannot be null or empty to be able to look for it in the solr index

See Also:
Constant Field Values

vradiDataDirName

protected java.lang.String vradiDataDirName
Vradi data directory


queriesInTheDB

protected java.util.List<java.lang.String> queriesInTheDB
Cache of the queries in the database


cacheMap

protected java.util.Map<java.lang.Class,java.util.Map> cacheMap
Cache of the entities

Constructor Detail

VradiStorageServiceImpl

public VradiStorageServiceImpl()
Constructor : - creates (if not exists) the vradi data directory and the solr config file - init the proxy

Method Detail

initCacheMap

protected java.lang.Class initCacheMap(java.lang.Class clazz)
                                throws TechnicalException
Initialize the cache of the entities whose class is clazz.

Parameters:
clazz - the class of the entities to put in the cache
Returns:
If clazz is an implementation, then it returns its interface, otherwise it returns clazz
Throws:
TechnicalException

getEntity

public org.sharengo.wikitty.BusinessEntity getEntity(java.lang.String id,
                                                     java.lang.Class clazz)
                                              throws TechnicalException
Retrieve from the cache the entity of id 'id' and whose class is 'clazz' after having initialized the cache

Specified by:
getEntity in interface VradiStorageService
Parameters:
id - the id of the entity to retrieve
clazz - the class of the entity to retrieve
Returns:
the entity of id 'id' and whose class is 'clazz'
Throws:
TechnicalException

getAllEntities

protected java.util.List<org.sharengo.wikitty.BusinessEntity> getAllEntities(java.lang.Class clazz,
                                                                             java.lang.String ext)
Retrieves from the cache all the entities whose class is clazz. If the cache is empty, then it fills it with the data base data.

Parameters:
clazz - the class of the entities to retrieve
ext - the WikittyExtension corresponding to clazz
Returns:
all the entities whose class is clazz

updateEntity

public org.sharengo.wikitty.BusinessEntity updateEntity(org.sharengo.wikitty.BusinessEntity entity)
                                                 throws TechnicalException
Updates the entity 'entity' in the database, the solr index and the cache.

Specified by:
updateEntity in interface VradiStorageService
Parameters:
entity - the entity to update
Returns:
the updated entity
Throws:
TechnicalException

deleteEntity

public void deleteEntity(org.sharengo.wikitty.BusinessEntity entity)
                  throws TechnicalException
Delete the entity from the database, the solr index and the cache

Specified by:
deleteEntity in interface VradiStorageService
Parameters:
entity - the entity to delete
Throws:
TechnicalException

getUser

public User getUser(java.lang.String userId)
             throws TechnicalException
Retrieves the user whose id is 'id'

Specified by:
getUser in interface VradiStorageService
Parameters:
userId - the id of the user to retrieve
Returns:
the user whose id is 'id'
Throws:
TechnicalException

getClient

public Client getClient(java.lang.String clientId)
                 throws TechnicalException
Retrieves the client whose id is 'id'

Specified by:
getClient in interface VradiStorageService
Parameters:
clientId - the id of the client to retrieve
Returns:
the client whose id is 'id'
Throws:
TechnicalException

getGroup

public Group getGroup(java.lang.String groupId)
               throws TechnicalException
Retrieves the group whose id is 'id'

Specified by:
getGroup in interface VradiStorageService
Parameters:
groupId - the id of the group to retrieve
Returns:
the group whose id is 'id'
Throws:
TechnicalException

getGroupUsers

public java.util.List<User> getGroupUsers(java.lang.String groupId)
                                   throws TechnicalException
Retrieves the users from the group whose id is 'id'

Specified by:
getGroupUsers in interface VradiStorageService
Parameters:
groupId - the id of the group which contains the users to retrieve
Returns:
the users from the group whose id is 'id'
Throws:
TechnicalException

getClientUsers

public java.util.List<User> getClientUsers(java.lang.String clientId)
                                    throws TechnicalException
Retrieves the users from the client whose id is 'id'

Specified by:
getClientUsers in interface VradiStorageService
Parameters:
clientId - the id of the client which contains the users to retrieve
Returns:
the users from the client whose id is 'id'
Throws:
TechnicalException

getGroupClients

public java.util.List<Client> getGroupClients(java.lang.String groupId)
                                       throws TechnicalException
Retrieves the clients from the group whose id is 'id'

Specified by:
getGroupClients in interface VradiStorageService
Parameters:
groupId - the id of the group which contains the clients to retrieve
Returns:
the clients from the group whose id is 'id'
Throws:
TechnicalException

getClientByUserId

public Client getClientByUserId(java.lang.String userId)
                         throws TechnicalException
Retrieves the client containing the user whose id is 'id'

Specified by:
getClientByUserId in interface VradiStorageService
Parameters:
userId - the id of the user contained by the client to retrieve
Returns:
the client containing the user whose id is 'id'
Throws:
TechnicalException

getGroupsByUserId

public java.util.List<Group> getGroupsByUserId(java.lang.String userId)
                                        throws TechnicalException
Retrieves the group containing the user whose id is 'id'

Specified by:
getGroupsByUserId in interface VradiStorageService
Parameters:
userId - the id of the user contained by the group to retrieve
Returns:
the group containing the user whose id is 'id'
Throws:
TechnicalException

getGroupsByClientId

public java.util.List<Group> getGroupsByClientId(java.lang.String clientId)
                                          throws TechnicalException
Retrieves the group containing the client whose id is 'id'

Specified by:
getGroupsByClientId in interface VradiStorageService
Parameters:
clientId - the id of the client contained by the group to retrieve
Returns:
the group containing the client whose id is 'id'
Throws:
TechnicalException

getAllClients

public java.util.List<Client> getAllClients()
                                     throws TechnicalException
Retrieves all the clients from the cache

Specified by:
getAllClients in interface VradiStorageService
Returns:
all the clients in the cache
Throws:
TechnicalException

getAllUsers

public java.util.List<User> getAllUsers()
                                 throws TechnicalException
Retrieves all the users from the cache

Specified by:
getAllUsers in interface VradiStorageService
Returns:
all the users in the cache
Throws:
TechnicalException

getAllGroups

public java.util.List<Group> getAllGroups()
                                   throws TechnicalException
Retrieves all the groups from the cache

Specified by:
getAllGroups in interface VradiStorageService
Returns:
all the groups in the cache
Throws:
TechnicalException

updateForm

public Form updateForm(Form form)
                throws TechnicalException
Saves a form

Specified by:
updateForm in interface VradiStorageService
Parameters:
form - the form to insert or update
Returns:
the form stored
Throws:
TechnicalException

updateForms

public java.util.List<Form> updateForms(java.util.List<Form> forms)
                                 throws TechnicalException
Saves a form list

Specified by:
updateForms in interface VradiStorageService
Parameters:
forms - the list of forms to insert or update
Returns:
the forms stored
Throws:
TechnicalException

deleteForm

public void deleteForm(java.lang.String formId)
Deletes a Form

Specified by:
deleteForm in interface VradiStorageService
Parameters:
formId - the id of the Form to delete

findForms

public void findForms(java.lang.String query,
                      VradiFormPageDTO formPageDTO)
Find the forms filtered by the parameter query

Specified by:
findForms in interface VradiStorageService
Parameters:
query - the query to filter the forms

findForms

public void findForms(java.lang.String query,
                      org.sharengo.wikitty.WikittyExtension extension,
                      java.lang.String dateType,
                      java.util.Date beginDate,
                      java.util.Date endDate,
                      java.util.List[] thesaurus,
                      VradiFormPageDTO formPageDTO)
Find the forms filtered by the parameter query

Specified by:
findForms in interface VradiStorageService
Parameters:
query - the query to filter the forms
extension - the extension filter
dateType - the date type of the filter
beginDate - the minimum value of the date type field
endDate - the maximum value of the date type field
thesaurus - the thesaurus associated with filter

getQueriesReturningForm

public java.util.List<java.lang.String> getQueriesReturningForm(Form form)
                                                         throws TechnicalException
Gets the recorded queries that returns the form 'form'.

Specified by:
getQueriesReturningForm in interface VradiStorageService
Parameters:
form - the form which is returned by the queries
Throws:
TechnicalException

parseQuery

protected java.util.Map<java.lang.String,java.lang.String> parseQuery(java.lang.String query)
Separates the different token of the query into groups

Parameters:
query - the query to parse
Returns:
a map linking the group names to the token groups

getAllFormTypes

public java.util.List<org.sharengo.wikitty.WikittyExtension> getAllFormTypes()
Get all the form types

Specified by:
getAllFormTypes in interface VradiStorageService
Returns:
the list of the wikittyExtension representing the form types

getFormType

public org.sharengo.wikitty.WikittyExtension getFormType(java.lang.String name)
Get the last version of the extension named name

Specified by:
getFormType in interface VradiStorageService
Parameters:
name - the name of the extension
Returns:
the last version of the extension

getFormTypeFields

public java.util.Map<java.lang.String,org.sharengo.wikitty.FieldType> getFormTypeFields(java.lang.String name)
Get the fields of a form type

Specified by:
getFormTypeFields in interface VradiStorageService
Parameters:
name - the name of the field type
Returns:
a map containing the names of the fields and their type

updateFormType

public org.sharengo.wikitty.WikittyExtension updateFormType(java.lang.String name,
                                                            java.util.Map<java.lang.String,org.sharengo.wikitty.FieldType> fields,
                                                            java.lang.String requires,
                                                            java.util.Map<java.lang.String,java.lang.String> tagValues)
Inserts a form type. If the form type is modified, then the version is automaticaly incremented.

Specified by:
updateFormType in interface VradiStorageService
Parameters:
name - the name of the form type
fields - the fields of the form type
requires - the extension requred by the extension to update
tagValues - the map containing the tags and their values
Returns:
the WikittyExtension corresponding to the form type

updateFormType

public org.sharengo.wikitty.WikittyExtension updateFormType(org.sharengo.wikitty.WikittyExtension extension)
Inserts a form type. If the form type is modified, then the version is automaticaly incremented.

Specified by:
updateFormType in interface VradiStorageService
Parameters:
extension - to store
Returns:
the WikittyExtension corresponding to the form type

getForm

public Form getForm(java.lang.String formId)
Get the form whose id is id.

Specified by:
getForm in interface VradiStorageService
Parameters:
formId - the id of the form
Returns:
the form whose id is id

getForms

public java.util.List<Form> getForms(java.util.List<java.lang.String> formIds)
Get the form whose id is id.

Specified by:
getForms in interface VradiStorageService
Parameters:
formIds - the ids of the forms
Returns:
the forms whose id is in the list of ids

getAllForms

public java.util.List<Form> getAllForms()
Get all the forms recorded

Specified by:
getAllForms in interface VradiStorageService
Returns:
the list of all the forms

createQuery

protected void createQuery(org.sharengo.wikitty.search.Search search,
                           java.util.Map<java.lang.String,java.lang.String> caught,
                           java.lang.String sss,
                           java.lang.String field)
Add the AND or OR to the search

Parameters:
search - the Search instance to add the conditions
caught - the map of the patterns with their id
sss - the id of the pattern matched
field - the field which must (or not) be equals to the values

addTokens

protected void addTokens(org.sharengo.wikitty.search.Search search,
                         java.lang.String[] tokens,
                         java.lang.String field,
                         java.util.Map<java.lang.String,java.lang.String> caught)
Add the equals or not equals conditions to the search

Parameters:
search - the Search instance to add the conditions
tokens - the list of values that must equals or not the search
field - the field which must (or not) be equals to the values
caught - the map of the patterns with their id

isQueryReturningForm

protected java.lang.Boolean isQueryReturningForm(java.util.Map<java.lang.String,java.lang.String> caught,
                                                 java.lang.String sss,
                                                 java.lang.String field,
                                                 Form form)
Add the AND or OR to the search

Parameters:
caught - the map of the patterns with their id
sss - the id of the pattern matched
field - the field which must (or not) be equals to the values
form - the form we are looking for in the queries
Returns:
null if the form is null, true if the form is returned by the query, false otherwise

equalsFieldValue

protected java.lang.Boolean equalsFieldValue(java.lang.String[] tokens,
                                             java.lang.String field,
                                             java.util.Map<java.lang.String,java.lang.String> caught,
                                             Form form,
                                             java.lang.Boolean and)
Add the equals or not equals conditions to the search

Parameters:
tokens - the list of values that must equals or not the search
field - the field which must (or not) be equals to the values
caught - the map of the patterns with their id
form - the form we are looking for in the queries
and - if true, an 'and' condition is beetwen the tokens, an 'or' otherwise
Returns:
null if the form is null, true if the form is returned by the query, false otherwise

getAllXmlStreams

public java.util.List<XmlStream> getAllXmlStreams()
Specified by:
getAllXmlStreams in interface VradiStorageService
Returns:
all the XmlStreams

updateXmlFieldBindings

public java.util.List<XmlFieldBinding> updateXmlFieldBindings(java.util.List<XmlFieldBinding> bindings)
Update a list of XmlFieldBinding

Specified by:
updateXmlFieldBindings in interface VradiStorageService
Parameters:
bindings - the list of XmlFieldBinding to update
Returns:
the list of updated XmlFieldBinding

getRootThesaurus

public org.sharengo.wikitty.TreeNode getRootThesaurus()
                                               throws TechnicalException
Specified by:
getRootThesaurus in interface VradiStorageService
Returns:
the root thesaurus node
Throws:
TechnicalException

getAllThesaurus

public java.util.List<org.sharengo.wikitty.TreeNode> getAllThesaurus()
                                                              throws TechnicalException
Specified by:
getAllThesaurus in interface VradiStorageService
Returns:
all the thesaurus nodes
Throws:
TechnicalException

getThesaurus

public org.sharengo.wikitty.TreeNode getThesaurus(java.lang.String thesaurusId)
                                           throws TechnicalException
Get the thesaurus node whose id is 'thesaurusId'

Specified by:
getThesaurus in interface VradiStorageService
Parameters:
thesaurusId - the id of the thesaurus node we are retrieving
Returns:
the thesaurus node whose id is 'thesaurusId'
Throws:
TechnicalException

getChildrenThesaurus

public java.util.List<org.sharengo.wikitty.TreeNode> getChildrenThesaurus(java.lang.String thesaurusId)
                                                                   throws TechnicalException
Specified by:
getChildrenThesaurus in interface VradiStorageService
Returns:
all the thesaurus nodes
Throws:
TechnicalException - TODO : To optimize

getXmlStream

public XmlStream getXmlStream(java.lang.String xmlStreamId)
                       throws TechnicalException
Get the XmlStream whose id is 'xmlStreamId'

Specified by:
getXmlStream in interface VradiStorageService
Parameters:
xmlStreamId - the id of the XmlStream we are retrieving
Returns:
the XmlStream whose id is 'xmlStreamId'
Throws:
TechnicalException

getXmlFieldBinding

public XmlFieldBinding getXmlFieldBinding(java.lang.String xmlFieldBindingId)
Get the XmlFieldBinding whose id is 'xmlFieldBindingId'

Specified by:
getXmlFieldBinding in interface VradiStorageService
Parameters:
xmlFieldBindingId - the id of the XmlFieldBinding we are retrieving
Returns:
the XmlFieldBinding whose id is 'xmlFieldBindingId'

getXmlFieldBindings

public java.util.List<XmlFieldBinding> getXmlFieldBindings(XmlStream xmlStream)
Get the XmlFieldBindings linked to xmlStream

Specified by:
getXmlFieldBindings in interface VradiStorageService
Parameters:
xmlStream - the XmlStream linked to the XmlFieldBinding we are looking for
Returns:
the list of XmlFieldBindings linked to xmlStream

bindFormsToClients

public void bindFormsToClients()
Binds the clients with the forms found by their queries and not already sent

Specified by:
bindFormsToClients in interface VradiStorageService

getFormsByClients

public java.util.List<VradiSendingDTO> getFormsByClients(java.lang.String dateType,
                                                         java.util.Date beginDate,
                                                         java.util.Date endDate,
                                                         org.sharengo.wikitty.WikittyExtension extension,
                                                         java.lang.Boolean receptionProof,
                                                         java.lang.Boolean paragraph,
                                                         int status)
                                                  throws TechnicalException
Gets the forms by client, status and sent date with a filter.

Specified by:
getFormsByClients in interface VradiStorageService
Parameters:
dateType - the date type of the filter
beginDate - the minimum value of the date of the filter
endDate - the maximum value of the date of the filter
extension - the WikittyExtension of the filter
receptionProof - true if the sending must have a reception proof
paragraph - the paragraph sent with the forms
status - the status of the sending
Returns:
a list of VradiSendingDTO representing the forms sent to the clients
Throws:
TechnicalException

getClientsByForms

public java.util.Map<Form,java.util.List<Client>> getClientsByForms(java.lang.String dateType,
                                                                    java.util.Date beginDate,
                                                                    java.util.Date endDate,
                                                                    org.sharengo.wikitty.WikittyExtension extension)
Gets the client associated with each form

Specified by:
getClientsByForms in interface VradiStorageService
Parameters:
dateType - the date type of the filter
beginDate - the minimum value of the date of the filter
endDate - the maximum value of the date of the filter
extension - the WikittyExtension of the filter
Returns:
a map containg the forms and their associated list of clients

getFormsFromXmlStream

public java.lang.String getFormsFromXmlStream(XmlStream xmlStream,
                                              java.lang.String lastItemRecorded,
                                              VradiUser vradiUser)
Creates and store forms from an Xml Stream by using the XmlStreamBinding to link xml stream field values with form fields.

Specified by:
getFormsFromXmlStream in interface VradiStorageService
Parameters:
xmlStream - the xml stream to read
lastItemRecorded - the encrypted value of the last read item of the xml stream
vradiUser - the VradiUser that launched the import
Returns:
the encrypted value of the last read item of the xml stream

updateVradiUser

public VradiUser updateVradiUser(VradiUser vradiUser)
                          throws TechnicalException
Updates a VradiUser

Specified by:
updateVradiUser in interface VradiStorageService
Parameters:
vradiUser - the VradiUser to update
Returns:
the vradiUser updated
Throws:
TechnicalException

logVradiUser

public VradiUser logVradiUser(java.lang.String vradiUserName,
                              java.lang.String vradiUserPassword)
Logs a VradiUser with its username and password.

Specified by:
logVradiUser in interface VradiStorageService
Parameters:
vradiUserName - the username of the VradiUser
vradiUserPassword - the password of the VradiUser
Returns:
the VradiUser having vradiUserName as username and vradiUserPassword as password

updateSendings

public void updateSendings(java.util.List<Sending> sendings)
Update a list of Sending

Specified by:
updateSendings in interface VradiStorageService
Parameters:
sendings - the list of Sending to store

importData

public void importData(java.io.File file)
                throws TechnicalException
Import data from an XML file

Specified by:
importData in interface VradiStorageService
Parameters:
file - the XML file containing the data
Throws:
TechnicalException

exportData

public java.lang.String exportData()
                            throws TechnicalException
Export the data into an XML format

Specified by:
exportData in interface VradiStorageService
Returns:
the data formatted for an XML file
Throws:
TechnicalException

reindexData

public void reindexData()
reindex the data (solr)

Specified by:
reindexData in interface VradiStorageService

changeDataDir

public void changeDataDir(java.lang.String newDataDir,
                          java.lang.String oldDataDir)
Changes the data directory

Specified by:
changeDataDir in interface VradiStorageService
Parameters:
newDataDir - the new data directory path
oldDataDir - the old data directory path. If null, the data in the old directory will not be copied.

getNbFormsByThesaurus

public java.util.Map<org.sharengo.wikitty.TreeNode,java.lang.Integer> getNbFormsByThesaurus()
                                                                                     throws TechnicalException
Gets the number of forms associated with every thesaurus node

Specified by:
getNbFormsByThesaurus in interface VradiStorageService
Returns:
a map containig the thesaurus nodes and the number of forms associated with it
Throws:
TechnicalException

getNbFormsForThesaurus

public int getNbFormsForThesaurus(java.lang.String thesaurusId)
                           throws TechnicalException
Gets the number of forms associated with the thesaurus node whose id is 'thesaurusId'

Specified by:
getNbFormsForThesaurus in interface VradiStorageService
Returns:
the number of forms associated with the thesaurus node whose id is 'thesaurusId'
Throws:
TechnicalException


Copyright © 2009-2010 JurisMarches. All Rights Reserved.