Package org.cyclos.impl.system
Class NetworkServiceImpl
- java.lang.Object
-
- org.cyclos.impl.AbstractServerComponent
-
- org.cyclos.impl.AbstractNetworkedServerComponent
-
- org.cyclos.impl.BaseServiceImpl
-
- org.cyclos.impl.CRUDServiceImpl<Network,QNetwork,NetworkDTO,NetworkData,Void>
-
- org.cyclos.impl.system.NetworkServiceImpl
-
- All Implemented Interfaces:
CRUDServiceLocal<Network,NetworkDTO,NetworkData,Void>,NetworkServiceLocal,CRUDService<NetworkDTO,NetworkData,Void>,CRUDWithConfirmationPasswordService<NetworkDTO,NetworkData,Void>,Service,NetworkService
@Service public class NetworkServiceImpl extends CRUDServiceImpl<Network,QNetwork,NetworkDTO,NetworkData,Void> implements NetworkServiceLocal
Implementation forNetworkService
-
-
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
-
Fields inherited from interface org.cyclos.services.system.NetworkService
GLOBAL_INTERNAL_NAME
-
-
Constructor Summary
Constructors Constructor Description NetworkServiceImpl()
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description protected voidaddCustomInternalNameValidations(Property internalName, NetworkDTO dto)This method may be overridden to add custom validations for the INTERNAL_NAME property.LongcreateWithData(NetworkDTO dto, NetworkInitialDataDTO data)Creates a new network with initial dataNetworkfindEnabled(NetworkVO networkVO)Finds an enabled network, or throwsEntityNotFoundExceptionif none is foundprotected NetworkDatagetData(Network network)Returns details data for the given entityNetworkWithInitialDataDatagetDataForNewWithData()Returns data for creating a new network with initial dataNetworkgetDefault()Returns the default network if any (and is enabled).NetworkInitialDataDTOgetInitialData(BasicNetworkInitialDataDTO basicData)Returns an initial data pre-populated with fields according to the given initial selectionsList<NetworkVO>getManagedNetworks()Returns the managed networks for the current adminNetworkSearchDatagetSearchData()Returns data for searching networksprotected booleanisEntityInternalNameRequired()NOTE: This method will be only invoked if the entity is anIInternalNamedEntity.NetworknewEntity(Void params)Should be implemented in order to instantiate a new entity based on the given context parametersprotected voidonAfterRemove(Network network)May be overridden in order to perform custom logic after removing an entityprotected voidonAfterSave(Network network, Network currentCopy, Object dataFromOnBeforeSave)May be overridden in order to perform custom logic after saving an entityprotected ObjectonBeforeSave(Network network, Network 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 networkStringresolveNetworkUrl(NetworkVO networkVO)Returns the URL a global admin can use to access the given networkprotected ValidatorresolveValidator(NetworkDTO dto)Page<NetworkVO>search(NetworkQuery params)Searches for networks according to the given criteriaNetworkDTOtoDTO(Network entity)Converts the given entity in a DTO, handling theCRUDServiceImpl.subClassMappings()mappings for subclasses-
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, isNameRequired, load, logEntity, onBeforeRemove, preProcessCurrentCopy, remove, remove, removeAll, removeAll, removeAllWithConfirmationPassword, removeWithConfirmationPassword, resolveDTOType, resolveEntityType, resolveExtensionPointAccessor, save, saveOrder, saveSkippingEntityLog, saveWithConfirmationPassword, shouldCheckConfirmationPassword, subClassMappings, 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
-
-
-
-
Method Detail
-
createWithData
public Long createWithData(NetworkDTO dto, NetworkInitialDataDTO data) throws FrameworkException
Description copied from interface:NetworkServiceCreates a new network with initial data- Specified by:
createWithDatain interfaceNetworkService- Throws:
FrameworkException
-
findEnabled
public Network findEnabled(NetworkVO networkVO) throws FrameworkException
Description copied from interface:NetworkServiceLocalFinds an enabled network, or throwsEntityNotFoundExceptionif none is found- Specified by:
findEnabledin interfaceNetworkServiceLocal- Throws:
FrameworkException
-
getDataForNewWithData
public NetworkWithInitialDataData getDataForNewWithData() throws FrameworkException
Description copied from interface:NetworkServiceReturns data for creating a new network with initial data- Specified by:
getDataForNewWithDatain interfaceNetworkService- Throws:
FrameworkException
-
getDefault
public Network getDefault()
Description copied from interface:NetworkServiceLocalReturns the default network if any (and is enabled). Otherwise, returns null.- Specified by:
getDefaultin interfaceNetworkServiceLocal
-
getInitialData
public NetworkInitialDataDTO getInitialData(BasicNetworkInitialDataDTO basicData) throws FrameworkException
Description copied from interface:NetworkServiceReturns an initial data pre-populated with fields according to the given initial selections- Specified by:
getInitialDatain interfaceNetworkService- Throws:
FrameworkException
-
getManagedNetworks
public List<NetworkVO> getManagedNetworks() throws FrameworkException
Description copied from interface:NetworkServiceLocalReturns the managed networks for the current admin- Specified by:
getManagedNetworksin interfaceNetworkServiceLocal- Throws:
FrameworkException
-
getSearchData
public NetworkSearchData getSearchData()
Description copied from interface:NetworkServiceReturns data for searching networks- Specified by:
getSearchDatain interfaceNetworkService
-
newEntity
public Network newEntity(Void 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<Network,NetworkDTO,NetworkData,Void>- Specified by:
newEntityin classCRUDServiceImpl<Network,QNetwork,NetworkDTO,NetworkData,Void>
-
resolveNetworkUrl
public String resolveNetworkUrl(NetworkVO networkVO) throws FrameworkException
Description copied from interface:NetworkServiceReturns the URL a global admin can use to access the given network- Specified by:
resolveNetworkUrlin interfaceNetworkService- Throws:
FrameworkException
-
search
public Page<NetworkVO> search(NetworkQuery params)
Description copied from interface:NetworkServiceSearches for networks according to the given criteria- Specified by:
searchin interfaceNetworkService
-
toDTO
public NetworkDTO toDTO(Network entity)
Description copied from class:CRUDServiceImplConverts the given entity in a DTO, handling theCRUDServiceImpl.subClassMappings()mappings for subclasses- Specified by:
toDTOin interfaceCRUDServiceLocal<Network,NetworkDTO,NetworkData,Void>- Overrides:
toDTOin classCRUDServiceImpl<Network,QNetwork,NetworkDTO,NetworkData,Void>
-
addCustomInternalNameValidations
protected void addCustomInternalNameValidations(Property internalName, NetworkDTO dto)
Description copied from class:CRUDServiceImplThis method may be overridden to add custom validations for the INTERNAL_NAME property.- Overrides:
addCustomInternalNameValidationsin classCRUDServiceImpl<Network,QNetwork,NetworkDTO,NetworkData,Void>
-
getData
protected NetworkData getData(Network network)
Description copied from class:CRUDServiceImplReturns details data for the given entity- Specified by:
getDatain classCRUDServiceImpl<Network,QNetwork,NetworkDTO,NetworkData,Void>
-
isEntityInternalNameRequired
protected boolean isEntityInternalNameRequired()
Description copied from class:CRUDServiceImplNOTE: This method will be only invoked if the entity is anIInternalNamedEntity. Subclasses could override it if the internal name is required.- Overrides:
isEntityInternalNameRequiredin classCRUDServiceImpl<Network,QNetwork,NetworkDTO,NetworkData,Void>- Returns:
- false (optional by default)
-
onAfterRemove
protected void onAfterRemove(Network network)
Description copied from class:CRUDServiceImplMay be overridden in order to perform custom logic after removing an entity- Overrides:
onAfterRemovein classCRUDServiceImpl<Network,QNetwork,NetworkDTO,NetworkData,Void>
-
onAfterSave
protected void onAfterSave(Network network, Network currentCopy, Object dataFromOnBeforeSave)
Description copied from class:CRUDServiceImplMay be overridden in order to perform custom logic after saving an entity- Overrides:
onAfterSavein classCRUDServiceImpl<Network,QNetwork,NetworkDTO,NetworkData,Void>
-
onBeforeSave
protected Object onBeforeSave(Network network, Network 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<Network,QNetwork,NetworkDTO,NetworkData,Void>
-
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(NetworkDTO dto)
- Specified by:
resolveValidatorin classCRUDServiceImpl<Network,QNetwork,NetworkDTO,NetworkData,Void>
-
-