com.jurismarches.vradi.services
Class VradiDataServiceImpl

java.lang.Object
  extended by com.jurismarches.vradi.services.VradiDataServiceImpl
All Implemented Interfaces:
VradiDataService

public class VradiDataServiceImpl
extends Object
implements VradiDataService

Vradi data service implementation (on a local wikiity proxy).

Version:
$Revision: 1515 $ Last update : $Date: 2010-09-28 11:41:33 +0200 (mar., 28 sept. 2010) $ By : $Author: sletellier $
Author:
chatellier

Field Summary
protected  FormManager formManager
           
protected  FormTypeManager formTypeManager
           
protected  SearchManager searchManager
           
protected  ThesaurusManager thesaurusManager
           
protected  org.nuiton.wikitty.WikittyProxy wikittyProxy
          Wikiity proxy.
 
Constructor Summary
VradiDataServiceImpl(org.nuiton.wikitty.WikittyProxy wikittyProxy)
          Constructor with a wikitty proxy.
 
Method Summary
 boolean checkUserEmail(Sending sending)
          Check if user have email non empyt
protected  org.nuiton.wikitty.WikittyExtension computeExtension(org.nuiton.wikitty.WikittyExtension extension)
          Compute the specified extension and return a new one with ordered fields.
 List<Status> createDefaultStatuses()
          Create all default status.
 org.nuiton.wikitty.WikittyExtension createFormType(String formTypeName)
          Create new form type.
 RootThesaurus createRootThesaurus(String rootThesaurusName)
          Create new thesaurus.
 void deleteAllThesaurus()
          Delete all thesauruses recursively.
 List<String> deleteThesaurus(String thesaurusId)
          Delete all thesaurus and sub thesaurus.
protected
<T extends org.nuiton.wikitty.BusinessEntity>
List<T>
findAllByExtension(Class<T> type, String extension, String... sortFields)
          Do a find all by applying a criteria to WikittyProxy.
 List<Client> findAllClients()
          Find all clients.
 List<Group> findAllGroups()
          Find all groups.
 List<Status> findAllStatus()
          Find all status.
 List<User> findAllUsers()
          Find all users.
 List<WebHarvestStream> findAllWebHarvest()
          Find all webHarvest stream.
 List<XmlStream> findAllXmlStreams()
          Find all xml streams.
 List<User> findClientUsers(String clientId)
          Find all users for a client.
 FormPagedResult findForms(QueryParameters queryParameters, FormPagedResult formPagedResult)
          Searches for forms with the specified filters.
 List<Group> findUserGroups(String userId)
          Find all groups for a user.
 List<org.nuiton.wikitty.WikittyExtension> getAllFormTypes()
          Retrieves all the form types
 Map<Thesaurus,Integer> getChildrenCartography(String thesaurusId, QueryParameters queryParameters)
          Computes the number of forms associated with every thesaurus node.
 List<Thesaurus> getChildrenThesaurus(String thesaurusId)
          Returns all children of the specified thesaurusId sorted by name.
 org.nuiton.wikitty.WikittyExtension getFormType(String name)
          Retrieves the form type whose name is the parameter 'name'
 int getNbFormsForThesaurus(String thesaurusId)
          Computes the number of forms associated with the specified thesaurusId.
 List<RootThesaurus> getRootThesaurus()
          Return root thesaurus ids (ie thesaurus nodes without parent) sorted by root thesaurus name.
 Session getSessionBySending(String sendingId)
          Return session corresponding of sending id in param
 List<Thesaurus> getThesaurusAttachedToForm(Form form)
          Retourne l'ensemble des thesaurus qui sont attachés a un formulaire.
