Package org.cyclos.impl.access
Class PrincipalTypeServiceImpl
- java.lang.Object
-
- org.cyclos.impl.AbstractServerComponent
-
- org.cyclos.impl.AbstractNetworkedServerComponent
-
- org.cyclos.impl.BaseServiceImpl
-
- org.cyclos.impl.CRUDServiceImpl<PrincipalType,QPrincipalType,PrincipalTypeDTO,PrincipalTypeData,PrincipalTypeNature>
-
- org.cyclos.impl.access.PrincipalTypeServiceImpl
-
- All Implemented Interfaces:
PrincipalTypeServiceLocal,CRUDServiceLocal<PrincipalType,PrincipalTypeDTO,PrincipalTypeData,PrincipalTypeNature>,PrincipalTypeService,CRUDService<PrincipalTypeDTO,PrincipalTypeData,PrincipalTypeNature>,CRUDWithConfirmationPasswordService<PrincipalTypeDTO,PrincipalTypeData,PrincipalTypeNature>,Service
@Service public class PrincipalTypeServiceImpl extends CRUDServiceImpl<PrincipalType,QPrincipalType,PrincipalTypeDTO,PrincipalTypeData,PrincipalTypeNature> implements PrincipalTypeServiceLocal
Implementation forPrincipalTypeService
-
-
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, 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 PrincipalTypeServiceImpl()
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description protected voidaddCustomInternalNameValidations(Property internalName, PrincipalTypeDTO dto)This method may be overridden to add custom validations for the INTERNAL_NAME property.PrincipalTypefind(String internalName, Network network)Finds a principal by internal name in the specified networkBuiltInPrincipalTypegetAccountNumber()Returns the account number principal typeCustomFieldPrincipalTypegetCustomField(UserCustomField field)Returns the principal type for the given custom fieldprotected PrincipalTypeDatagetData(PrincipalType principalType)Returns details data for the given entityBuiltInPrincipalTypegetEmail()Returns the e-mail principal typeBuiltInPrincipalTypegetMobilePhone()Returns the mobilePhone principal typebyte[]getPiccMasterKey(NFCTokenPrincipalType nfcTokenPrincipalType)Returns the encryption key set for the givenNFCTokenPrincipalType.BuiltInPrincipalTypegetTrustedDevice()Returns the trustedDevice principal typeBuiltInPrincipalTypegetUsername()Returns the username principal typevoidinitialize()Validated the NFC token type keyList<PrincipalTypeVO>list()List all available principal typesList<AccessClientPrincipalType>listAccessClients()Returns a list with all access clientsList<PrincipalType>listAll()Returns all principal typesList<PrincipalType>listByNatures(PrincipalTypeNature... natures)List the principal types filtering by principal type naturesList<TokenPrincipalType>listByType(TokenType type)List the token principal types filtering by token typeList<PrincipalType>listForConfiguration(ConfigurationAccessor configuration, Channel channel, PrincipalTypeContext context)Returns the principal types which can be used on channel configurations under the given channel and contextList<PrincipalType>listForLogin()Returns the principal types which can be used for loginList<PrincipalType>listForLogin(ChannelConfiguration channelConfiguration)Returns the principal types which can be used for login in the given channel configurationList<TokenPrincipalType>listTokens()List<TokenPermissionsVO>listUserTokenPermissions(BasicUser user)Returns the permissions over tokens for the given user.List<TokenPermissionsVO>listUserTokenPermissions(UserGroup group, boolean asMember)Returns the permissions over tokens on a user registration.List<TokenPermissionsVO>listUserTokenPermissions(UserLocatorVO user)Returns the permissions over tokens for the given user.List<AccessClientPrincipalType>listVisibleAccessClients(User user)Returns the access client types the logged user can see over the given userPrincipalTypeload(String internalName)Loads a principal type by internal namePrincipalTypenewEntity(PrincipalTypeNature nature)Should be implemented in order to instantiate a new entity based on the given context parametersprotected voidonAfterSave(PrincipalType entity, PrincipalType currentCopy, Object dataFromOnBeforeSave)May be overridden in order to perform custom logic after saving an entityprotected ObjectonBeforeSave(PrincipalType entity, PrincipalType currentCopy)May be overridden in order to perform custom logic before saving an entity.protected voidregisterNetworkMappings(NetworkPathRegistry networkPathRegistry)Needs to be overridden by subclasses to register the path up to the networkprotected Class<? extends PrincipalTypeDTO>resolveDTOType(PrincipalType entity)Uses theCRUDServiceImpl.subClassMappings()mappings to find a suitable class for anEntityDTOfor the given entity.protected Class<? extends PrincipalType>resolveEntityType(PrincipalTypeDTO dto)Uses theCRUDServiceImpl.subClassMappings()mappings, find a suitable class for anBaseEntityaccording to the given dto.protected ValidatorresolveValidator(PrincipalTypeDTO dto)voidsort(List<PrincipalType> principalTypes)Sorts the given list of principal types according to the search orderprotected org.apache.commons.collections4.BidiMap<Class<? extends PrincipalType>,Class<? extends PrincipalTypeDTO>>subClassMappings()Should be overridden by subclasses which handle entity / dto hierarchies.-
Methods inherited from class org.cyclos.impl.CRUDServiceImpl
addCustomNameValidations, checkConfirmationPassword, doRemove, find, findAll, from, getConfirmationPasswordInput, getConfirmationPasswordInputForRemove, getData, getDataForNew, getDeviceConfirmationParams, getEntityClass, getEntityInternalNameKey, getExcludedPropertiesToDTO, getExcludedPropertiesToEntity, getNameLabel, getUniqueInternalNameQuery, getUniqueNameQuery, isEntityInternalNameRequired, isNameRequired, load, logEntity, onAfterRemove, onBeforeRemove, preProcessCurrentCopy, remove, remove, removeAll, removeAll, removeAllWithConfirmationPassword, removeWithConfirmationPassword, resolveExtensionPointAccessor, save, saveOrder, saveSkippingEntityLog, saveWithConfirmationPassword, shouldCheckConfirmationPassword, 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
-
-
-
-
Method Detail
-
find
public PrincipalType find(String internalName, Network network)
Description copied from interface:PrincipalTypeServiceLocalFinds a principal by internal name in the specified network- Specified by:
findin interfacePrincipalTypeServiceLocal
-
getAccountNumber
public BuiltInPrincipalType getAccountNumber() throws FrameworkException
Description copied from interface:PrincipalTypeServiceLocalReturns the account number principal type- Specified by:
getAccountNumberin interfacePrincipalTypeServiceLocal- Throws:
FrameworkException
-
getCustomField
public CustomFieldPrincipalType getCustomField(UserCustomField field) throws FrameworkException
Description copied from interface:PrincipalTypeServiceLocalReturns the principal type for the given custom field- Specified by:
getCustomFieldin interfacePrincipalTypeServiceLocal- Throws:
FrameworkException
-
getEmail
public BuiltInPrincipalType getEmail() throws FrameworkException
Description copied from interface:PrincipalTypeServiceLocalReturns the e-mail principal type- Specified by:
getEmailin interfacePrincipalTypeServiceLocal- Throws:
FrameworkException
-
getMobilePhone
public BuiltInPrincipalType getMobilePhone() throws FrameworkException
Description copied from interface:PrincipalTypeServiceLocalReturns the mobilePhone principal type- Specified by:
getMobilePhonein interfacePrincipalTypeServiceLocal- Throws:
FrameworkException
-
getPiccMasterKey
public byte[] getPiccMasterKey(NFCTokenPrincipalType nfcTokenPrincipalType)
Description copied from interface:PrincipalTypeServiceLocalReturns the encryption key set for the givenNFCTokenPrincipalType. This plain key will be sent atNFCToken's initialization.- Specified by:
getPiccMasterKeyin interfacePrincipalTypeServiceLocal- See Also:
TokenService.initializeNFCTag(org.cyclos.model.access.tokens.NFCTagInitializeDTO)
-
getTrustedDevice
public BuiltInPrincipalType getTrustedDevice() throws FrameworkException
Description copied from interface:PrincipalTypeServiceLocalReturns the trustedDevice principal type- Specified by:
getTrustedDevicein interfacePrincipalTypeServiceLocal- Throws:
FrameworkException
-
getUsername
public BuiltInPrincipalType getUsername() throws FrameworkException
Description copied from interface:PrincipalTypeServiceLocalReturns the username principal type- Specified by:
getUsernamein interfacePrincipalTypeServiceLocal- Throws:
FrameworkException
-
initialize
@PostConstruct public void initialize()
Validated the NFC token type key
-
list
public List<PrincipalTypeVO> list() throws FrameworkException
Description copied from interface:PrincipalTypeServiceList all available principal types- Specified by:
listin interfacePrincipalTypeService- Throws:
FrameworkException
-
listAccessClients
public List<AccessClientPrincipalType> listAccessClients()
Description copied from interface:PrincipalTypeServiceLocalReturns a list with all access clients- Specified by:
listAccessClientsin interfacePrincipalTypeServiceLocal
-
listAll
public List<PrincipalType> listAll() throws FrameworkException
Description copied from interface:PrincipalTypeServiceLocalReturns all principal types- Specified by:
listAllin interfacePrincipalTypeServiceLocal- Throws:
FrameworkException
-
listByNatures
public List<PrincipalType> listByNatures(PrincipalTypeNature... natures)
Description copied from interface:PrincipalTypeServiceLocalList the principal types filtering by principal type natures- Specified by:
listByNaturesin interfacePrincipalTypeServiceLocal
-
listByType
public List<TokenPrincipalType> listByType(TokenType type)
Description copied from interface:PrincipalTypeServiceLocalList the token principal types filtering by token type- Specified by:
listByTypein interfacePrincipalTypeServiceLocal
-
listForConfiguration
public List<PrincipalType> listForConfiguration(ConfigurationAccessor configuration, Channel channel, PrincipalTypeContext context) throws FrameworkException
Description copied from interface:PrincipalTypeServiceLocalReturns the principal types which can be used on channel configurations under the given channel and context- Specified by:
listForConfigurationin interfacePrincipalTypeServiceLocal- Throws:
FrameworkException
-
listForLogin
public List<PrincipalType> listForLogin()
Description copied from interface:PrincipalTypeServiceLocalReturns the principal types which can be used for login- Specified by:
listForLoginin interfacePrincipalTypeServiceLocal
-
listForLogin
public List<PrincipalType> listForLogin(ChannelConfiguration channelConfiguration)
Description copied from interface:PrincipalTypeServiceLocalReturns the principal types which can be used for login in the given channel configuration- Specified by:
listForLoginin interfacePrincipalTypeServiceLocal
-
listTokens
public List<TokenPrincipalType> listTokens()
-
listUserTokenPermissions
public List<TokenPermissionsVO> listUserTokenPermissions(BasicUser user)
Description copied from interface:PrincipalTypeServiceLocalReturns the permissions over tokens for the given user. If the user is null, returns permissions over other managed users.- Specified by:
listUserTokenPermissionsin interfacePrincipalTypeServiceLocal
-
listUserTokenPermissions
public List<TokenPermissionsVO> listUserTokenPermissions(UserGroup group, boolean asMember)
Description copied from interface:PrincipalTypeServiceLocalReturns the permissions over tokens on a user registration. If the group is null, don't filter by enabled token types for that group.- Specified by:
listUserTokenPermissionsin interfacePrincipalTypeServiceLocal
-
listUserTokenPermissions
public List<TokenPermissionsVO> listUserTokenPermissions(UserLocatorVO user) throws FrameworkException
Description copied from interface:PrincipalTypeServiceReturns the permissions over tokens for the given user. If the user is null, returns permissions over other managed users.- Specified by:
listUserTokenPermissionsin interfacePrincipalTypeService- Throws:
FrameworkException
-
listVisibleAccessClients
public List<AccessClientPrincipalType> listVisibleAccessClients(User user) throws FrameworkException
Description copied from interface:PrincipalTypeServiceLocalReturns the access client types the logged user can see over the given user- Specified by:
listVisibleAccessClientsin interfacePrincipalTypeServiceLocal- Throws:
FrameworkException
-
load
public PrincipalType load(String internalName) throws FrameworkException
Description copied from interface:PrincipalTypeServiceLocalLoads a principal type by internal name- Specified by:
loadin interfacePrincipalTypeServiceLocal- Throws:
FrameworkException
-
newEntity
public PrincipalType newEntity(PrincipalTypeNature nature)
Description copied from class:CRUDServiceImplShould be implemented in order to instantiate a new entity based on the given context parameters- Specified by:
newEntityin interfaceCRUDServiceLocal<PrincipalType,PrincipalTypeDTO,PrincipalTypeData,PrincipalTypeNature>- Specified by:
newEntityin classCRUDServiceImpl<PrincipalType,QPrincipalType,PrincipalTypeDTO,PrincipalTypeData,PrincipalTypeNature>
-
sort
public void sort(List<PrincipalType> principalTypes)
Description copied from interface:PrincipalTypeServiceLocalSorts the given list of principal types according to the search order- Specified by:
sortin interfacePrincipalTypeServiceLocal
-
addCustomInternalNameValidations
protected void addCustomInternalNameValidations(Property internalName, PrincipalTypeDTO dto)
Description copied from class:CRUDServiceImplThis method may be overridden to add custom validations for the INTERNAL_NAME property.
-
getData
protected PrincipalTypeData getData(PrincipalType principalType)
Description copied from class:CRUDServiceImplReturns details data for the given entity- Specified by:
getDatain classCRUDServiceImpl<PrincipalType,QPrincipalType,PrincipalTypeDTO,PrincipalTypeData,PrincipalTypeNature>
-
onAfterSave
protected void onAfterSave(PrincipalType entity, PrincipalType currentCopy, Object dataFromOnBeforeSave)
Description copied from class:CRUDServiceImplMay be overridden in order to perform custom logic after saving an entity- Overrides:
onAfterSavein classCRUDServiceImpl<PrincipalType,QPrincipalType,PrincipalTypeDTO,PrincipalTypeData,PrincipalTypeNature>
-
onBeforeSave
protected Object onBeforeSave(PrincipalType entity, PrincipalType 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<PrincipalType,QPrincipalType,PrincipalTypeDTO,PrincipalTypeData,PrincipalTypeNature>
-
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
-
resolveDTOType
protected Class<? extends PrincipalTypeDTO> resolveDTOType(PrincipalType entity)
Description copied from class:CRUDServiceImplUses theCRUDServiceImpl.subClassMappings()mappings to find a suitable class for anEntityDTOfor the given entity. When not found defaults toCRUDServiceImpl.dtoClass.- Overrides:
resolveDTOTypein classCRUDServiceImpl<PrincipalType,QPrincipalType,PrincipalTypeDTO,PrincipalTypeData,PrincipalTypeNature>
-
resolveEntityType
protected Class<? extends PrincipalType> resolveEntityType(PrincipalTypeDTO dto)
Description copied from class:CRUDServiceImplUses theCRUDServiceImpl.subClassMappings()mappings, find a suitable class for anBaseEntityaccording to the given dto. When not found defaults toCRUDServiceImpl.entityClass- Overrides:
resolveEntityTypein classCRUDServiceImpl<PrincipalType,QPrincipalType,PrincipalTypeDTO,PrincipalTypeData,PrincipalTypeNature>
-
resolveValidator
protected Validator resolveValidator(PrincipalTypeDTO dto)
- Specified by:
resolveValidatorin classCRUDServiceImpl<PrincipalType,QPrincipalType,PrincipalTypeDTO,PrincipalTypeData,PrincipalTypeNature>
-
subClassMappings
protected org.apache.commons.collections4.BidiMap<Class<? extends PrincipalType>,Class<? extends PrincipalTypeDTO>> 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<PrincipalType,QPrincipalType,PrincipalTypeDTO,PrincipalTypeData,PrincipalTypeNature>
-
-