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

Field Summary
protected static java.lang.String channel
           
protected static java.lang.String fieldPattern
           
protected static java.lang.String item
           
protected static java.lang.String notPattern
           
protected  org.sharengo.wikitty.WikittyProxy proxy
           
protected  java.util.List<java.lang.String> queriesInTheDB
           
protected static java.util.regex.Pattern queryPattern
           
static java.lang.String ROOT_THESAURUS_NAME
           
static java.text.SimpleDateFormat RSS_DATE_FORMAT
           
protected static java.lang.String valuePattern
           
 
Constructor Summary
VradiStorageServiceImpl()
           
 
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()
           
 void changeDataDir(java.lang.String newDataDir, java.lang.String oldDataDir)
           
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(java.lang.String id)
           
 void deleteForm(java.lang.String formId)
          Deletes a Form
 void deleteThesaurus(java.lang.String thesaurusId)
           
 void deleteXmlStream(java.lang.String streamId)
           
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.util.List<Form> findForms(java.lang.String query)
          Find the forms filtered by the parameter query
 java.util.List<Form> 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)
          Find the forms filtered by the parameter query
 java.util.List<Client> getAllClients()
           
 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()
           
 java.util.List<org.sharengo.wikitty.TreeNode> getAllThesaurus()
           
 java.util.List<User> getAllUsers()
           
 java.util.List<XmlStream> getAllXmlStreams()
           
 Client getClient(java.lang.String clientId)
           
 Client getClientByUserId(java.lang.String userId)
           
 java.util.Map<Form,java.util.List<Client>> getClientsByForms()
           
 java.util.List<User> getClientUsers(java.lang.String clientId)
           
 org.sharengo.wikitty.BusinessEntity getEntity(java.lang.String id, java.lang.Class clazz)
           
 Form getForm(java.lang.String formId)
          Get the form whose id is id.
 java.util.Map<Client,java.util.List<Form>> getFormsByClients()
           
 java.lang.String getFormsFromXmlStream(XmlStream xmlStream, java.lang.String lastItemRecorded)
           
 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)
           
 java.util.List<Client> getGroupClients(java.lang.String groupId)
           
 java.util.List<Group> getGroupsByClientId(java.lang.String clientId)
           
 java.util.List<Group> getGroupsByUserId(java.lang.String userId)
           
 java.util.List<User> getGroupUsers(java.lang.String groupId)
           
 java.util.List<java.lang.String> getQueriesReturningForm(Form form)
           
 org.sharengo.wikitty.TreeNode getRootThesaurus()
           
 java.util.List<java.lang.String> getRSSFields(java.lang.String url)
           
 org.sharengo.wikitty.TreeNode getThesaurus(java.lang.String ThesaurusId)
           
 User getUser(java.lang.String userId)
           
 XmlFieldBinding getXmlFieldBinding(java.lang.String xmlFieldBindingId)
           
 java.util.List<XmlFieldBinding> getXmlFieldBindings(XmlStream xmlStream)
           
 XmlStream getXmlStream(java.lang.String xmlStreamId)
           
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
protected  java.util.Map<java.lang.String,java.lang.String> parseQuery(java.lang.String query)
           
 org.sharengo.wikitty.BusinessEntity updateEntity(org.sharengo.wikitty.BusinessEntity entity)
           
 Form updateForm(Form form)
          Saves a form
 org.sharengo.wikitty.WikittyExtension updateFormType(java.lang.String name, java.util.Map<java.lang.String,org.sharengo.wikitty.FieldType> fields, java.lang.String requires)
          Inserts a form type.
 org.sharengo.wikitty.WikittyExtension updateFormType(org.sharengo.wikitty.WikittyExtension extention)
          Inserts a form type.
 org.sharengo.wikitty.TreeNode updateThesaurus(org.sharengo.wikitty.TreeNode thesaurus)
           
 java.util.List<XmlFieldBinding> updateXmlFieldBindings(java.util.List<XmlFieldBinding> bindings)
           
 XmlStream updateXmlStream(XmlStream stream)
           
 
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

