Class DefaultFormsOnlineService
- java.lang.Object
-
- org.silverpeas.components.formsonline.model.DefaultFormsOnlineService
-
- All Implemented Interfaces:
FormsOnlineService
,org.silverpeas.core.ApplicationService
,org.silverpeas.core.initialization.Initialization
@Service @Singleton @Named("formsOnlineService") public class DefaultFormsOnlineService extends Object implements FormsOnlineService, org.silverpeas.core.initialization.Initialization
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description static class
DefaultFormsOnlineService.HierarchicalValidatorCacheManager
Permits to manage a cache in order to increase performances.
-
Constructor Summary
Constructors Constructor Description DefaultFormsOnlineService()
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description void
archiveRequest(RequestPK pk)
Archives the request represented by the given identifier.void
cancelRequest(RequestPK pk)
Cancels the request represented by the given identifier.boolean
deleteForm(FormPK pk)
void
deleteRequest(RequestPK pk)
Deletes the request represented by the given identifier.List<FormDetail>
getAllForms(String appId, String userId, boolean withSendInfo)
RequestsByStatus
getAllUserRequests(String appId, String userId, org.silverpeas.core.admin.PaginationPage paginationPage)
List<FormDetail>
getAvailableFormsToSend(Collection<String> appIds, String userId)
org.silverpeas.core.util.LocalizationBundle
getComponentMessages(String language)
org.silverpeas.core.util.SettingBundle
getComponentSettings()
Optional<FormInstance>
getContributionById(org.silverpeas.core.contribution.model.ContributionIdentifier contributionId)
Map<String,Set<FormInstanceValidationType>>
getValidatorFormIdsWithValidationTypes(String appId, String validatorId, Collection<String> formIds)
Gets theFormInstanceValidationType
instances mapped by form identifiers of the validator represented by given validator id and validator group ids on the given component instance.RequestsByStatus
getValidatorRequests(RequestsFilter filter, String validatorId, org.silverpeas.core.admin.PaginationPage paginationPage)
void
index(String componentId)
void
init()
boolean
isRelatedTo(String instanceId)
Is this service related to the specified component instance.FormDetail
loadForm(FormPK pk)
FormInstance
loadRequest(RequestPK pk, String userId)
FormInstance
loadRequest(RequestPK pk, String userId, boolean editionMode)
void
publishForm(FormPK pk)
FormDetail
saveForm(FormDetail form, Map<String,org.silverpeas.core.util.Pair<List<String>,List<String>>> userAndGroupIdsByRightTypes)
void
saveNextRequestValidationStep(RequestPK pk, String validatorId, String decision, String comment, boolean follower)
Register a step of validation of the request represented by the given identifier.void
saveRequest(FormPK pk, String userId, List<org.apache.commons.fileupload.FileItem> items, boolean draft)
void
unpublishForm(FormPK pk)
-
-
-
Method Detail
-
init
public void init()
- Specified by:
init
in interfaceorg.silverpeas.core.initialization.Initialization
-
getAllForms
public List<FormDetail> getAllForms(String appId, String userId, boolean withSendInfo) throws FormsOnlineException
- Specified by:
getAllForms
in interfaceFormsOnlineService
- Throws:
FormsOnlineException
-
loadForm
public FormDetail loadForm(FormPK pk) throws FormsOnlineException
- Specified by:
loadForm
in interfaceFormsOnlineService
- Throws:
FormsOnlineException
-
saveForm
public FormDetail saveForm(FormDetail form, Map<String,org.silverpeas.core.util.Pair<List<String>,List<String>>> userAndGroupIdsByRightTypes) throws FormsOnlineException
- Specified by:
saveForm
in interfaceFormsOnlineService
- Throws:
FormsOnlineException
-
deleteForm
public boolean deleteForm(FormPK pk) throws FormsOnlineException
- Specified by:
deleteForm
in interfaceFormsOnlineService
- Throws:
FormsOnlineException
-
publishForm
public void publishForm(FormPK pk) throws FormsOnlineException
- Specified by:
publishForm
in interfaceFormsOnlineService
- Throws:
FormsOnlineException
-
unpublishForm
public void unpublishForm(FormPK pk) throws FormsOnlineException
- Specified by:
unpublishForm
in interfaceFormsOnlineService
- Throws:
FormsOnlineException
-
getAvailableFormsToSend
public List<FormDetail> getAvailableFormsToSend(Collection<String> appIds, String userId) throws FormsOnlineException
- Specified by:
getAvailableFormsToSend
in interfaceFormsOnlineService
- Throws:
FormsOnlineException
-
getAllUserRequests
public RequestsByStatus getAllUserRequests(String appId, String userId, org.silverpeas.core.admin.PaginationPage paginationPage) throws FormsOnlineException
- Specified by:
getAllUserRequests
in interfaceFormsOnlineService
- Throws:
FormsOnlineException
-
getValidatorRequests
public RequestsByStatus getValidatorRequests(RequestsFilter filter, String validatorId, org.silverpeas.core.admin.PaginationPage paginationPage) throws FormsOnlineException
- Specified by:
getValidatorRequests
in interfaceFormsOnlineService
- Throws:
FormsOnlineException
-
getValidatorFormIdsWithValidationTypes
public Map<String,Set<FormInstanceValidationType>> getValidatorFormIdsWithValidationTypes(String appId, String validatorId, Collection<String> formIds) throws FormsOnlineException
Description copied from interface:FormsOnlineService
Gets theFormInstanceValidationType
instances mapped by form identifiers of the validator represented by given validator id and validator group ids on the given component instance.- Specified by:
getValidatorFormIdsWithValidationTypes
in interfaceFormsOnlineService
- Parameters:
appId
- the identifier of the component instance.validatorId
- the identifier of the validator.formIds
- optional filter about form identifiers in order to reduce the search load.- Returns:
FormInstanceValidationType
instances mapped by form identifiers.- Throws:
FormsOnlineException
- if an error occurs
-
loadRequest
public FormInstance loadRequest(RequestPK pk, String userId) throws FormsOnlineException
- Specified by:
loadRequest
in interfaceFormsOnlineService
- Throws:
FormsOnlineException
-
loadRequest
public FormInstance loadRequest(RequestPK pk, String userId, boolean editionMode) throws FormsOnlineException
- Specified by:
loadRequest
in interfaceFormsOnlineService
- Throws:
FormsOnlineException
-
saveRequest
public void saveRequest(FormPK pk, String userId, List<org.apache.commons.fileupload.FileItem> items, boolean draft) throws FormsOnlineException
- Specified by:
saveRequest
in interfaceFormsOnlineService
- Throws:
FormsOnlineException
-
saveNextRequestValidationStep
public void saveNextRequestValidationStep(RequestPK pk, String validatorId, String decision, String comment, boolean follower) throws FormsOnlineException
Description copied from interface:FormsOnlineService
Register a step of validation of the request represented by the given identifier.The service ensure that the validator is able to validate the given request. In case of the validator can not validate, an error is thrown.
- Specified by:
saveNextRequestValidationStep
in interfaceFormsOnlineService
- Parameters:
pk
- the unique identifier of the aimed request.validatorId
- the identifier of the validator.decision
- the validation decision ("validate" or "refused")comment
- the validation comment.follower
- a boolean flag. True means that the validator want to follow the next steps of validation.- Throws:
FormsOnlineException
- if the validator can not validate indeed or on technical error.
-
cancelRequest
public void cancelRequest(RequestPK pk) throws FormsOnlineException
Description copied from interface:FormsOnlineService
Cancels the request represented by the given identifier.The service ensures that the current user is the creator of the request. In case of the validator can not validate, an error is thrown.
- Specified by:
cancelRequest
in interfaceFormsOnlineService
- Parameters:
pk
- the unique identifier of the aimed request.- Throws:
FormsOnlineException
- if the current user can not cancel the request or on technical error.
-
deleteRequest
public void deleteRequest(RequestPK pk) throws FormsOnlineException
Description copied from interface:FormsOnlineService
Deletes the request represented by the given identifier.The service ensures that the current user is able to delete the request. In case of the validator can not validate, an error is thrown.
- Specified by:
deleteRequest
in interfaceFormsOnlineService
- Parameters:
pk
- the unique identifier of the aimed request.- Throws:
FormsOnlineException
- if the current user can not delete the request or on technical error.
-
archiveRequest
public void archiveRequest(RequestPK pk) throws FormsOnlineException
Description copied from interface:FormsOnlineService
Archives the request represented by the given identifier.The service ensures that the current user is able to archive the request. In case of the validator can not validate, an error is thrown.
- Specified by:
archiveRequest
in interfaceFormsOnlineService
- Parameters:
pk
- the unique identifier of the aimed request.- Throws:
FormsOnlineException
- if the current user can not archive the request or on technical error.
-
getContributionById
public Optional<FormInstance> getContributionById(org.silverpeas.core.contribution.model.ContributionIdentifier contributionId)
- Specified by:
getContributionById
in interfaceorg.silverpeas.core.ApplicationService
- Specified by:
getContributionById
in interfaceFormsOnlineService
-
getComponentSettings
public org.silverpeas.core.util.SettingBundle getComponentSettings()
- Specified by:
getComponentSettings
in interfaceorg.silverpeas.core.ApplicationService
-
getComponentMessages
public org.silverpeas.core.util.LocalizationBundle getComponentMessages(String language)
- Specified by:
getComponentMessages
in interfaceorg.silverpeas.core.ApplicationService
-
isRelatedTo
public boolean isRelatedTo(String instanceId)
Is this service related to the specified component instance. The service is related to the specified instance if it is a service defined by the application from which the instance was spawned.- Specified by:
isRelatedTo
in interfaceorg.silverpeas.core.ApplicationService
- Parameters:
instanceId
- the unique instance identifier of the component.- Returns:
- true if the instance is spawn from the application to which the service is related. False otherwise.
-
index
public void index(String componentId)
- Specified by:
index
in interfaceFormsOnlineService
-
-