protected  void initManagers()
          Init managers.
 boolean isFormTypeExists(String formTypeName)
          Check if a form type name already exists.
 boolean isRootThesaurusNameExists(String rootThesaurusName)
          Return true if rootThesaurusName already exists.
 boolean isRootThesaurusNameExists(String rootThesaurusName, String exceptedRootThesaurusId)
          Return true if rootThesaurusName already exists.
 boolean isThesaurusNameExistsInRootThesaurus(RootThesaurus rootThesaurus, String thesaurusName)
          Return true if thesaurusName exists in rootThesaurus children.
 boolean isThesaurusNameExistsInRootThesaurus(RootThesaurus rootThesaurus, String thesaurusName, String exceptedThesaurusId)
          Check if name of thesaurus is existing in rootThesaurus.
 org.nuiton.wikitty.WikittyExtension updateFormType(String name, Map<String,org.nuiton.wikitty.FieldType> fields, String requires, Map<String,String> tagValues)
          Updates the form type whose name is 'name'.
 org.nuiton.wikitty.WikittyExtension updateFormType(org.nuiton.wikitty.WikittyExtension extension)
          Update the form type given in parameter
 org.nuiton.wikitty.WikittyExtension updateFormType(org.nuiton.wikitty.WikittyExtension extension, String templateName)
          Update the form type given in parameter
 List<XmlFieldBinding> updateXmlFieldBindings(List<XmlFieldBinding> bindings)
          Updates the xml field bindings given in parameters.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

wikittyProxy

protected org.nuiton.wikitty.WikittyProxy wikittyProxy
Wikiity proxy.


thesaurusManager

protected ThesaurusManager thesaurusManager

searchManager

protected SearchManager searchManager

formManager

protected FormManager formManager

formTypeManager

protected FormTypeManager formTypeManager
Constructor Detail

VradiDataServiceImpl

public VradiDataServiceImpl(org.nuiton.wikitty.WikittyProxy wikittyProxy)
Constructor with a wikitty proxy. Make sure that wikitty proxy doesn't access remote service.

Parameters:
wikittyProxy - wikitty proxy
Method Detail

initManagers

protected void initManagers()
Init managers.


findAllByExtension

protected <T extends org.nuiton.wikitty.BusinessEntity> List<T> findAllByExtension(Class<T> type,
                                                                                   String extension,
                                                                                   String... sortFields)
Do a find all by applying a criteria to WikittyProxy. Example : List client = VradiServiceHelper.findAllByExtension(Client.class, Client.EXT_CLIENT)

Type Parameters:
T - type of result
Parameters:
type - type to search
extension - extension to search
sortFields - sort fields (ascending to sort on)
Returns:
all of entities with extension

findAllClients

public List<Client> findAllClients()
Find all clients.

Specified by:
findAllClients in interface VradiDataService
Returns:
all clients

findAllUsers

public List<User> findAllUsers()
Find all users.

Specified by:
findAllUsers in interface VradiDataService
Returns:
all users

findAllGroups

public List<Group> findAllGroups()
Find all groups.

Specified by:
findAllGroups in interface VradiDataService
Returns:
all groups

findAllStatus

public List<Status> findAllStatus()
Find all status.

Specified by:
findAllStatus in interface VradiDataService
Returns:
all status

createDefaultStatuses

public List<Status> createDefaultStatuses()
                                   throws VradiException
Create all default status.

Specified by:
createDefaultStatuses in interface VradiDataService
Returns:
all status created
Throws:
VradiException

findAllWebHarvest

public List<WebHarvestStream> findAllWebHarvest()
Find all webHarvest stream.

Specified by:
findAllWebHarvest in interface VradiDataService
Returns:
all stream webHarvest

findAllXmlStreams

public List<XmlStream> findAllXmlStreams()
Find all xml streams.

Specified by:
findAllXmlStreams in interface VradiDataService
Returns:
all xml streams

findClientUsers

public List<User> findClientUsers(String clientId)
Find all users for a client.

Specified by:
findClientUsers in interface VradiDataService
Parameters:
clientId - client wikitty id
Returns:
all users for client

findUserGroups

public List<Group> findUserGroups(String userId)
Find all groups for a user.

Specified by:
findUserGroups in interface VradiDataService
Parameters:
userId - user wikitty id
Returns:
groups for a user

getFormType

public org.nuiton.wikitty.WikittyExtension getFormType(String name)
                                                throws VradiException
Retrieves the form type whose name is the parameter 'name'

Specified by:
getFormType in interface VradiDataService
Parameters:
name - the name of the form type we want to retrieve
Returns:
the form type whose name is the parameter
Throws:
VradiException

updateFormType

public org.nuiton.wikitty.WikittyExtension updateFormType(String name,
                                                          Map<String,org.nuiton.wikitty.FieldType> fields,
                                                          String requires,
                                                          Map<String,String> tagValues)
                                                   throws VradiException
