Package org.cyclos.impl.system
Class CustomOperationServiceImpl
- java.lang.Object
-
- org.cyclos.impl.AbstractServerComponent
-
- org.cyclos.impl.AbstractNetworkedServerComponent
-
- org.cyclos.impl.BaseServiceImpl
-
- org.cyclos.impl.CRUDServiceImpl<CustomOperation,QCustomOperation,CustomOperationDTO,CustomOperationData,Void>
-
- org.cyclos.impl.system.CustomOperationServiceImpl
-
- All Implemented Interfaces:
CRUDServiceLocal<CustomOperation,CustomOperationDTO,CustomOperationData,Void>,CustomOperationServiceLocal,CRUDService<CustomOperationDTO,CustomOperationData,Void>,CRUDWithConfirmationPasswordService<CustomOperationDTO,CustomOperationData,Void>,Service,CustomOperationService
@Service public class CustomOperationServiceImpl extends CRUDServiceImpl<CustomOperation,QCustomOperation,CustomOperationDTO,CustomOperationData,Void> implements CustomOperationServiceLocal
Implementation forCustomOperationService
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description static classCustomOperationServiceImpl.Actionstatic classCustomOperationServiceImpl.ActionsContainerclassCustomOperationServiceImpl.PageResultAdapterAdapts the simple format for custom operations that returns result pages, supporting both simple format (headers / results) and complex format (columns / rows)
-
Field Summary
-
Fields inherited from class org.cyclos.impl.CRUDServiceImpl
$, ATTR_CURRENT_COPY, dtoClass, entityClass, extensionPointService, idPath, internalNamePath, namePath, ownerEntityIdPath, ownerEntityPath, ownerEntityPropertyName, passwordHandler, richTextHandler, withConfirmationPassword
-
Fields inherited from class org.cyclos.impl.AbstractNetworkedServerComponent
authHandler, conversionHandler, entityManagerHandler, groupsHandler, productsHandler, restBeanPropertyMapping, userLocatorHandler
-
Fields inherited from class org.cyclos.impl.AbstractServerComponent
accountHandler, configurationHandler, dataTranslationHandler, notificationHandler, profileFieldHandler, transactionHandler, translationHandler
-
Fields inherited from interface org.cyclos.impl.system.CustomOperationServiceLocal
ATTR_AD, ATTR_BULK_ACTION, ATTR_CONTACT, ATTR_CONTACT_INFO, ATTR_CONTAINER_CUSTOM_OPERATION, ATTR_CURRENT_PAGE, ATTR_CUSTOM_OPERATION, ATTR_EXECUTION, ATTR_EXPORT_FORMAT, ATTR_EXTERNAL_REDIRECT_EXECUTION, ATTR_FORM_PARAMETERS, ATTR_INPUT_FILE, ATTR_MENU_ITEM, ATTR_PAGE_CONTEXT, ATTR_PAGE_SIZE, ATTR_PARAMETER_STORAGE, ATTR_RECORD, ATTR_REQUEST, ATTR_RETURN_URL, ATTR_SCANNED_QR_CODE, ATTR_SKIP_TOTAL_COUNT, ATTR_STORAGE, ATTR_TRANSFER, ATTR_USER
-
-
Constructor Summary
Constructors Constructor Description CustomOperationServiceImpl()
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description PasswordInputDTOgetConfirmationPasswordInputForRun(RunCustomOperationDataParams params)Returns thePasswordInputDTOfor the confirmation password that would be required if executing the given custom operation.protected CustomOperationDatagetData(CustomOperation customOperation)Returns details data for the given entitySimpleEntitygetRelatedEntity(RunCustomOperationDataParams params)Returns the entity associated with the givenRunCustomOperationDataParamsSimpleEntitygetRelatedEntity(RunCustomOperationDTO params)Returns the entity associated with the givenRunCustomOperationDTORunCustomOperationDatagetRunData(RunCustomOperationDataParams params)Returns data to run a custom operation.List<CustomOperation>getRunnableCustomOperationsForSystem()Lists the custom operations with scope =CustomOperationScope.SYSTEMthe logged user can runList<CustomOperation>getRunnableOperationsForAd(BasicAd ad)Returns the custom operations that can be run by the logged user over the given adList<RunnableCustomOperationVO>getRunnableOperationsForAd(BasicAdVO vo)Lists the user custom operations scope =CustomOperationScope.ADVERTISEMENTthe logged user can run over the given advertisementList<CustomOperation>getRunnableOperationsForBulkActions()Returns the custom operations that can be run by the logged user as a bulk actionList<CustomOperation>getRunnableOperationsForContact(Contact contact)Returns the custom operations that can be run by the logged user over the given contactList<RunnableCustomOperationVO>getRunnableOperationsForContact(ContactVO contactVO)Lists the user custom operations scope =CustomOperationScope.CONTACTthe logged user can run over the given contactList<CustomOperation>getRunnableOperationsForContactInfo(ContactInfo contactInfo)Returns the custom operations that can be run by the logged user over the given additional contact informationList<RunnableCustomOperationVO>getRunnableOperationsForContactInfo(ContactInfoVO contactInfoVO)Lists the user custom operations scope =CustomOperationScope.CONTACT_INFOthe logged user can run over the given additional contact informationList<CustomOperation>getRunnableOperationsForMenu()Returns the custom operations which can be run as menu items for the current sessionList<CustomOperation>getRunnableOperationsForRecord(Record record)Returns the custom operations that can be run by the logged user over the given recordList<RunnableCustomOperationVO>getRunnableOperationsForRecord(RecordVO vo)Lists the user custom operations scope =CustomOperationScope.RECORDthe logged user can run over the given recordList<RunnableCustomOperationVO>getRunnableOperationsForSystem()Lists the custom operations with scope =CustomOperationScope.SYSTEMthe logged user can runList<CustomOperation>getRunnableOperationsForTransfer(Transfer transfer)Returns the custom operations that can be run by the logged user over the given transferList<RunnableCustomOperationVO>getRunnableOperationsForTransfer(TransferVO vo)Lists the custom operations with scope =CustomOperationScope.TRANSFERthe logged user can run over the given transferList<CustomOperation>getRunnableOperationsForUser(User user)Returns the custom operations that can be run by the logged user as a user actionList<RunnableCustomOperationVO>getRunnableOperationsForUser(UserLocatorVO locator)Lists the user custom operations scope =CustomOperationScope.USERthe logged user can run over the given user (or self if null)List<CustomOperationResultVO>list()Lists all available custom operationsList<CustomOperation>listAllowedToRun()Lists all custom operations the logged user is allowed to runList<CustomOperation>listByScope(CustomOperationScope... scopes)Lists the custom operations for the given scopesList<CustomOperation>listOperationsRedirectingTo(CustomOperation internal)Lists the custom operations that use the given internal operation, either as row action or as actionList<CustomOperation>listWithRecordScope(RecordTypeNature... natures)Lists the custom operations with scope record configured with at least one record type of the given nature(s)CustomOperationnewEntity(Void params)Should be implemented in order to instantiate a new entity based on the given context parametersprotected voidonAfterRemove(CustomOperation entity)May be overridden in order to perform custom logic after removing an entityprotected ObjectonBeforeSave(CustomOperation operation, CustomOperation currentCopy)May be overridden in order to perform custom logic before saving an entity.protected voidpreProcessCurrentCopy(CustomOperationDTO dto, CustomOperation currentCopy)This method is invoked before saving the entity and also, if the log is enabled, before removing.protected voidregisterNetworkMappings(NetworkPathRegistry networkPathRegistry)Needs to be overridden by subclasses to register the path up to the networkCustomOperationresolveCustomOperation(SimpleEntity entity, CustomOperationVO customOperation)Returns the custom operation associated to the given entity if corresponds.protected ValidatorresolveValidator(CustomOperationDTO dto)RunCustomOperationResultrun(RunCustomOperationDTO params)Runs a custom operation, returning the result with all type informationRunCustomOperationResultrunExternalRedirectCallback(RunExternalRedirectCallbackParams params)Runs the callback for a custom operation of type external redirect.BulkActionUserResultrunForBulkAction(BulkActionUser bulkActionUser)Runs the custom operation for a bulk action executionvoidsetMissingFormParameters(RunnableCustomOperationVO runnable, CustomOperation customOperation)Sets toRunnableCustomOperationVO.MISSING_REQUIRED_PARAMETERSthe list of all required parameter and toRunnableCustomOperationVO.MISSING_OPTIONAL_PARAMETERSall the optional ones from the givenCustomOperation-
Methods inherited from class org.cyclos.impl.CRUDServiceImpl
addCustomInternalNameValidations, addCustomNameValidations, checkConfirmationPassword, doRemove, find, findAll, from, getConfirmationPasswordInput, getConfirmationPasswordInputForRemove, getData, getDataForNew, getDeviceConfirmationParams, getEntityClass, getEntityInternalNameKey, getExcludedPropertiesToDTO, getExcludedPropertiesToEntity, getNameLabel, getUniqueInternalNameQuery, getUniqueNameQuery, isEntityInternalNameRequired, isNameRequired, load, logEntity, onAfterSave, onBeforeRemove, remove, remove, removeAll, removeAll, removeAllWithConfirmationPassword, removeWithConfirmationPassword, resolveDTOType, resolveEntityType, resolveExtensionPointAccessor, save, saveOrder, saveSkippingEntityLog, saveWithConfirmationPassword, shouldCheckConfirmationPassword, subClassMappings, toDTO, toEntity, validate
-
Methods inherited from class org.cyclos.impl.BaseServiceImpl
initializeNetworkMappings
-
Methods inherited from class org.cyclos.impl.AbstractNetworkedServerComponent
canManage, checkManagesUser, checkPermission, checkRelatesToUser, checkValue, clearAlreadyValidated, getBaseEntityManagerHandler, getConfiguration, getLoggedBasicUser, getLoggedUser, getProducts, getTranslatedName, getTranslatedValue, hasPermission, hasValue, inSameNetwork, inSameNetworkOrGlobal, isAdmin, isAlreadyValidated, isBroker, isGlobalAdmin, isGlobalAdminInNetwork, isGuest, isLoggedIn, isMember, isMemberOnly, isNetworkAdmin, isOperator, isRelatedToUser, isSystem, isUserManager, isUserManagerOf, message, message, permission, permission, permissionOptionalValue, permissionOptionalValue, setAlreadyValidated, toDate, toDateTime, validate
-
Methods inherited from class org.cyclos.impl.AbstractServerComponent
dataTranslationProxy, dataTranslationProxy, delete, detach, doDataTranslationProxy, find, flush, from, getApplicationContext, getFormatter, getFormatter, getFormatter, getLogger, getRemoteAddress, getSessionData, mailContentBuilder, message, message, persist, processBatch, processBatch, refresh, remove, selectFrom, subQuery, update
-
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
-
Methods inherited from interface org.cyclos.services.CRUDService
getData, getDataForNew, load, remove, removeAll, save
-
Methods inherited from interface org.cyclos.impl.CRUDServiceLocal
find, findAll, getEntityClass, remove, removeAll, saveEntity, saveSkippingEntityLog, toDTO, toEntity, validate
-
Methods inherited from interface org.cyclos.services.system.CustomOperationService
saveOrder
-
-
-
-
Method Detail
-
getConfirmationPasswordInputForRun
public PasswordInputDTO getConfirmationPasswordInputForRun(RunCustomOperationDataParams params)
Description copied from interface:CustomOperationServiceReturns thePasswordInputDTOfor the confirmation password that would be required if executing the given custom operation.- Specified by:
getConfirmationPasswordInputForRunin interfaceCustomOperationService
-
getRelatedEntity
public SimpleEntity getRelatedEntity(RunCustomOperationDataParams params)
Description copied from interface:CustomOperationServiceLocalReturns the entity associated with the givenRunCustomOperationDataParams- Specified by:
getRelatedEntityin interfaceCustomOperationServiceLocal
-
getRelatedEntity
public SimpleEntity getRelatedEntity(RunCustomOperationDTO params)
Description copied from interface:CustomOperationServiceLocalReturns the entity associated with the givenRunCustomOperationDTO- Specified by:
getRelatedEntityin interfaceCustomOperationServiceLocal
-
getRunData
public RunCustomOperationData getRunData(RunCustomOperationDataParams params)
Description copied from interface:CustomOperationServiceReturns data to run a custom operation. Depending on the custom operation scope, the input parameters must be a subclass ofRunCustomOperationDataParamswith the specific parmeters set (for example, aRunRecordCustomOperationDataParamswith the record set if the scope isCustomOperationScope.RECORD) The result will also be a subclass ofRunCustomOperationDatadepending on the custom operation scope, for example aRunRecordCustomOperationData.- Specified by:
getRunDatain interfaceCustomOperationService
-
getRunnableCustomOperationsForSystem
public List<CustomOperation> getRunnableCustomOperationsForSystem()
Description copied from interface:CustomOperationServiceLocalLists the custom operations with scope =CustomOperationScope.SYSTEMthe logged user can run- Specified by:
getRunnableCustomOperationsForSystemin interfaceCustomOperationServiceLocal
-
getRunnableOperationsForAd
public List<CustomOperation> getRunnableOperationsForAd(BasicAd ad)
Description copied from interface:CustomOperationServiceLocalReturns the custom operations that can be run by the logged user over the given ad- Specified by:
getRunnableOperationsForAdin interfaceCustomOperationServiceLocal
-
getRunnableOperationsForAd
public List<RunnableCustomOperationVO> getRunnableOperationsForAd(BasicAdVO vo) throws FrameworkException
Description copied from interface:CustomOperationServiceLists the user custom operations scope =CustomOperationScope.ADVERTISEMENTthe logged user can run over the given advertisement- Specified by:
getRunnableOperationsForAdin interfaceCustomOperationService- Throws:
FrameworkException
-
getRunnableOperationsForBulkActions
public List<CustomOperation> getRunnableOperationsForBulkActions()
Description copied from interface:CustomOperationServiceLocalReturns the custom operations that can be run by the logged user as a bulk action- Specified by:
getRunnableOperationsForBulkActionsin interfaceCustomOperationServiceLocal
-
getRunnableOperationsForContact
public List<CustomOperation> getRunnableOperationsForContact(Contact contact)
Description copied from interface:CustomOperationServiceLocalReturns the custom operations that can be run by the logged user over the given contact- Specified by:
getRunnableOperationsForContactin interfaceCustomOperationServiceLocal
-
getRunnableOperationsForContact
public List<RunnableCustomOperationVO> getRunnableOperationsForContact(ContactVO contactVO) throws FrameworkException
Description copied from interface:CustomOperationServiceLists the user custom operations scope =CustomOperationScope.CONTACTthe logged user can run over the given contact- Specified by:
getRunnableOperationsForContactin interfaceCustomOperationService- Throws:
FrameworkException
-
getRunnableOperationsForContactInfo
public List<CustomOperation> getRunnableOperationsForContactInfo(ContactInfo contactInfo)
Description copied from interface:CustomOperationServiceLocalReturns the custom operations that can be run by the logged user over the given additional contact information- Specified by:
getRunnableOperationsForContactInfoin interfaceCustomOperationServiceLocal
-
getRunnableOperationsForContactInfo
public List<RunnableCustomOperationVO> getRunnableOperationsForContactInfo(ContactInfoVO contactInfoVO) throws FrameworkException
Description copied from interface:CustomOperationServiceLists the user custom operations scope =CustomOperationScope.CONTACT_INFOthe logged user can run over the given additional contact information- Specified by:
getRunnableOperationsForContactInfoin interfaceCustomOperationService- Throws:
FrameworkException
-
getRunnableOperationsForMenu
public List<CustomOperation> getRunnableOperationsForMenu() throws FrameworkException
Description copied from interface:CustomOperationServiceLocalReturns the custom operations which can be run as menu items for the current session- Specified by:
getRunnableOperationsForMenuin interfaceCustomOperationServiceLocal- Throws:
FrameworkException
-
getRunnableOperationsForRecord
public List<CustomOperation> getRunnableOperationsForRecord(Record record)
Description copied from interface:CustomOperationServiceLocalReturns the custom operations that can be run by the logged user over the given record- Specified by:
getRunnableOperationsForRecordin interfaceCustomOperationServiceLocal
-
getRunnableOperationsForRecord
public List<RunnableCustomOperationVO> getRunnableOperationsForRecord(RecordVO vo) throws FrameworkException
Description copied from interface:CustomOperationServiceLists the user custom operations scope =CustomOperationScope.RECORDthe logged user can run over the given record- Specified by:
getRunnableOperationsForRecordin interfaceCustomOperationService- Throws:
FrameworkException
-
getRunnableOperationsForSystem
public List<RunnableCustomOperationVO> getRunnableOperationsForSystem() throws FrameworkException
Description copied from interface:CustomOperationServiceLists the custom operations with scope =CustomOperationScope.SYSTEMthe logged user can run- Specified by:
getRunnableOperationsForSystemin interfaceCustomOperationService- Throws:
FrameworkException
-
getRunnableOperationsForTransfer
public List<CustomOperation> getRunnableOperationsForTransfer(Transfer transfer)
Description copied from interface:CustomOperationServiceLocalReturns the custom operations that can be run by the logged user over the given transfer- Specified by:
getRunnableOperationsForTransferin interfaceCustomOperationServiceLocal
-
getRunnableOperationsForTransfer
public List<RunnableCustomOperationVO> getRunnableOperationsForTransfer(TransferVO vo) throws FrameworkException
Description copied from interface:CustomOperationServiceLists the custom operations with scope =CustomOperationScope.TRANSFERthe logged user can run over the given transfer- Specified by:
getRunnableOperationsForTransferin interfaceCustomOperationService- Throws:
FrameworkException
-
getRunnableOperationsForUser
public List<CustomOperation> getRunnableOperationsForUser(User user)
Description copied from interface:CustomOperationServiceLocalReturns the custom operations that can be run by the logged user as a user action- Specified by:
getRunnableOperationsForUserin interfaceCustomOperationServiceLocal
-
getRunnableOperationsForUser
public List<RunnableCustomOperationVO> getRunnableOperationsForUser(UserLocatorVO locator) throws FrameworkException
Description copied from interface:CustomOperationServiceLists the user custom operations scope =CustomOperationScope.USERthe logged user can run over the given user (or self if null)- Specified by:
getRunnableOperationsForUserin interfaceCustomOperationService- Throws:
FrameworkException
-
list
public List<CustomOperationResultVO> list() throws FrameworkException
Description copied from interface:CustomOperationServiceLists all available custom operations- Specified by:
listin interfaceCustomOperationService- Throws:
FrameworkException
-
listAllowedToRun
public List<CustomOperation> listAllowedToRun()
Description copied from interface:CustomOperationServiceLocalLists all custom operations the logged user is allowed to run- Specified by:
listAllowedToRunin interfaceCustomOperationServiceLocal
-
listByScope
public List<CustomOperation> listByScope(CustomOperationScope... scopes) throws FrameworkException
Description copied from interface:CustomOperationServiceLocalLists the custom operations for the given scopes- Specified by:
listByScopein interfaceCustomOperationServiceLocal- Throws:
FrameworkException
-
listOperationsRedirectingTo
public List<CustomOperation> listOperationsRedirectingTo(CustomOperation internal)
Description copied from interface:CustomOperationServiceLocalLists the custom operations that use the given internal operation, either as row action or as action- Specified by:
listOperationsRedirectingToin interfaceCustomOperationServiceLocal
-
listWithRecordScope
public List<CustomOperation> listWithRecordScope(RecordTypeNature... natures) throws FrameworkException
Description copied from interface:CustomOperationServiceLocalLists the custom operations with scope record configured with at least one record type of the given nature(s)- Specified by:
listWithRecordScopein interfaceCustomOperationServiceLocal- Throws:
FrameworkException
-
newEntity
public CustomOperation newEntity(Void params)
Description copied from class:CRUDServiceImplShould be implemented in order to instantiate a new entity based on the given context parameters- Specified by:
newEntityin interfaceCRUDServiceLocal<CustomOperation,CustomOperationDTO,CustomOperationData,Void>- Specified by:
newEntityin classCRUDServiceImpl<CustomOperation,QCustomOperation,CustomOperationDTO,CustomOperationData,Void>
-
resolveCustomOperation
public CustomOperation resolveCustomOperation(SimpleEntity entity, CustomOperationVO customOperation)
Description copied from interface:CustomOperationServiceLocalReturns the custom operation associated to the given entity if corresponds. Otherwise, the conversion of the given customOperationVO- Specified by:
resolveCustomOperationin interfaceCustomOperationServiceLocal
-
run
public RunCustomOperationResult run(RunCustomOperationDTO params) throws FrameworkException
Description copied from interface:CustomOperationServiceRuns a custom operation, returning the result with all type information- Specified by:
runin interfaceCustomOperationService- Throws:
FrameworkException
-
runExternalRedirectCallback
public RunCustomOperationResult runExternalRedirectCallback(RunExternalRedirectCallbackParams params) throws FrameworkException
Description copied from interface:CustomOperationServiceRuns the callback for a custom operation of type external redirect. The result is currently always sent with result type =CustomOperationResultType.NOTIFICATION.- Specified by:
runExternalRedirectCallbackin interfaceCustomOperationService- Throws:
FrameworkException
-
runForBulkAction
public BulkActionUserResult runForBulkAction(BulkActionUser bulkActionUser)
Description copied from interface:CustomOperationServiceLocalRuns the custom operation for a bulk action execution- Specified by:
runForBulkActionin interfaceCustomOperationServiceLocal
-
setMissingFormParameters
public void setMissingFormParameters(RunnableCustomOperationVO runnable, CustomOperation customOperation)
Description copied from interface:CustomOperationServiceLocalSets toRunnableCustomOperationVO.MISSING_REQUIRED_PARAMETERSthe list of all required parameter and toRunnableCustomOperationVO.MISSING_OPTIONAL_PARAMETERSall the optional ones from the givenCustomOperation- Specified by:
setMissingFormParametersin interfaceCustomOperationServiceLocal
-
getData
protected CustomOperationData getData(CustomOperation customOperation)
Description copied from class:CRUDServiceImplReturns details data for the given entity- Specified by:
getDatain classCRUDServiceImpl<CustomOperation,QCustomOperation,CustomOperationDTO,CustomOperationData,Void>
-
onAfterRemove
protected void onAfterRemove(CustomOperation entity)
Description copied from class:CRUDServiceImplMay be overridden in order to perform custom logic after removing an entity- Overrides:
onAfterRemovein classCRUDServiceImpl<CustomOperation,QCustomOperation,CustomOperationDTO,CustomOperationData,Void>
-
onBeforeSave
protected Object onBeforeSave(CustomOperation operation, CustomOperation currentCopy)
Description copied from class:CRUDServiceImplMay be overridden in order to perform custom logic before saving an entity. Any returned value will be passed to theCRUDServiceImpl.onAfterSave(BaseEntity, BaseEntity, Object)method- Overrides:
onBeforeSavein classCRUDServiceImpl<CustomOperation,QCustomOperation,CustomOperationDTO,CustomOperationData,Void>
-
preProcessCurrentCopy
protected void preProcessCurrentCopy(CustomOperationDTO dto, CustomOperation currentCopy)
Description copied from class:CRUDServiceImplThis method is invoked before saving the entity and also, if the log is enabled, before removing. Subclasses can override it to fetch lazy relationships, etc as the current copy will be detached. In case of removing (i.e the log is enabled for this entity) the dto parameter will be null.- Overrides:
preProcessCurrentCopyin classCRUDServiceImpl<CustomOperation,QCustomOperation,CustomOperationDTO,CustomOperationData,Void>
-
registerNetworkMappings
protected void registerNetworkMappings(NetworkPathRegistry networkPathRegistry)
Description copied from class:BaseServiceImplNeeds to be overridden by subclasses to register the path up to the network- Specified by:
registerNetworkMappingsin classBaseServiceImpl
-
resolveValidator
protected Validator resolveValidator(CustomOperationDTO dto)
- Specified by:
resolveValidatorin classCRUDServiceImpl<CustomOperation,QCustomOperation,CustomOperationDTO,CustomOperationData,Void>
-
-