|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Objectcom.jurismarches.vradi.services.VradiStorageServiceImpl
public class VradiStorageServiceImpl
| 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 |
|---|
protected org.sharengo.wikitty.WikittyProxy proxy
protected static final java.lang.String fieldPattern
protected static final java.lang.String valuePattern
protected static final java.lang.String notPattern
protected static final java.util.regex.Pattern queryPattern
public static final java.lang.String ROOT_THESAURUS_NAME
protected static final java.lang.String channel
protected static final java.lang.String entry
protected static final java.lang.String feed
protected static final java.lang.String item
protected static final java.lang.String rdf
public static final java.text.SimpleDateFormat RSS_DATE_FORMAT
public static final int DEFAULT_SENDING_STATUS
public static final java.lang.String DEFAULT_SENDING_PARAGRAPH
protected java.lang.String vradiDataDirName
protected java.util.List<java.lang.String> queriesInTheDB
protected java.util.Map<java.lang.Class,java.util.Map> cacheMap
| Constructor Detail |
|---|
public VradiStorageServiceImpl()
| Method Detail |
|---|
protected java.lang.Class initCacheMap(java.lang.Class clazz)
throws TechnicalException
clazz - the class of the entities to put in the cache
TechnicalException
public org.sharengo.wikitty.BusinessEntity getEntity(java.lang.String id,
java.lang.Class clazz)
throws TechnicalException
getEntity in interface VradiStorageServiceid - the id of the entity to retrieveclazz - the class of the entity to retrieve
TechnicalException
protected java.util.List<org.sharengo.wikitty.BusinessEntity> getAllEntities(java.lang.Class clazz,
java.lang.String ext)
clazz - the class of the entities to retrieveext - the WikittyExtension corresponding to clazz
public org.sharengo.wikitty.BusinessEntity updateEntity(org.sharengo.wikitty.BusinessEntity entity)
throws TechnicalException
updateEntity in interface VradiStorageServiceentity - the entity to update
TechnicalException
public void deleteEntity(org.sharengo.wikitty.BusinessEntity entity)
throws TechnicalException
deleteEntity in interface VradiStorageServiceentity - the entity to delete
TechnicalException
public User getUser(java.lang.String userId)
throws TechnicalException
getUser in interface VradiStorageServiceuserId - the id of the user to retrieve
TechnicalException
public Client getClient(java.lang.String clientId)
throws TechnicalException
getClient in interface VradiStorageServiceclientId - the id of the client to retrieve
TechnicalException
public Group getGroup(java.lang.String groupId)
throws TechnicalException
getGroup in interface VradiStorageServicegroupId - the id of the group to retrieve
TechnicalException
public java.util.List<User> getGroupUsers(java.lang.String groupId)
throws TechnicalException
getGroupUsers in interface VradiStorageServicegroupId - the id of the group which contains the users to retrieve
TechnicalException
public java.util.List<User> getClientUsers(java.lang.String clientId)
throws TechnicalException
getClientUsers in interface VradiStorageServiceclientId - the id of the client which contains the users to retrieve
TechnicalException
public java.util.List<Client> getGroupClients(java.lang.String groupId)
throws TechnicalException
getGroupClients in interface VradiStorageServicegroupId - the id of the group which contains the clients to retrieve
TechnicalException
public Client getClientByUserId(java.lang.String userId)
throws TechnicalException
getClientByUserId in interface VradiStorageServiceuserId - the id of the user contained by the client to retrieve
TechnicalException
public java.util.List<Group> getGroupsByUserId(java.lang.String userId)
throws TechnicalException
getGroupsByUserId in interface VradiStorageServiceuserId - the id of the user contained by the group to retrieve
TechnicalException
public java.util.List<Group> getGroupsByClientId(java.lang.String clientId)
throws TechnicalException
getGroupsByClientId in interface VradiStorageServiceclientId - the id of the client contained by the group to retrieve
TechnicalException
public java.util.List<Client> getAllClients()
throws TechnicalException
getAllClients in interface VradiStorageServiceTechnicalException
public java.util.List<User> getAllUsers()
throws TechnicalException
getAllUsers in interface VradiStorageServiceTechnicalException
public java.util.List<Group> getAllGroups()
throws TechnicalException
getAllGroups in interface VradiStorageServiceTechnicalException
public Form updateForm(Form form)
throws TechnicalException
updateForm in interface VradiStorageServiceform - the form to insert or update
TechnicalException
public java.util.List<Form> updateForms(java.util.List<Form> forms)
throws TechnicalException
updateForms in interface VradiStorageServiceforms - the list of forms to insert or update
TechnicalExceptionpublic void deleteForm(java.lang.String formId)
deleteForm in interface VradiStorageServiceformId - the id of the Form to delete
public void findForms(java.lang.String query,
VradiFormPageDTO formPageDTO)
findForms in interface VradiStorageServicequery - the query to filter the forms
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)
findForms in interface VradiStorageServicequery - the query to filter the formsextension - the extension filterdateType - the date type of the filterbeginDate - the minimum value of the date type fieldendDate - the maximum value of the date type fieldthesaurus - the thesaurus associated with filter
public java.util.List<java.lang.String> getQueriesReturningForm(Form form)
throws TechnicalException
getQueriesReturningForm in interface VradiStorageServiceform - the form which is returned by the queries
TechnicalExceptionprotected java.util.Map<java.lang.String,java.lang.String> parseQuery(java.lang.String query)
query - the query to parse
public java.util.List<org.sharengo.wikitty.WikittyExtension> getAllFormTypes()
getAllFormTypes in interface VradiStorageServicepublic org.sharengo.wikitty.WikittyExtension getFormType(java.lang.String name)
getFormType in interface VradiStorageServicename - the name of the extension
public java.util.Map<java.lang.String,org.sharengo.wikitty.FieldType> getFormTypeFields(java.lang.String name)
getFormTypeFields in interface VradiStorageServicename - the name of the field type
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)
updateFormType in interface VradiStorageServicename - the name of the form typefields - the fields of the form typerequires - the extension requred by the extension to updatetagValues - the map containing the tags and their values
public org.sharengo.wikitty.WikittyExtension updateFormType(org.sharengo.wikitty.WikittyExtension extension)
updateFormType in interface VradiStorageServiceextension - to store
public Form getForm(java.lang.String formId)
getForm in interface VradiStorageServiceformId - the id of the form
public java.util.List<Form> getForms(java.util.List<java.lang.String> formIds)
getForms in interface VradiStorageServiceformIds - the ids of the forms
public java.util.List<Form> getAllForms()
getAllForms in interface VradiStorageService
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)
search - the Search instance to add the conditionscaught - the map of the patterns with their idsss - the id of the pattern matchedfield - the field which must (or not) be equals to the values
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)
search - the Search instance to add the conditionstokens - the list of values that must equals or not the searchfield - the field which must (or not) be equals to the valuescaught - the map of the patterns with their id
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)
caught - the map of the patterns with their idsss - the id of the pattern matchedfield - the field which must (or not) be equals to the valuesform - the form we are looking for in the queries
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)
tokens - the list of values that must equals or not the searchfield - the field which must (or not) be equals to the valuescaught - the map of the patterns with their idform - the form we are looking for in the queriesand - if true, an 'and' condition is beetwen the tokens,
an 'or' otherwise
public java.util.List<XmlStream> getAllXmlStreams()
getAllXmlStreams in interface VradiStorageServicepublic java.util.List<XmlFieldBinding> updateXmlFieldBindings(java.util.List<XmlFieldBinding> bindings)
updateXmlFieldBindings in interface VradiStorageServicebindings - the list of XmlFieldBinding to update
public org.sharengo.wikitty.TreeNode getRootThesaurus()
throws TechnicalException
getRootThesaurus in interface VradiStorageServiceTechnicalException
public java.util.List<org.sharengo.wikitty.TreeNode> getAllThesaurus()
throws TechnicalException
getAllThesaurus in interface VradiStorageServiceTechnicalException
public org.sharengo.wikitty.TreeNode getThesaurus(java.lang.String thesaurusId)
throws TechnicalException
getThesaurus in interface VradiStorageServicethesaurusId - the id of the thesaurus node we are retrieving
TechnicalException
public java.util.List<org.sharengo.wikitty.TreeNode> getChildrenThesaurus(java.lang.String thesaurusId)
throws TechnicalException
getChildrenThesaurus in interface VradiStorageServiceTechnicalException - TODO : To optimize
public XmlStream getXmlStream(java.lang.String xmlStreamId)
throws TechnicalException
getXmlStream in interface VradiStorageServicexmlStreamId - the id of the XmlStream we are retrieving
TechnicalExceptionpublic XmlFieldBinding getXmlFieldBinding(java.lang.String xmlFieldBindingId)
getXmlFieldBinding in interface VradiStorageServicexmlFieldBindingId - the id of the XmlFieldBinding we are retrieving
public java.util.List<XmlFieldBinding> getXmlFieldBindings(XmlStream xmlStream)
getXmlFieldBindings in interface VradiStorageServicexmlStream - the XmlStream linked
to the XmlFieldBinding we are looking for
public void bindFormsToClients()
bindFormsToClients in interface VradiStorageService
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
getFormsByClients in interface VradiStorageServicedateType - the date type of the filterbeginDate - the minimum value of the date of the filterendDate - the maximum value of the date of the filterextension - the WikittyExtension of the filterreceptionProof - true if the sending must have a reception proofparagraph - the paragraph sent with the formsstatus - the status of the sending
TechnicalException
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)
getClientsByForms in interface VradiStorageServicedateType - the date type of the filterbeginDate - the minimum value of the date of the filterendDate - the maximum value of the date of the filterextension - the WikittyExtension of the filter
public java.lang.String getFormsFromXmlStream(XmlStream xmlStream,
java.lang.String lastItemRecorded,
VradiUser vradiUser)
getFormsFromXmlStream in interface VradiStorageServicexmlStream - the xml stream to readlastItemRecorded - the encrypted value of the last read item
of the xml streamvradiUser - the VradiUser that launched the import
public VradiUser updateVradiUser(VradiUser vradiUser)
throws TechnicalException
updateVradiUser in interface VradiStorageServicevradiUser - the VradiUser to update
TechnicalException
public VradiUser logVradiUser(java.lang.String vradiUserName,
java.lang.String vradiUserPassword)
logVradiUser in interface VradiStorageServicevradiUserName - the username of the VradiUservradiUserPassword - the password of the VradiUser
public void updateSendings(java.util.List<Sending> sendings)
updateSendings in interface VradiStorageServicesendings - the list of Sending to store
public void importData(java.io.File file)
throws TechnicalException
importData in interface VradiStorageServicefile - the XML file containing the data
TechnicalException
public java.lang.String exportData()
throws TechnicalException
exportData in interface VradiStorageServiceTechnicalExceptionpublic void reindexData()
reindexData in interface VradiStorageService
public void changeDataDir(java.lang.String newDataDir,
java.lang.String oldDataDir)
changeDataDir in interface VradiStorageServicenewDataDir - the new data directory patholdDataDir - the old data directory path.
If null, the data in the old directory will not be copied.
public java.util.Map<org.sharengo.wikitty.TreeNode,java.lang.Integer> getNbFormsByThesaurus()
throws TechnicalException
getNbFormsByThesaurus in interface VradiStorageServiceTechnicalException
public int getNbFormsForThesaurus(java.lang.String thesaurusId)
throws TechnicalException
getNbFormsForThesaurus in interface VradiStorageServiceTechnicalException
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||