fieldPattern

protected static java.lang.String fieldPattern

valuePattern

protected static java.lang.String valuePattern

notPattern

protected static java.lang.String notPattern

queryPattern

protected static java.util.regex.Pattern queryPattern

ROOT_THESAURUS_NAME

public static java.lang.String ROOT_THESAURUS_NAME

item

protected static java.lang.String item

channel

protected static java.lang.String channel

RSS_DATE_FORMAT

public static java.text.SimpleDateFormat RSS_DATE_FORMAT

queriesInTheDB

protected java.util.List<java.lang.String> queriesInTheDB
Constructor Detail

VradiStorageServiceImpl

public VradiStorageServiceImpl()
Method Detail

getEntity

public org.sharengo.wikitty.BusinessEntity getEntity(java.lang.String id,
                                                     java.lang.Class clazz)
                                              throws TechnicalException
Specified by:
getEntity in interface VradiStorageService
Throws:
TechnicalException

updateEntity

public org.sharengo.wikitty.BusinessEntity updateEntity(org.sharengo.wikitty.BusinessEntity entity)
                                                 throws TechnicalException
Specified by:
updateEntity in interface VradiStorageService
Throws:
TechnicalException

deleteEntity

public void deleteEntity(java.lang.String id)
                  throws TechnicalException
Specified by:
deleteEntity in interface VradiStorageService
Throws:
TechnicalException

getUser

public User getUser(java.lang.String userId)
             throws TechnicalException
Specified by:
getUser in interface VradiStorageService
Throws:
TechnicalException

getClient

public Client getClient(java.lang.String clientId)
                 throws TechnicalException
Specified by:
getClient in interface VradiStorageService
Throws:
TechnicalException

getGroup

public Group getGroup(java.lang.String groupId)
               throws TechnicalException
Specified by:
getGroup in interface VradiStorageService
Throws:
TechnicalException

getGroupUsers

public java.util.List<User> getGroupUsers(java.lang.String groupId)
                                   throws TechnicalException
Specified by:
getGroupUsers in interface VradiStorageService
Throws:
TechnicalException

getClientUsers

public java.util.List<User> getClientUsers(java.lang.String clientId)
                                    throws TechnicalException
Specified by:
getClientUsers in interface VradiStorageService
Throws:
TechnicalException

getGroupClients

public java.util.List<Client> getGroupClients(java.lang.String groupId)
                                       throws TechnicalException
Specified by:
getGroupClients in interface VradiStorageService
Throws:
TechnicalException

getClientByUserId

public Client getClientByUserId(java.lang.String userId)
                         throws TechnicalException
Specified by:
getClientByUserId in interface VradiStorageService
Throws:
TechnicalException

getGroupsByUserId

public java.util.List<Group> getGroupsByUserId(java.lang.String userId)
                                        throws TechnicalException
Specified by:
getGroupsByUserId in interface VradiStorageService
Throws:
TechnicalException

getGroupsByClientId

public java.util.List<Group> getGroupsByClientId(java.lang.String clientId)
                                          throws TechnicalException
Specified by:
getGroupsByClientId in interface VradiStorageService
Throws:
TechnicalException

getAllClients

public java.util.List<Client> getAllClients()
                                     throws TechnicalException
Specified by:
getAllClients in interface VradiStorageService
Throws:
TechnicalException

getAllUsers

public java.util.List<User> getAllUsers()
                                 throws TechnicalException
Specified by:
getAllUsers in interface VradiStorageService
Throws:
TechnicalException

getAllGroups

public java.util.List<Group> getAllGroups()
                                   throws TechnicalException
Specified by:
getAllGroups in interface VradiStorageService
Throws:
TechnicalException

updateForm

public Form updateForm(Form form)
Saves a form

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

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 java.util.List<Form> findForms(java.lang.String query)
Find the forms filtered by the parameter query

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

