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 classDefaultFormsOnlineService.HierarchicalValidatorCacheManagerPermits 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 voidarchiveRequest(RequestPK pk)Archives the request represented by the given identifier.voidcancelRequest(RequestPK pk)Cancels the request represented by the given identifier.booleandeleteForm(FormPK pk)voiddeleteRequest(RequestPK pk)Deletes the request represented by the given identifier.List<FormDetail>getAllForms(String appId, String userId, boolean withSendInfo)RequestsByStatusgetAllUserRequests(String appId, String userId, org.silverpeas.core.admin.PaginationPage paginationPage)List<FormDetail>getAvailableFormsToSend(Collection<String> appIds, String userId, String orderBy)org.silverpeas.core.util.LocalizationBundlegetComponentMessages(String language)org.silverpeas.core.util.SettingBundlegetComponentSettings()Optional<FormInstance>getContributionById(org.silverpeas.core.contribution.model.ContributionIdentifier contributionId)Map<String,Set<FormInstanceValidationType>>getValidatorFormIdsWithValidationTypes(String appId, String validatorId, Collection<String> formIds)Gets theFormInstanceValidationTypeinstances mapped by form identifiers of the validator represented by given validator id and validator group ids on the given component instance.RequestsByStatusgetValidatorRequests(RequestsFilter filter, String validatorId, org.silverpeas.core.admin.PaginationPage paginationPage)voidindex(String componentId)voidinit()booleanisRelatedTo(String instanceId)Is this service related to the specified component instance.FormDetailloadForm(FormPK pk)FormInstanceloadRequest(RequestPK pk, String userId)FormInstanceloadRequest(RequestPK pk, String userId, boolean editionMode)voidpublishForm(FormPK pk)FormDetailsaveForm(FormDetail form, Map<String,org.silverpeas.core.util.Pair<List<String>,List<String>>> userAndGroupIdsByRightTypes)voidsaveNextRequestValidationStep(RequestPK pk, String validatorId, String decision, String comment, boolean follower)Register a step of validation of the request represented by the given identifier.voidsaveRequest(FormPK pk, String userId, List<org.apache.commons.fileupload.FileItem> items, boolean draft)voidunpublishForm(FormPK pk)
-
-
-
Method Detail
-
init
public void init()
- Specified by:
initin interfaceorg.silverpeas.core.initialization.Initialization
-
getAllForms
public List<FormDetail> getAllForms(String appId, String userId, boolean withSendInfo) throws FormsOnlineException
- Specified by:
getAllFormsin interfaceFormsOnlineService- Throws:
FormsOnlineException
-
loadForm
public FormDetail loadForm(FormPK pk) throws FormsOnlineException
- Specified by:
loadFormin 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:
saveFormin interfaceFormsOnlineService- Throws:
FormsOnlineException
-
deleteForm
public boolean deleteForm(FormPK pk) throws FormsOnlineException
- Specified by:
deleteFormin interfaceFormsOnlineService- Throws:
FormsOnlineException
-
publishForm
public void publishForm(FormPK pk) throws FormsOnlineException
- Specified by:
publishFormin interfaceFormsOnlineService- Throws:
FormsOnlineException
-
unpublishForm
public void unpublishForm(FormPK pk) throws FormsOnlineException
- Specified by:
unpublishFormin interfaceFormsOnlineService- Throws:
FormsOnlineException
-
getAvailableFormsToSend
public List<FormDetail> getAvailableFormsToSend(Collection<String> appIds, String userId, String orderBy) throws FormsOnlineException
- Specified by:
getAvailableFormsToSendin interfaceFormsOnlineService- Throws:
FormsOnlineException
-
getAllUserRequests
public RequestsByStatus getAllUserRequests(String appId, String userId, org.silverpeas.core.admin.PaginationPage paginationPage) throws FormsOnlineException
- Specified by:
getAllUserRequestsin interfaceFormsOnlineService- Throws:
FormsOnlineException
-
getValidatorRequests
public RequestsByStatus getValidatorRequests(RequestsFilter filter, String validatorId, org.silverpeas.core.admin.PaginationPage paginationPage) throws FormsOnlineException
- Specified by:
getValidatorRequestsin interfaceFormsOnlineService- Throws:
FormsOnlineException
-
getValidatorFormIdsWithValidationTypes
public Map<String,Set<FormInstanceValidationType>> getValidatorFormIdsWithValidationTypes(String appId, String validatorId, Collection<String> formIds) throws FormsOnlineException
Description copied from interface:FormsOnlineServiceGets theFormInstanceValidationTypeinstances mapped by form identifiers of the validator represented by given validator id and validator group ids on the given component instance.- Specified by:
getValidatorFormIdsWithValidationTypesin 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:
FormInstanceValidationTypeinstances mapped by form identifiers.- Throws:
FormsOnlineException- if an error occurs
-
loadRequest
public FormInstance loadRequest(RequestPK pk, String userId) throws FormsOnlineException
- Specified by:
loadRequestin interfaceFormsOnlineService- Throws:
FormsOnlineException
-
loadRequest
public FormInstance loadRequest(RequestPK pk, String userId, boolean editionMode) throws FormsOnlineException
- Specified by:
loadRequestin interfaceFormsOnlineService- Throws:
FormsOnlineException
-
saveRequest
public void saveRequest(FormPK pk, String userId, List<org.apache.commons.fileupload.FileItem> items, boolean draft) throws FormsOnlineException
- Specified by:
saveRequestin interfaceFormsOnlineService- Throws:
FormsOnlineException
-
saveNextRequestValidationStep
public void saveNextRequestValidationStep(RequestPK pk, String validatorId, String decision, String comment, boolean follower) throws FormsOnlineException
Description copied from interface:FormsOnlineServiceRegister 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:
saveNextRequestValidationStepin 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:FormsOnlineServiceCancels 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:
cancelRequestin 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:FormsOnlineServiceDeletes 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:
deleteRequestin 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:FormsOnlineServiceArchives 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:
archiveRequestin 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:
getContributionByIdin interfaceorg.silverpeas.core.ApplicationService- Specified by:
getContributionByIdin interfaceFormsOnlineService
-
getComponentSettings
public org.silverpeas.core.util.SettingBundle getComponentSettings()
- Specified by:
getComponentSettingsin interfaceorg.silverpeas.core.ApplicationService
-
getComponentMessages
public org.silverpeas.core.util.LocalizationBundle getComponentMessages(String language)
- Specified by:
getComponentMessagesin 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:
isRelatedToin 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:
indexin interfaceFormsOnlineService
-
-