Package org.cyclos.impl.users
Class BulkActionServiceImpl
- java.lang.Object
-
- org.cyclos.impl.AbstractServerComponent
-
- org.cyclos.impl.AbstractNetworkedServerComponent
-
- org.cyclos.impl.BaseServiceImpl
-
- org.cyclos.impl.CRUDServiceImpl<BulkAction,QBulkAction,BulkActionDTO,BulkActionData,BulkActionDataParams>
-
- org.cyclos.impl.users.BulkActionServiceImpl
-
- All Implemented Interfaces:
CRUDServiceLocal<BulkAction,BulkActionDTO,BulkActionData,BulkActionDataParams>,BulkActionServiceLocal,CRUDService<BulkActionDTO,BulkActionData,BulkActionDataParams>,CRUDWithConfirmationPasswordService<BulkActionDTO,BulkActionData,BulkActionDataParams>,Service,BulkActionService
@Service public class BulkActionServiceImpl extends CRUDServiceImpl<BulkAction,QBulkAction,BulkActionDTO,BulkActionData,BulkActionDataParams> implements BulkActionServiceLocal
Service implementation forBulkActionService
-
-
Field Summary
-
Fields inherited from class org.cyclos.impl.CRUDServiceImpl
$, ATTR_CURRENT_COPY, cacheHandler, dtoClass, entityClass, extensionPointService, idPath, internalNamePath, namePath, ownerEntityIdPath, ownerEntityPath, ownerEntityPropertyName, passwordHandler, richTextHandler, withConfirmationPassword
-
Fields inherited from class org.cyclos.impl.AbstractNetworkedServerComponent
authHandler, conversionHandler, customFieldValueHandler, entityManagerHandler, groupsHandler, productsHandler, restBeanPropertyMapping, userLocatorHandler
-
Fields inherited from class org.cyclos.impl.AbstractServerComponent
accountHandler, configurationHandler, dataTranslationHandler, notificationHandler, profileFieldHandler, transactionHandler, translationHandler
-
-
Constructor Summary
Constructors Constructor Description BulkActionServiceImpl()
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description longarchive(long id)Archives the given bulk action, returning the number of relations to users removedintcancel(Long bulkActionId)Cancels a running bulk action, returning the number of users that were effectively canceledprotected BulkActionDatagetData(BulkAction bulkAction)Returns details data for the given entityStringgetErrorStackTrace(Long bulkActionUserId)Returns the error stack trace for the given bulk action user.protected Object[]getExcludedPropertiesToEntity(BulkActionDTO dto)May be overridden in order to exclude properties when converting the given DTO to entityBulkActionsSearchDatagetSearchData(BulkActionUsage usage)Returns data for searching bulk actions for a given usageBulkActionSearchUsersDatagetSearchUsersData(BulkActionDataParams params)Returns data for searching users to run a bulk action over themBulkActionStatusVOgetStatus(Long id)Returns the current status of this bulk action counter of users for the bulk action with the given idvoidinitialize()voidmarkFinished(BulkAction bulkAction)Marks the givenBulkActionas finishedBulkActionnewEntity(BulkActionDataParams params)Should be implemented in order to instantiate a new entity based on the given context parametersprotected voidonAfterSave(BulkAction bulkAction, BulkAction currentCopy, Object dataFromOnBeforeSave)May be overridden in order to perform custom logic after saving an entityprotected ObjectonBeforeSave(BulkAction bulkAction, BulkAction currentCopy)May be overridden in order to perform custom logic before saving an entity.BulkActionUserResultprocess(TransactionStatus tx, BulkActionUser bulkActionUser)booleanprocessNext(Long id)Processes the next user of the bulk action with the given id, returning whether there are more users to process or not.protected voidregisterNetworkMappings(NetworkPathRegistry networkPathRegistry)Needs to be overridden by subclasses to register the path up to the networkprotected ValidatorresolveValidator(BulkActionDTO dto)Page<BulkActionVO>search(BulkActionQuery params)Searches for already executed bulk actionsPage<BulkActionUserVO>searchUsers(BulkActionUserQuery params)Searches for users affected by a bulk actionprotected org.apache.commons.collections4.BidiMap<Class<? extends BulkAction>,Class<? extends BulkActionDTO>>subClassMappings()Should be overridden by subclasses which handle entity / dto hierarchies.BulkActionDTOtoDTO(BulkAction bulkAction)Converts the given entity in a DTO, handling theCRUDServiceImpl.subClassMappings()mappings for subclassesBulkActiontoEntity(BulkActionDTO dto)Converts the given DTO in an entity, handling theCRUDServiceImpl.subClassMappings()mappings for subclasses-
Methods inherited from class org.cyclos.impl.CRUDServiceImpl
addCustomInternalNameValidations, addCustomNameValidations, checkConfirmationPassword, doRemove, find, findAll, from, getConfirmationPasswordInput, getConfirmationPasswordInputForRemove, getData, getDataForNew, getDeviceConfirmationParams, getEntityClass, getEntityInternalNameKey, getExcludedPropertiesToDTO, getNameLabel, getUniqueInternalNameQuery, getUniqueNameQuery, isEntityInternalNameRequired, isNameRequired, load, logEntity, onAfterRemove, onBeforeRemove, preProcessCurrentCopy, remove, remove, removeAll, removeAll, removeAllWithConfirmationPassword, removeWithConfirmationPassword, resolveDTOType, resolveEntityType, resolveExtensionPointAccessor, save, saveOrder, saveSkippingEntityLog, saveWithConfirmationPassword, shouldCheckConfirmationPassword, 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, validate
-
-
-
-
Method Detail
-
archive
public long archive(long id)
Description copied from interface:BulkActionServiceLocalArchives the given bulk action, returning the number of relations to users removed- Specified by:
archivein interfaceBulkActionServiceLocal
-
cancel
public int cancel(Long bulkActionId) throws FrameworkException
Description copied from interface:BulkActionServiceCancels a running bulk action, returning the number of users that were effectively canceled- Specified by:
cancelin interfaceBulkActionService- Throws:
FrameworkException
-
getErrorStackTrace
public String getErrorStackTrace(Long bulkActionUserId) throws FrameworkException
Description copied from interface:BulkActionServiceReturns the error stack trace for the given bulk action user. If there is no error, returns null.- Specified by:
getErrorStackTracein interfaceBulkActionService- Throws:
FrameworkException
-
getSearchData
public BulkActionsSearchData getSearchData(BulkActionUsage usage) throws FrameworkException
Description copied from interface:BulkActionServiceReturns data for searching bulk actions for a given usage- Specified by:
getSearchDatain interfaceBulkActionService- Throws:
FrameworkException
-
getSearchUsersData
public BulkActionSearchUsersData getSearchUsersData(BulkActionDataParams params) throws FrameworkException
Description copied from interface:BulkActionServiceReturns data for searching users to run a bulk action over them- Specified by:
getSearchUsersDatain interfaceBulkActionService- Throws:
FrameworkException
-
getStatus
public BulkActionStatusVO getStatus(Long id) throws FrameworkException
Description copied from interface:BulkActionServiceReturns the current status of this bulk action counter of users for the bulk action with the given id- Specified by:
getStatusin interfaceBulkActionService- Throws:
FrameworkException
-
initialize
@PostConstruct public void initialize()
-
markFinished
public void markFinished(BulkAction bulkAction)
Description copied from interface:BulkActionServiceLocalMarks the givenBulkActionas finished- Specified by:
markFinishedin interfaceBulkActionServiceLocal
-
newEntity
public BulkAction newEntity(BulkActionDataParams 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<BulkAction,BulkActionDTO,BulkActionData,BulkActionDataParams>- Specified by:
newEntityin classCRUDServiceImpl<BulkAction,QBulkAction,BulkActionDTO,BulkActionData,BulkActionDataParams>
-
process
public BulkActionUserResult process(TransactionStatus tx, BulkActionUser bulkActionUser)
-
processNext
public boolean processNext(Long id)
Description copied from interface:BulkActionServiceLocalProcesses the next user of the bulk action with the given id, returning whether there are more users to process or not. Assumes there is no current transaction, as it will need 1 or 2 transactions to run: one to execute and another one if there's an error- Specified by:
processNextin interfaceBulkActionServiceLocal
-
search
public Page<BulkActionVO> search(BulkActionQuery params) throws FrameworkException
Description copied from interface:BulkActionServiceSearches for already executed bulk actions- Specified by:
searchin interfaceBulkActionService- Throws:
FrameworkException
-
searchUsers
public Page<BulkActionUserVO> searchUsers(BulkActionUserQuery params) throws FrameworkException
Description copied from interface:BulkActionServiceSearches for users affected by a bulk action- Specified by:
searchUsersin interfaceBulkActionService- Throws:
FrameworkException
-
toDTO
public BulkActionDTO toDTO(BulkAction bulkAction)
Description copied from class:CRUDServiceImplConverts the given entity in a DTO, handling theCRUDServiceImpl.subClassMappings()mappings for subclasses- Specified by:
toDTOin interfaceCRUDServiceLocal<BulkAction,BulkActionDTO,BulkActionData,BulkActionDataParams>- Overrides:
toDTOin classCRUDServiceImpl<BulkAction,QBulkAction,BulkActionDTO,BulkActionData,BulkActionDataParams>
-
toEntity
public BulkAction toEntity(BulkActionDTO dto)
Description copied from class:CRUDServiceImplConverts the given DTO in an entity, handling theCRUDServiceImpl.subClassMappings()mappings for subclasses- Specified by:
toEntityin interfaceCRUDServiceLocal<BulkAction,BulkActionDTO,BulkActionData,BulkActionDataParams>- Overrides:
toEntityin classCRUDServiceImpl<BulkAction,QBulkAction,BulkActionDTO,BulkActionData,BulkActionDataParams>
-
getData
protected BulkActionData getData(BulkAction bulkAction)
Description copied from class:CRUDServiceImplReturns details data for the given entity- Specified by:
getDatain classCRUDServiceImpl<BulkAction,QBulkAction,BulkActionDTO,BulkActionData,BulkActionDataParams>
-
getExcludedPropertiesToEntity
protected Object[] getExcludedPropertiesToEntity(BulkActionDTO dto)
Description copied from class:CRUDServiceImplMay be overridden in order to exclude properties when converting the given DTO to entity- Overrides:
getExcludedPropertiesToEntityin classCRUDServiceImpl<BulkAction,QBulkAction,BulkActionDTO,BulkActionData,BulkActionDataParams>
-
onAfterSave
protected void onAfterSave(BulkAction bulkAction, BulkAction currentCopy, Object dataFromOnBeforeSave)
Description copied from class:CRUDServiceImplMay be overridden in order to perform custom logic after saving an entity- Overrides:
onAfterSavein classCRUDServiceImpl<BulkAction,QBulkAction,BulkActionDTO,BulkActionData,BulkActionDataParams>
-
onBeforeSave
protected Object onBeforeSave(BulkAction bulkAction, BulkAction 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<BulkAction,QBulkAction,BulkActionDTO,BulkActionData,BulkActionDataParams>
-
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(BulkActionDTO dto)
- Specified by:
resolveValidatorin classCRUDServiceImpl<BulkAction,QBulkAction,BulkActionDTO,BulkActionData,BulkActionDataParams>
-
subClassMappings
protected org.apache.commons.collections4.BidiMap<Class<? extends BulkAction>,Class<? extends BulkActionDTO>> subClassMappings()
Description copied from class:CRUDServiceImplShould be overridden by subclasses which handle entity / dto hierarchies. The map key should be the entity class, while the map value, the DTO class- Overrides:
subClassMappingsin classCRUDServiceImpl<BulkAction,QBulkAction,BulkActionDTO,BulkActionData,BulkActionDataParams>
-
-