findForms

public java.util.List<Form> 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)
Find the forms filtered by the parameter query

Specified by:
findForms in interface VradiStorageService
Parameters:
query - the query to filter the forms
beginDate -
endDate -
Returns:
the forms filtered by query

getQueriesReturningForm

public java.util.List<java.lang.String> getQueriesReturningForm(Form form)
                                                         throws TechnicalException
Specified by:
getQueriesReturningForm in interface VradiStorageService
Throws:
TechnicalException

parseQuery

protected java.util.Map<java.lang.String,java.lang.String> parseQuery(java.lang.String query)

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)
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
Returns:
the WikittyExtension corresponding to the form type

updateFormType

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

Specified by:
updateFormType in interface VradiStorageService
Parameters:
extention - 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

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

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

updateXmlStream

public XmlStream updateXmlStream(XmlStream stream)
Specified by:
updateXmlStream in interface VradiStorageService

deleteXmlStream

public void deleteXmlStream(java.lang.String streamId)
Specified by:
deleteXmlStream in interface VradiStorageService

getAllXmlStreams

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

updateXmlFieldBindings

public java.util.List<XmlFieldBinding> updateXmlFieldBindings(java.util.List<XmlFieldBinding> bindings)
Specified by:
updateXmlFieldBindings in interface VradiStorageService

getRootThesaurus

public org.sharengo.wikitty.TreeNode getRootThesaurus()
                                               throws TechnicalException
Specified by:
getRootThesaurus in interface VradiStorageService
Throws:
TechnicalException

getAllThesaurus

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

getThesaurus

public org.sharengo.wikitty.TreeNode getThesaurus(java.lang.String ThesaurusId)
                                           throws TechnicalException
Specified by:
getThesaurus in interface VradiStorageService
Throws:
TechnicalException

updateThesaurus

public org.sharengo.wikitty.TreeNode updateThesaurus(org.sharengo.wikitty.TreeNode thesaurus)
                                              throws TechnicalException
Specified by:
updateThesaurus in interface VradiStorageService
Throws:
TechnicalException

deleteThesaurus

public void deleteThesaurus(java.lang.String thesaurusId)
                     throws TechnicalException
Specified by:
deleteThesaurus in interface VradiStorageService
Throws:
TechnicalException

getXmlStream

public XmlStream getXmlStream(java.lang.String xmlStreamId)
Specified by:
getXmlStream in interface VradiStorageService

getXmlFieldBinding

public XmlFieldBinding getXmlFieldBinding(java.lang.String xmlFieldBindingId)
Specified by:
getXmlFieldBinding in interface VradiStorageService

getXmlFieldBindings

public java.util.List<XmlFieldBinding> getXmlFieldBindings(XmlStream xmlStream)
Specified by:
getXmlFieldBindings in interface VradiStorageService

bindFormsToClients

public void bindFormsToClients()
Specified by:
bindFormsToClients in interface VradiStorageService

getFormsByClients

public java.util.Map<Client,java.util.List<Form>> getFormsByClients()
                                                             throws TechnicalException
Specified by:
getFormsByClients in interface VradiStorageService
Throws:
TechnicalException

getClientsByForms

public java.util.Map<Form,java.util.List<Client>> getClientsByForms()
Specified by:
getClientsByForms in interface VradiStorageService

getFormsFromXmlStream

public java.lang.String getFormsFromXmlStream(XmlStream xmlStream,
                                              java.lang.String lastItemRecorded)
Specified by:
getFormsFromXmlStream in interface VradiStorageService

getRSSFields

public java.util.List<java.lang.String> getRSSFields(java.lang.String url)

changeDataDir

public void changeDataDir(java.lang.String newDataDir,
                          java.lang.String oldDataDir)
Specified by:
changeDataDir in interface VradiStorageService


Copyright © 2009 JurisMarches. All Rights Reserved.