Updates the form type whose name is 'name'.

Specified by:
updateFormType in interface VradiDataService
Parameters:
name - the name of the form type to update
fields - the new fields of the form type
requires - the new requires of the form type
tagValues - the new tag values of the form type
Returns:
the form type up to date
Throws:
VradiException

updateFormType

public org.nuiton.wikitty.WikittyExtension updateFormType(org.nuiton.wikitty.WikittyExtension extension)
                                                   throws VradiException
Update the form type given in parameter

Specified by:
updateFormType in interface VradiDataService
Parameters:
extension - the form type to update
Returns:
the form type up to date
Throws:
VradiException

updateFormType

public org.nuiton.wikitty.WikittyExtension updateFormType(org.nuiton.wikitty.WikittyExtension extension,
                                                          String templateName)
                                                   throws VradiException
Update the form type given in parameter

Specified by:
updateFormType in interface VradiDataService
Parameters:
extension - the form type to update
Returns:
the form type up to date
Throws:
VradiException

findForms

public FormPagedResult findForms(QueryParameters queryParameters,
                                 FormPagedResult formPagedResult)
                          throws UnsupportedQueryException,
                                 VradiException
Description copied from interface: VradiDataService
Searches for forms with the specified filters. The beginDate and endDate specifies a date range filter which is applied on dateType field. The date range filter is applied only if the three parameters are not null.

Specified by:
findForms in interface VradiDataService
Parameters:
queryParameters - query parameters
Returns:
FormPagedResult
Throws:
UnsupportedQueryException
VradiException

getChildrenCartography

public Map<Thesaurus,Integer> getChildrenCartography(String thesaurusId,
                                                     QueryParameters queryParameters)
                                              throws VradiException,
                                                     UnsupportedQueryException
Description copied from interface: VradiDataService
Computes the number of forms associated with every thesaurus node.

Specified by:
getChildrenCartography in interface VradiDataService
Parameters:
thesaurusId - thesaurusId
queryParameters - query parameters
Returns:
a map with children thesaurus and associated form count
Throws:
VradiException
UnsupportedQueryException

updateXmlFieldBindings

public List<XmlFieldBinding> updateXmlFieldBindings(List<XmlFieldBinding> bindings)
                                             throws VradiException
Updates the xml field bindings given in parameters.

Specified by:
updateXmlFieldBindings in interface VradiDataService
Parameters:
bindings - the list of the xml field bindings to update
Returns:
the list of the xml field bindings up to date
Throws:
VradiException

getAllFormTypes

public List<org.nuiton.wikitty.WikittyExtension> getAllFormTypes()
                                                          throws VradiException
Retrieves all the form types

Specified by:
getAllFormTypes in interface VradiDataService
Returns:
a list containing all the form types
Throws:
VradiException

computeExtension

protected org.nuiton.wikitty.WikittyExtension computeExtension(org.nuiton.wikitty.WikittyExtension extension)
Compute the specified extension and return a new one with ordered fields. Fields order is specified by their tag values.


getRootThesaurus

public List<RootThesaurus> getRootThesaurus()
                                     throws VradiException
Return root thesaurus ids (ie thesaurus nodes without parent) sorted by root thesaurus name.

Specified by:
getRootThesaurus in interface VradiDataService
Returns:
a RootThesaurus collection
Throws:
VradiException

getNbFormsForThesaurus

public int getNbFormsForThesaurus(String thesaurusId)
                           throws VradiException
Description copied from interface: VradiDataService
Computes the number of forms associated with the specified thesaurusId.

Specified by:
getNbFormsForThesaurus in interface VradiDataService
Parameters:
thesaurusId - thesaurus id
Returns:
the number of forms associated
Throws:
VradiException

getThesaurusAttachedToForm

public List<Thesaurus> getThesaurusAttachedToForm(Form form)
Retourne l'ensemble des thesaurus qui sont attachés a un formulaire.

Specified by:
getThesaurusAttachedToForm in interface VradiDataService
Parameters:
form - form dont on veut les thesaurus
Returns:
thesaurus attachés au formulaire

getChildrenThesaurus

public List<Thesaurus> getChildrenThesaurus(String thesaurusId)
                                     throws VradiException
