Package org.cyclos.impl.users
Class ProductConversionHandlerImpl<P extends Product,DTO extends ProductDTO,AD extends ActiveProductsData>
- java.lang.Object
-
- org.cyclos.impl.AbstractServerComponent
-
- org.cyclos.impl.AbstractNetworkedServerComponent
-
- org.cyclos.impl.BaseNetworkedHandlerImpl
-
- org.cyclos.impl.users.ProductConversionHandlerImpl<P,DTO,AD>
-
- All Implemented Interfaces:
ProductConversionHandler<P,DTO,AD>
- Direct Known Subclasses:
MemberProductConversionHandlerImpl,UserManagementProductConversionHandlerImpl
public abstract class ProductConversionHandlerImpl<P extends Product,DTO extends ProductDTO,AD extends ActiveProductsData> extends BaseNetworkedHandlerImpl implements ProductConversionHandler<P,DTO,AD>
Base implementation forProductConversionHandlerforProducts subclasses
-
-
Field Summary
Fields Modifier and Type Field Description protected ContactCustomFieldServiceLocalcontactCustomFieldServiceprotected PasswordTypeServiceLocalpasswordTypeServiceprotected PrincipalTypeServiceLocalprincipalTypeServiceprotected ProductServiceLocalproductServiceprotected RecordFieldHandlerrecordFieldHandlerprotected RecordTypeServiceLocalrecordTypeServiceprotected TransferStatusFlowServiceLocaltransferStatusFlowServiceprotected UserCustomFieldServiceLocaluserCustomFieldServiceprotected VoucherConfigurationServiceLocalvoucherConfigurationService-
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
-
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description protected voidenssureDTOConsistency(DTO dto)Sublcasses can override this method to enssure a valid DTO BEFORE the permissions are recalculated.voidfill(Collection<Permission> permissions, AD activeData)Fills the active data objectprotected Set<TransferTypeVO>filterChargebackTypes(Collection<TransferTypeVO> transferTypes, Collection<? extends AccountType> accounts)Filters the given transfer types according to the selected system accountsprotected Set<TransferTypeVO>filterPaymentTypes(Collection<TransferTypeVO> transferTypes, TransferTypeDirection direction, Collection<? extends AccountType> fromAccounts)Filters the given transfer types according to the selected system accountsClass<AD>getActiveDataType()Returns the active data type handled by this objectStringgetAdditionalCollectionForPermission(Permission permission)Returns the additional collection mapping for the given permission, or null if noneProperty<?,?>getDtoCollectionProperty(Permission permission)Returns the DTO property which represents the related value collection for the given property, if any, or null if not applicableClass<DTO>getDTOType()Returns the product DTO type handled by this objectClass<P>getEntityType()Returns the product entity type handled by this objectList<PermissionHandlerImpl<DTO,AD>>getPermissionHandlers()Returns all registered permission handlers.Collection<Permission>getPermissionsForProperty(Property<?,?> dtoProperty)Returns the known permissions for a given DTO propertyStringgetProductPropertyForDtoProperty(Property<?,?> dtoProperty)Returns the product property which corresponds to the given DTO propertyprotected booleanhasPasswordActions(Set<? extends ProductPasswordActionDTO> actions)Returns true if there is at least one action checked in password actionsvoidregister(PermissionHandlerImpl<DTO,AD> handler)Registers aPermissionHandlerImplprotected voidregisterAdditionalCollectionMapping(Permission permission, com.querydsl.core.types.Path<?> entityProperty)Registers an additional collection mapping, that is, the given permission is revoked if the expected collection is emptyprotected voidregisterCommonMemberOrBroker()voidregisterHandlers()protected voidregisterPropertyMapping(Property<?,?> dtoProperty, com.querydsl.core.types.Path<?> entityProperty)Registers a custom mapping between a DTO property and a product propertyDTOtoDTO(P product)Converts the given entity into DTOPtoEntity(DTO dto)Converts the given DTO to entity-
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.impl.users.ProductConversionHandler
getProductNature, getRole
-
-
-
-
Field Detail
-
productService
@Autowired protected ProductServiceLocal productService
-
userCustomFieldService
@Autowired protected UserCustomFieldServiceLocal userCustomFieldService
-
recordFieldHandler
@Autowired protected RecordFieldHandler recordFieldHandler
-
passwordTypeService
@Autowired protected PasswordTypeServiceLocal passwordTypeService
-
transferStatusFlowService
@Autowired protected TransferStatusFlowServiceLocal transferStatusFlowService
-
recordTypeService
@Autowired protected RecordTypeServiceLocal recordTypeService
-
principalTypeService
@Autowired protected PrincipalTypeServiceLocal principalTypeService
-
contactCustomFieldService
@Autowired protected ContactCustomFieldServiceLocal contactCustomFieldService
-
voucherConfigurationService
@Autowired protected VoucherConfigurationServiceLocal voucherConfigurationService
-
-
Method Detail
-
fill
public void fill(Collection<Permission> permissions, AD activeData)
Description copied from interface:ProductConversionHandlerFills the active data object- Specified by:
fillin interfaceProductConversionHandler<P extends Product,DTO extends ProductDTO,AD extends ActiveProductsData>
-
getActiveDataType
public Class<AD> getActiveDataType()
Description copied from interface:ProductConversionHandlerReturns the active data type handled by this object- Specified by:
getActiveDataTypein interfaceProductConversionHandler<P extends Product,DTO extends ProductDTO,AD extends ActiveProductsData>
-
getAdditionalCollectionForPermission
public String getAdditionalCollectionForPermission(Permission permission)
Description copied from interface:ProductConversionHandlerReturns the additional collection mapping for the given permission, or null if none- Specified by:
getAdditionalCollectionForPermissionin interfaceProductConversionHandler<P extends Product,DTO extends ProductDTO,AD extends ActiveProductsData>
-
getDtoCollectionProperty
public Property<?,?> getDtoCollectionProperty(Permission permission)
Description copied from interface:ProductConversionHandlerReturns the DTO property which represents the related value collection for the given property, if any, or null if not applicable- Specified by:
getDtoCollectionPropertyin interfaceProductConversionHandler<P extends Product,DTO extends ProductDTO,AD extends ActiveProductsData>
-
getDTOType
public Class<DTO> getDTOType()
Description copied from interface:ProductConversionHandlerReturns the product DTO type handled by this object- Specified by:
getDTOTypein interfaceProductConversionHandler<P extends Product,DTO extends ProductDTO,AD extends ActiveProductsData>
-
getEntityType
public Class<P> getEntityType()
Description copied from interface:ProductConversionHandlerReturns the product entity type handled by this object- Specified by:
getEntityTypein interfaceProductConversionHandler<P extends Product,DTO extends ProductDTO,AD extends ActiveProductsData>
-
getPermissionHandlers
public List<PermissionHandlerImpl<DTO,AD>> getPermissionHandlers()
Description copied from interface:ProductConversionHandlerReturns all registered permission handlers.- Specified by:
getPermissionHandlersin interfaceProductConversionHandler<P extends Product,DTO extends ProductDTO,AD extends ActiveProductsData>
-
getPermissionsForProperty
public Collection<Permission> getPermissionsForProperty(Property<?,?> dtoProperty)
Description copied from interface:ProductConversionHandlerReturns the known permissions for a given DTO property- Specified by:
getPermissionsForPropertyin interfaceProductConversionHandler<P extends Product,DTO extends ProductDTO,AD extends ActiveProductsData>
-
getProductPropertyForDtoProperty
public String getProductPropertyForDtoProperty(Property<?,?> dtoProperty)
Description copied from interface:ProductConversionHandlerReturns the product property which corresponds to the given DTO property- Specified by:
getProductPropertyForDtoPropertyin interfaceProductConversionHandler<P extends Product,DTO extends ProductDTO,AD extends ActiveProductsData>
-
register
public void register(PermissionHandlerImpl<DTO,AD> handler)
Registers aPermissionHandlerImpl
-
registerHandlers
@PostConstruct public void registerHandlers()
-
toDTO
public DTO toDTO(P product)
Description copied from interface:ProductConversionHandlerConverts the given entity into DTO- Specified by:
toDTOin interfaceProductConversionHandler<P extends Product,DTO extends ProductDTO,AD extends ActiveProductsData>
-
toEntity
public P toEntity(DTO dto)
Description copied from interface:ProductConversionHandlerConverts the given DTO to entity- Specified by:
toEntityin interfaceProductConversionHandler<P extends Product,DTO extends ProductDTO,AD extends ActiveProductsData>
-
enssureDTOConsistency
protected void enssureDTOConsistency(DTO dto)
Sublcasses can override this method to enssure a valid DTO BEFORE the permissions are recalculated. Alternatively the methodCRUDServiceImpl#onBeforeSave()could be used to fix possible inconsistencies if the resultant permissions are not affected.
-
filterChargebackTypes
protected Set<TransferTypeVO> filterChargebackTypes(Collection<TransferTypeVO> transferTypes, Collection<? extends AccountType> accounts)
Filters the given transfer types according to the selected system accounts
-
filterPaymentTypes
protected Set<TransferTypeVO> filterPaymentTypes(Collection<TransferTypeVO> transferTypes, TransferTypeDirection direction, Collection<? extends AccountType> fromAccounts)
Filters the given transfer types according to the selected system accounts
-
hasPasswordActions
protected boolean hasPasswordActions(Set<? extends ProductPasswordActionDTO> actions)
Returns true if there is at least one action checked in password actions
-
registerAdditionalCollectionMapping
protected void registerAdditionalCollectionMapping(Permission permission, com.querydsl.core.types.Path<?> entityProperty)
Registers an additional collection mapping, that is, the given permission is revoked if the expected collection is empty
-
registerCommonMemberOrBroker
protected void registerCommonMemberOrBroker()
-
registerPropertyMapping
protected void registerPropertyMapping(Property<?,?> dtoProperty, com.querydsl.core.types.Path<?> entityProperty)
Registers a custom mapping between a DTO property and a product property
-
-