Package org.cyclos.impl.users
Class ContactServiceImpl
- java.lang.Object
-
- org.cyclos.impl.AbstractServerComponent
-
- org.cyclos.impl.AbstractNetworkedServerComponent
-
- org.cyclos.impl.BaseServiceImpl
-
- org.cyclos.impl.CRUDServiceImpl<Contact,QContact,ContactDTO,ContactData,ContactDataParams>
-
- org.cyclos.impl.users.ContactServiceImpl
-
- All Implemented Interfaces:
CRUDServiceLocal<Contact,ContactDTO,ContactData,ContactDataParams>,ContactServiceLocal,CRUDService<ContactDTO,ContactData,ContactDataParams>,CRUDWithConfirmationPasswordService<ContactDTO,ContactData,ContactDataParams>,Service,ContactService
@Service public class ContactServiceImpl extends CRUDServiceImpl<Contact,QContact,ContactDTO,ContactData,ContactDataParams> implements ContactServiceLocal
Implementation forContactService
-
-
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
-
Fields inherited from interface org.cyclos.impl.users.ContactServiceLocal
ATTR_OWNER
-
-
Constructor Summary
Constructors Constructor Description ContactServiceImpl()
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description booleancanAddToContacts(BasicUser owner, BasicUser contact)Returns true if the given owner can add the given user as contact.protected voiddoRemove(Contact contact, boolean flush)May be overridden in order to perform logical removing, instead of physical removing, or to remove some extra relationships as wellContactgetByOwnerAndContact(User owner, User contact)Returns the contact for the given owner and contact users, returning null if not a contactprotected ContactDatagetData(Contact contact)Returns details data for the given entityprotected Object[]getExcludedPropertiesToDTO(Contact entity)May be overridden in order to exclude properties when converting the given entity to DTOprotected Object[]getExcludedPropertiesToEntity(ContactDTO dto)May be overridden in order to exclude properties when converting the given DTO to entityContactSearchDatagetSearchData(UserLocatorVO ownerVO)Returns data for searching contacts of the given owner.booleanisContact(User owner, User contact)Returns whether the given user is a contact of the given userContactnewEntity(ContactDataParams params)Should be implemented in order to instantiate a new entity based on the given context parametersprotected voidonAfterSave(Contact contact, Contact currentCopy, Object dataFromOnBeforeSave)May be overridden in order to perform custom logic after saving an entityprotected ObjectonBeforeSave(Contact contact, Contact currentCopy)May be overridden in order to perform custom logic before saving an entity.protected voidpersist(IEntity entity)protected voidregisterNetworkMappings(NetworkPathRegistry networkPathRegistry)Needs to be overridden by subclasses to register the path up to the networkvoidremoveAll(User user)Removes all contacts where the given user is either the owner or the contactprotected ValidatorresolveValidator(ContactDTO dto)Page<ContactVO>search(ContactQuery params)Searches the contacts according to the given query.ContactDTOtoDTO(Contact contact)Converts the given entity in a DTO, handling theCRUDServiceImpl.subClassMappings()mappings for subclassesContacttoEntity(ContactDTO 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, find, findAll, from, getConfirmationPasswordInput, getConfirmationPasswordInputForRemove, getData, getDataForNew, getDeviceConfirmationParams, getEntityClass, getEntityInternalNameKey, getNameLabel, getUniqueInternalNameQuery, getUniqueNameQuery, isEntityInternalNameRequired, isNameRequired, load, logEntity, onAfterRemove, onBeforeRemove, preProcessCurrentCopy, remove, remove, removeAll, removeAll, removeAllWithConfirmationPassword, removeWithConfirmationPassword, resolveDTOType, resolveEntityType, resolveExtensionPointAccessor, save, saveOrder, saveSkippingEntityLog, saveWithConfirmationPassword, shouldCheckConfirmationPassword, subClassMappings, 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, 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
-
canAddToContacts
public boolean canAddToContacts(BasicUser owner, BasicUser contact) throws FrameworkException
Description copied from interface:ContactServiceLocalReturns true if the given owner can add the given user as contact. If either is null or operator, returns false- Specified by:
canAddToContactsin interfaceContactServiceLocal- Throws:
FrameworkException
-
getByOwnerAndContact
public Contact getByOwnerAndContact(User owner, User contact)
Description copied from interface:ContactServiceLocalReturns the contact for the given owner and contact users, returning null if not a contact- Specified by:
getByOwnerAndContactin interfaceContactServiceLocal
-
getSearchData
public ContactSearchData getSearchData(UserLocatorVO ownerVO) throws FrameworkException
Description copied from interface:ContactServiceReturns data for searching contacts of the given owner. If no owner is given, it is assumed the logged user.- Specified by:
getSearchDatain interfaceContactService- Throws:
FrameworkException
-
isContact
public boolean isContact(User owner, User contact)
Description copied from interface:ContactServiceLocalReturns whether the given user is a contact of the given user- Specified by:
isContactin interfaceContactServiceLocal
-
newEntity
public Contact newEntity(ContactDataParams 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<Contact,ContactDTO,ContactData,ContactDataParams>- Specified by:
newEntityin classCRUDServiceImpl<Contact,QContact,ContactDTO,ContactData,ContactDataParams>
-
removeAll
public void removeAll(User user)
Description copied from interface:ContactServiceLocalRemoves all contacts where the given user is either the owner or the contact- Specified by:
removeAllin interfaceContactServiceLocal
-
search
public Page<ContactVO> search(ContactQuery params) throws FrameworkException
Description copied from interface:ContactServiceSearches the contacts according to the given query. If the query has no owner it is assumed the logged user.- Specified by:
searchin interfaceContactService- Throws:
FrameworkException
-
toDTO
public ContactDTO toDTO(Contact contact)
Description copied from class:CRUDServiceImplConverts the given entity in a DTO, handling theCRUDServiceImpl.subClassMappings()mappings for subclasses- Specified by:
toDTOin interfaceCRUDServiceLocal<Contact,ContactDTO,ContactData,ContactDataParams>- Overrides:
toDTOin classCRUDServiceImpl<Contact,QContact,ContactDTO,ContactData,ContactDataParams>
-
toEntity
public Contact toEntity(ContactDTO dto)
Description copied from class:CRUDServiceImplConverts the given DTO in an entity, handling theCRUDServiceImpl.subClassMappings()mappings for subclasses- Specified by:
toEntityin interfaceCRUDServiceLocal<Contact,ContactDTO,ContactData,ContactDataParams>- Overrides:
toEntityin classCRUDServiceImpl<Contact,QContact,ContactDTO,ContactData,ContactDataParams>
-
doRemove
protected void doRemove(Contact contact, 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<Contact,QContact,ContactDTO,ContactData,ContactDataParams>
-
getData
protected ContactData getData(Contact contact)
Description copied from class:CRUDServiceImplReturns details data for the given entity- Specified by:
getDatain classCRUDServiceImpl<Contact,QContact,ContactDTO,ContactData,ContactDataParams>
-
getExcludedPropertiesToDTO
protected Object[] getExcludedPropertiesToDTO(Contact entity)
Description copied from class:CRUDServiceImplMay be overridden in order to exclude properties when converting the given entity to DTO- Overrides:
getExcludedPropertiesToDTOin classCRUDServiceImpl<Contact,QContact,ContactDTO,ContactData,ContactDataParams>
-
getExcludedPropertiesToEntity
protected Object[] getExcludedPropertiesToEntity(ContactDTO dto)
Description copied from class:CRUDServiceImplMay be overridden in order to exclude properties when converting the given DTO to entity- Overrides:
getExcludedPropertiesToEntityin classCRUDServiceImpl<Contact,QContact,ContactDTO,ContactData,ContactDataParams>
-
onAfterSave
protected void onAfterSave(Contact contact, Contact currentCopy, Object dataFromOnBeforeSave)
Description copied from class:CRUDServiceImplMay be overridden in order to perform custom logic after saving an entity- Overrides:
onAfterSavein classCRUDServiceImpl<Contact,QContact,ContactDTO,ContactData,ContactDataParams>
-
onBeforeSave
protected Object onBeforeSave(Contact contact, Contact 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<Contact,QContact,ContactDTO,ContactData,ContactDataParams>
-
persist
protected void persist(IEntity entity)
- Overrides:
persistin classAbstractServerComponent- See Also:
BaseEntityManagerHandler.persist(IEntity)
-
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(ContactDTO dto)
- Specified by:
resolveValidatorin classCRUDServiceImpl<Contact,QContact,ContactDTO,ContactData,ContactDataParams>
-
-