Returns all children of the specified thesaurusId sorted by name.

Specified by:
getChildrenThesaurus in interface VradiDataService
Parameters:
thesaurusId - thesaurus wikitty id
Returns:
all list of TreeNodeImpl
Throws:
VradiException

createRootThesaurus

public RootThesaurus createRootThesaurus(String rootThesaurusName)
                                  throws VradiException
Description copied from interface: VradiDataService
Create new thesaurus.

Specified by:
createRootThesaurus in interface VradiDataService
Parameters:
rootThesaurusName - root thesaurus name (must contains only alphnum characters)
Returns:
new created thesaurus
Throws:
VradiException - if name is not valid

deleteThesaurus

public List<String> deleteThesaurus(String thesaurusId)
                             throws VradiException
Delete all thesaurus and sub thesaurus.

Specified by:
deleteThesaurus in interface VradiDataService
Parameters:
thesaurusId - thesaurusId to delete
Throws:
VradiException

deleteAllThesaurus

public void deleteAllThesaurus()
                        throws VradiException
Delete all thesauruses recursively.

Specified by:
deleteAllThesaurus in interface VradiDataService
Throws:
VradiException

isThesaurusNameExistsInRootThesaurus

public boolean isThesaurusNameExistsInRootThesaurus(RootThesaurus rootThesaurus,
                                                    String thesaurusName)
Return true if thesaurusName exists in rootThesaurus children.

Specified by:
isThesaurusNameExistsInRootThesaurus in interface VradiDataService
Parameters:
rootThesaurus - root thesaurus
thesaurusName - thesaurus name to test
Returns:
true if thesaurusName exists in rootThesaurus children

isThesaurusNameExistsInRootThesaurus

public boolean isThesaurusNameExistsInRootThesaurus(RootThesaurus rootThesaurus,
                                                    String thesaurusName,
                                                    String exceptedThesaurusId)
Check if name of thesaurus is existing in rootThesaurus.

Specified by:
isThesaurusNameExistsInRootThesaurus in interface VradiDataService
Parameters:
rootThesaurus - to check
thesaurusName - name to check
exceptedThesaurusId - in case of rename, exclude exceptedThesaurusId from check
Returns:
true if thesaurus already exist

isRootThesaurusNameExists

public boolean isRootThesaurusNameExists(String rootThesaurusName)
Return true if rootThesaurusName already exists.

Specified by:
isRootThesaurusNameExists in interface VradiDataService
Parameters:
rootThesaurusName - rootThesaurus name to test
Returns:
true if rootThesaurusName already exists

isRootThesaurusNameExists

public boolean isRootThesaurusNameExists(String rootThesaurusName,
                                         String exceptedRootThesaurusId)
Return true if rootThesaurusName already exists.

Specified by:
isRootThesaurusNameExists in interface VradiDataService
Parameters:
rootThesaurusName - rootThesaurus name to test
exceptedRootThesaurusId - in case of rename, exclude exceptedRootThesaurusId from check
Returns:
true if rootThesaurusName already exists

isFormTypeExists

public boolean isFormTypeExists(String formTypeName)
                         throws VradiException
Check if a form type name already exists.

Specified by:
isFormTypeExists in interface VradiDataService
Parameters:
formTypeName - form type name
Returns:
new created wikitty extension
Throws:
VradiException - if name is not valid

createFormType

public org.nuiton.wikitty.WikittyExtension createFormType(String formTypeName)
                                                   throws VradiException
Create new form type.

Specified by:
createFormType in interface VradiDataService
Parameters:
formTypeName - form type name
Returns:
new created wikitty extension
Throws:
VradiException - if name is not valid

checkUserEmail

public boolean checkUserEmail(Sending sending)
Description copied from interface: VradiDataService
Check if user have email non empyt

Specified by:
checkUserEmail in interface VradiDataService
Parameters:
sending - to check
Returns:
false if no valid email found

getSessionBySending

public Session getSessionBySending(String sendingId)
Description copied from interface: VradiDataService
Return session corresponding of sending id in param

Specified by:
getSessionBySending in interface VradiDataService
Parameters:
sendingId - corresponding to session to find
Returns:
session found


Copyright © 2009-2010 JurisMarches. All Rights Reserved.