Package org.cyclos.impl.users
Class RecordServiceImpl
- java.lang.Object
-
- org.cyclos.impl.AbstractServerComponent
-
- org.cyclos.impl.AbstractNetworkedServerComponent
-
- org.cyclos.impl.BaseServiceImpl
-
- org.cyclos.impl.CRUDServiceImpl<Record,QRecord,RecordDTO,RecordData,RecordDataParams>
-
- org.cyclos.impl.users.RecordServiceImpl
-
- All Implemented Interfaces:
CRUDServiceLocal<Record,RecordDTO,RecordData,RecordDataParams>,RecordServiceLocal,CRUDService<RecordDTO,RecordData,RecordDataParams>,CRUDWithConfirmationPasswordService<RecordDTO,RecordData,RecordDataParams>,Service,RecordService
@Service public class RecordServiceImpl extends CRUDServiceImpl<Record,QRecord,RecordDTO,RecordData,RecordDataParams> implements RecordServiceLocal
implementation forRecordService
-
-
Field Summary
Fields Modifier and Type Field Description protected CustomOperationServiceLocalcustomOperationService-
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, 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.users.RecordServiceLocal
ATTR_RECORD_TYPE, ATTR_USER
-
-
Constructor Summary
Constructors Constructor Description RecordServiceImpl()
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description booleancanChangeToSingleForm(RecordType recordType)Returns true if the record type can be changed to single form layout.protected voiddoRemove(Record record, boolean flush)May be overridden in order to perform logical removing, instead of physical removing, or to remove some extra relationships as wellFileInfoexportRecords(@NotNull ExportFormatVO formatVO, @NotNull RecordQuery query)Generates a file with the query resultprotected RecordDatagetData(Record record)Returns details data for the given entityintgetRecordsCount(SystemRecordType type)Returns the count for system records of the given typeintgetRecordsCount(UserRecordType type, User user)Returns the count for records of the given type and userList<RecordTypeCountVO>getRecordTypeCount(User user)Returns a list with the visible record types by the logged user of the given userList<RecordTypeCountVO>getRecordTypeCount(InternalAccountOwner owner)Returns, for each visible record type, the count and permissions over records of the given owner (either system or user)RecordSearchDatagetSearchData(RecordTypeVO recordTypeVO, UserLocatorVO locator)Returns data for searching records, if the given locator is null it returns system record dataSharedRecordFieldsSearchDatagetSharedFieldsSearchData()Returns data for searching records with shared record fieldsList<UserRecordType>getSharedSearchableRecordTypes()Returns the record types that has at least one searchable shared record custom fieldSystemRecordgetSingleFormRecord(SystemRecordType rt)Returns the record for this single form system record typeUserRecordgetSingleFormRecord(UserRecordType rt, User user)Returns the record for this single form user record typeList<RecordTypeCountVO>getSystemRecordTypeCount()Returns a list with the visible system record types by the logged userTiledRecordsDatagetTiledRecordsData(RecordTypeVO recordTypeVO, UserLocatorVO locator)Returns data for listing tiled records of a given user or systembooleanhasRecordCustomFieldValue(RecordType type, RecordCustomField field)Returns true if there is at least one record custom field value for the given type and field.
This method accept a shared custom field as parameter.List<SystemRecord>listSystem(SystemRecordType recordType)Lists the system records for the given typeList<UserRecord>listUser(UserRecordType recordType, User user)Lists the user records for the given type and userRecordVOloadVO(Long id)Loads a VO, by idRecordnewEntity(RecordDataParams params)Should be implemented in order to instantiate a new entity based on the given context parametersprotected voidonAfterSave(Record record, Record currentCopy, Object dataFromOnBeforeSave)May be overridden in order to perform custom logic after saving an entityprotected ObjectonBeforeSave(Record record, Record currentCopy)May be overridden in order to perform custom logic before saving an entity.protected voidpreProcessCurrentCopy(RecordDTO dto, Record currentCopy)This method is invoked before saving the entity and also, if the log is enabled, before removing.voidpurgeAll(User user)Removes all user records of the given user whose types are set to remove records when purging usersprotected voidregisterNetworkMappings(NetworkPathRegistry networkPathRegistry)Needs to be overridden by subclasses to register the path up to the networkprotected ExtensionPointAccessorresolveExtensionPointAccessor(CRUDOperation operation, Record record)Should be overridden by subclasses which have extension pointsprotected ValidatorresolveValidator(RecordDTO dto)Page<RecordVO>search(RecordQuery params)Searches for recordsprotected org.apache.commons.collections4.BidiMap<Class<? extends Record>,Class<? extends RecordDTO>>subClassMappings()Should be overridden by subclasses which handle entity / dto hierarchies.RecordDTOtoDTO(Record record)Converts the given entity in a DTO, handling theCRUDServiceImpl.subClassMappings()mappings for subclasses-
Methods inherited from class org.cyclos.impl.CRUDServiceImpl
addCustomInternalNameValidations, addCustomNameValidations, checkConfirmationPassword, find, findAll, from, getConfirmationPasswordInput, getConfirmationPasswordInputForRemove, getData, getDataForNew, getDeviceConfirmationParams, getEntityClass, getEntityInternalNameKey, getExcludedPropertiesToDTO, getExcludedPropertiesToEntity, getNameLabel, getUniqueInternalNameQuery, getUniqueNameQuery, isEntityInternalNameRequired, isNameRequired, load, logEntity, onAfterRemove, onBeforeRemove, remove, remove, removeAll, removeAll, removeAllWithConfirmationPassword, removeWithConfirmationPassword, resolveDTOType, resolveEntityType, save, saveOrder, saveSkippingEntityLog, saveWithConfirmationPassword, shouldCheckConfirmationPassword, 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, toEntity, validate
-
-
-
-
Field Detail
-
customOperationService
@Autowired protected CustomOperationServiceLocal customOperationService
-
-
Method Detail
-
canChangeToSingleForm
public boolean canChangeToSingleForm(RecordType recordType)
Description copied from interface:RecordServiceLocalReturns true if the record type can be changed to single form layout.- Specified by:
canChangeToSingleFormin interfaceRecordServiceLocal
-
exportRecords
public FileInfo exportRecords(@NotNull @NotNull ExportFormatVO formatVO, @NotNull @NotNull RecordQuery query)
Description copied from interface:RecordServiceGenerates a file with the query result- Specified by:
exportRecordsin interfaceRecordService
-
getRecordsCount
public int getRecordsCount(SystemRecordType type)
Description copied from interface:RecordServiceLocalReturns the count for system records of the given type- Specified by:
getRecordsCountin interfaceRecordServiceLocal
-
getRecordsCount
public int getRecordsCount(UserRecordType type, User user)
Description copied from interface:RecordServiceLocalReturns the count for records of the given type and user- Specified by:
getRecordsCountin interfaceRecordServiceLocal
-
getRecordTypeCount
public List<RecordTypeCountVO> getRecordTypeCount(InternalAccountOwner owner) throws FrameworkException
Description copied from interface:RecordServiceReturns, for each visible record type, the count and permissions over records of the given owner (either system or user)- Specified by:
getRecordTypeCountin interfaceRecordService- Throws:
FrameworkException
-
getRecordTypeCount
public List<RecordTypeCountVO> getRecordTypeCount(User user)
Description copied from interface:RecordServiceLocalReturns a list with the visible record types by the logged user of the given user- Specified by:
getRecordTypeCountin interfaceRecordServiceLocal
-
getSearchData
public RecordSearchData getSearchData(RecordTypeVO recordTypeVO, UserLocatorVO locator)
Description copied from interface:RecordServiceReturns data for searching records, if the given locator is null it returns system record data- Specified by:
getSearchDatain interfaceRecordService
-
getSharedFieldsSearchData
public SharedRecordFieldsSearchData getSharedFieldsSearchData()
Description copied from interface:RecordServiceReturns data for searching records with shared record fields- Specified by:
getSharedFieldsSearchDatain interfaceRecordService
-
getSharedSearchableRecordTypes
public List<UserRecordType> getSharedSearchableRecordTypes()
Description copied from interface:RecordServiceLocalReturns the record types that has at least one searchable shared record custom field- Specified by:
getSharedSearchableRecordTypesin interfaceRecordServiceLocal
-
getSingleFormRecord
public SystemRecord getSingleFormRecord(SystemRecordType rt)
Description copied from interface:RecordServiceLocalReturns the record for this single form system record type- Specified by:
getSingleFormRecordin interfaceRecordServiceLocal
-
getSingleFormRecord
public UserRecord getSingleFormRecord(UserRecordType rt, User user)
Description copied from interface:RecordServiceLocalReturns the record for this single form user record type- Specified by:
getSingleFormRecordin interfaceRecordServiceLocal
-
getSystemRecordTypeCount
public List<RecordTypeCountVO> getSystemRecordTypeCount()
Description copied from interface:RecordServiceLocalReturns a list with the visible system record types by the logged user- Specified by:
getSystemRecordTypeCountin interfaceRecordServiceLocal
-
getTiledRecordsData
public TiledRecordsData getTiledRecordsData(RecordTypeVO recordTypeVO, UserLocatorVO locator)
Description copied from interface:RecordServiceReturns data for listing tiled records of a given user or system- Specified by:
getTiledRecordsDatain interfaceRecordService
-
hasRecordCustomFieldValue
public boolean hasRecordCustomFieldValue(RecordType type, RecordCustomField field)
Description copied from interface:RecordServiceLocalReturns true if there is at least one record custom field value for the given type and field.
This method accept a shared custom field as parameter.- Specified by:
hasRecordCustomFieldValuein interfaceRecordServiceLocal
-
listSystem
public List<SystemRecord> listSystem(SystemRecordType recordType)
Description copied from interface:RecordServiceLocalLists the system records for the given type- Specified by:
listSystemin interfaceRecordServiceLocal
-
listUser
public List<UserRecord> listUser(UserRecordType recordType, User user)
Description copied from interface:RecordServiceLocalLists the user records for the given type and user- Specified by:
listUserin interfaceRecordServiceLocal
-
loadVO
public RecordVO loadVO(Long id) throws FrameworkException
Description copied from interface:RecordServiceLoads a VO, by id- Specified by:
loadVOin interfaceRecordService- Throws:
FrameworkException
-
newEntity
public Record newEntity(RecordDataParams 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<Record,RecordDTO,RecordData,RecordDataParams>- Specified by:
newEntityin classCRUDServiceImpl<Record,QRecord,RecordDTO,RecordData,RecordDataParams>
-
purgeAll
public void purgeAll(User user)
Description copied from interface:RecordServiceLocalRemoves all user records of the given user whose types are set to remove records when purging users- Specified by:
purgeAllin interfaceRecordServiceLocal
-
search
public Page<RecordVO> search(RecordQuery params) throws QueryParseException
Description copied from interface:RecordServiceSearches for records- Specified by:
searchin interfaceRecordService- Throws:
QueryParseException
-
toDTO
public RecordDTO toDTO(Record record)
Description copied from class:CRUDServiceImplConverts the given entity in a DTO, handling theCRUDServiceImpl.subClassMappings()mappings for subclasses- Specified by:
toDTOin interfaceCRUDServiceLocal<Record,RecordDTO,RecordData,RecordDataParams>- Overrides:
toDTOin classCRUDServiceImpl<Record,QRecord,RecordDTO,RecordData,RecordDataParams>
-
doRemove
protected void doRemove(Record record, boolean flush)
Description copied from class:CRUDServiceImplMay be overridden in order to perform logical removing, instead of physical removing, or to remove some extra relationships as well- Overrides:
doRemovein classCRUDServiceImpl<Record,QRecord,RecordDTO,RecordData,RecordDataParams>
-
getData
protected RecordData getData(Record record)
Description copied from class:CRUDServiceImplReturns details data for the given entity- Specified by:
getDatain classCRUDServiceImpl<Record,QRecord,RecordDTO,RecordData,RecordDataParams>
-
onAfterSave
protected void onAfterSave(Record record, Record currentCopy, Object dataFromOnBeforeSave)
Description copied from class:CRUDServiceImplMay be overridden in order to perform custom logic after saving an entity- Overrides:
onAfterSavein classCRUDServiceImpl<Record,QRecord,RecordDTO,RecordData,RecordDataParams>
-
onBeforeSave
protected Object onBeforeSave(Record record, Record 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<Record,QRecord,RecordDTO,RecordData,RecordDataParams>
-
preProcessCurrentCopy
protected void preProcessCurrentCopy(RecordDTO dto, Record 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<Record,QRecord,RecordDTO,RecordData,RecordDataParams>
-
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
-
resolveExtensionPointAccessor
protected ExtensionPointAccessor resolveExtensionPointAccessor(CRUDOperation operation, Record record)
Description copied from class:CRUDServiceImplShould be overridden by subclasses which have extension points- Overrides:
resolveExtensionPointAccessorin classCRUDServiceImpl<Record,QRecord,RecordDTO,RecordData,RecordDataParams>
-
resolveValidator
protected Validator resolveValidator(RecordDTO dto)
- Specified by:
resolveValidatorin classCRUDServiceImpl<Record,QRecord,RecordDTO,RecordData,RecordDataParams>
-
subClassMappings
protected org.apache.commons.collections4.BidiMap<Class<? extends Record>,Class<? extends RecordDTO>> 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<Record,QRecord,RecordDTO,RecordData,RecordDataParams>
-
-