Class EntityDocumentsServiceImpl
java.lang.Object
ch.tocco.nice2.dms.impl.entitydocs.EntityDocumentsServiceImpl
- All Implemented Interfaces:
EntityDocumentsService,InternalEntityDocumentsService
@Component
public class EntityDocumentsServiceImpl
extends Object
implements InternalEntityDocumentsService
-
Constructor Summary
ConstructorsConstructorDescriptionEntityDocumentsServiceImpl(TypeManager typeManager, Context context, DataModel dataModel, QueryBuilderFactory queryBuilderFactory, ContentTreeService contentTreeService, CommandExecutor commandExecutor, TimezoneResolverService timezoneResolverService, SecurityManager securityManager, DefaultDisplayService defaultDisplayService, BusinessUnitManager businessUnitManager, org.slf4j.Logger log, L10N l10N) -
Method Summary
Modifier and TypeMethodDescriptionaddTimestampToFilename(String fileName) createEntityDocumentsFolder(Entity entity, FolderNode parentFolder) Create an entity's document folder.createEntityDocumentsInvoker(List<EntityId> entities) ensureEntityModelFolder(EntityModel entityModel) getDetailDocumentFileName(ResourceNode resourceNode) Get the file name for a detail documentgetDetailDocumentForField(Entity entity, String fieldModelName) getEntityDocumentsFolder(Entity entity) Get the entity's document foldergetEntityModelFolder(EntityModel entityModel) Get the entity documents folder for an entity modelgetEntityModelFolder(String modelName) Get the entity documents folder for an entity modelGet or create an entity's document folder.getRelatedEntity(ContentTreeNode contentTreeNode) Get the related entity associated with this ContentTreeNodegetRelatedEntityRelationName(String relatedEntityName) Get the System DomainbooleanisEntityDetailDocument(ResourceNode resourceNode) booleanisEntityDetailDocument(Entity resourceEntity) booleanisEntityDocument(ResourceNode resourceNode) booleanisEntityDocument(Entity resourceEntity) booleanisEntityDocumentFolder(FolderNode folderNode) check if the folder is an entity doc folder (no matter if it's the root folder, the model root folder or a any child folder.booleanisEntityDocumentFolder(Entity entity) check if the entity is an entity doc folder (no matter if it's the root folder, the model root folder or a any child folder.booleanisEntityModelFolder(Entity entity) check if the entity is the root folder for an entity modelbooleanisEntityRootFolder(Entity entity) check if the entity is the root folder for an entitybooleanisRelationToRelatedEntity(String relationName) Determine if a freely chosen relation is a relation from an entity document/folder to the related entity.voidremoveRelatedEntity(ContentTreeNode contentTreeNode) Remove the related entity from the ContentTreeNodevoidsetRelatedEntity(ContentTreeNode contentTreeNode, Entity entity) Set a related entity for the ContentTreeNode
-
Constructor Details
-
EntityDocumentsServiceImpl
public EntityDocumentsServiceImpl(TypeManager typeManager, Context context, DataModel dataModel, QueryBuilderFactory queryBuilderFactory, ContentTreeService contentTreeService, CommandExecutor commandExecutor, TimezoneResolverService timezoneResolverService, SecurityManager securityManager, DefaultDisplayService defaultDisplayService, BusinessUnitManager businessUnitManager, org.slf4j.Logger log, L10N l10N)
-
-
Method Details
-
getSystemDomain
Description copied from interface:EntityDocumentsServiceGet the System Domain- Specified by:
getSystemDomainin interfaceEntityDocumentsService- Returns:
- System Domain
- Throws:
EntityDocumentsException
-
getEntityModelFolder
Description copied from interface:EntityDocumentsServiceGet the entity documents folder for an entity model- Specified by:
getEntityModelFolderin interfaceEntityDocumentsService- Parameters:
modelName- name of the entity model- Returns:
- entity documents folder
- Throws:
EntityDocumentsException
-
getEntityModelFolder
Description copied from interface:EntityDocumentsServiceGet the entity documents folder for an entity model- Specified by:
getEntityModelFolderin interfaceEntityDocumentsService- Parameters:
entityModel- entity model- Returns:
- entity documents folder
- Throws:
EntityDocumentsException
-
getEntityDocumentsFolder
Description copied from interface:EntityDocumentsServiceGet the entity's document folder- [entity model folder] \- [entity folder] <-- <b>folder returned</b> \- [language folder]- Specified by:
getEntityDocumentsFolderin interfaceEntityDocumentsService- Parameters:
entity- the entity- Returns:
- entity's document folder
- Throws:
EntityDocumentsException
-
getRelatedEntityRelationName
public Optional<String> getRelatedEntityRelationName(String relatedEntityName) throws EntityDocumentsException - Specified by:
getRelatedEntityRelationNamein interfaceEntityDocumentsService- Parameters:
relatedEntityName- name of a related entity model- Returns:
- name of the relation to the required entity (if such a relation exists, Optional.empty() otherwise)
- Throws:
EntityDocumentsException
-
isRelationToRelatedEntity
Description copied from interface:EntityDocumentsServiceDetermine if a freely chosen relation is a relation from an entity document/folder to the related entity. I.e. if there exists an Entity called "Post", which also has entity docs: If this method is called with "relPost_entitydocs", true will be returned.- Specified by:
isRelationToRelatedEntityin interfaceEntityDocumentsService- Parameters:
relationName- Any relation name.- Returns:
- true if it's a relation to the related entity, else false.
-
getRelatedEntity
public Optional<Entity> getRelatedEntity(ContentTreeNode contentTreeNode) throws EntityDocumentsException Description copied from interface:EntityDocumentsServiceGet the related entity associated with this ContentTreeNode- Specified by:
getRelatedEntityin interfaceEntityDocumentsService- Parameters:
contentTreeNode- ContentTreeNode- Returns:
- an
Optionalcontaining the related entity (if available) or anOptional.empty()) - Throws:
EntityDocumentsException
-
isEntityRootFolder
Description copied from interface:EntityDocumentsServicecheck if the entity is the root folder for an entity- Specified by:
isEntityRootFolderin interfaceEntityDocumentsService- Parameters:
entity- the folder entity- Returns:
- true / false
- Throws:
PersistException
-
isEntityModelFolder
Description copied from interface:EntityDocumentsServicecheck if the entity is the root folder for an entity model- Specified by:
isEntityModelFolderin interfaceEntityDocumentsService- Parameters:
entity- the folder entity- Returns:
- true / false
- Throws:
PersistException
-
isEntityDocumentFolder
Description copied from interface:EntityDocumentsServicecheck if the entity is an entity doc folder (no matter if it's the root folder, the model root folder or a any child folder.- Specified by:
isEntityDocumentFolderin interfaceEntityDocumentsService- Parameters:
entity- the folder entity- Returns:
- true / false
-
isEntityDocumentFolder
Description copied from interface:EntityDocumentsServicecheck if the folder is an entity doc folder (no matter if it's the root folder, the model root folder or a any child folder.- Specified by:
isEntityDocumentFolderin interfaceEntityDocumentsService- Parameters:
folderNode- the folder node- Returns:
- true / false
-
addTimestampToFilename
- Specified by:
addTimestampToFilenamein interfaceEntityDocumentsService
-
isEntityDocument
- Specified by:
isEntityDocumentin interfaceEntityDocumentsService- Throws:
PersistException
-
isEntityDocument
- Specified by:
isEntityDocumentin interfaceEntityDocumentsService- Throws:
PersistException
-
isEntityDetailDocument
- Specified by:
isEntityDetailDocumentin interfaceEntityDocumentsService- Throws:
PersistException
-
isEntityDetailDocument
- Specified by:
isEntityDetailDocumentin interfaceEntityDocumentsService- Throws:
PersistException
-
getDetailDocumentFileName
Description copied from interface:EntityDocumentsServiceGet the file name for a detail document- Specified by:
getDetailDocumentFileNamein interfaceEntityDocumentsService- Parameters:
resourceNode- a detail documentResourceNode(will throw an exception if any otherResourceNodes are provided.- Returns:
- the file name for the detail document
- Throws:
PersistException
-
getDetailDocumentForField
- Specified by:
getDetailDocumentForFieldin interfaceEntityDocumentsService
-
setRelatedEntity
public void setRelatedEntity(ContentTreeNode contentTreeNode, Entity entity) throws EntityDocumentsException Description copied from interface:InternalEntityDocumentsServiceSet a related entity for the ContentTreeNode- Specified by:
setRelatedEntityin interfaceInternalEntityDocumentsService- Parameters:
contentTreeNode- ContentTreeNodeentity- a reference entity (there needs to exist a relation rel[Entity model name] from the ContentTreeNode)- Throws:
EntityDocumentsException
-
removeRelatedEntity
Description copied from interface:InternalEntityDocumentsServiceRemove the related entity from the ContentTreeNode- Specified by:
removeRelatedEntityin interfaceInternalEntityDocumentsService- Parameters:
contentTreeNode- ContentTreeNode- Throws:
EntityDocumentsException
-
getOrCreateEntityDocumentsFolder
Description copied from interface:InternalEntityDocumentsServiceGet or create an entity's document folder. It also creates potential required sub-folders (e.g. language folders for multi-language entities).- Specified by:
getOrCreateEntityDocumentsFolderin interfaceInternalEntityDocumentsService- Parameters:
entity- the entity- Returns:
- entity's document folder
- Throws:
EntityDocumentsException
-
createEntityDocumentsFolder
public FolderNode createEntityDocumentsFolder(Entity entity, FolderNode parentFolder) throws EntityDocumentsException Description copied from interface:InternalEntityDocumentsServiceCreate an entity's document folder. It also creates potential required sub-folders (e.g. language folders for multi-language entities).- Specified by:
createEntityDocumentsFolderin interfaceInternalEntityDocumentsService- Parameters:
entity- the entityparentFolder- the parent folder, i.e. the model's folder- Returns:
- entity's document folder
- Throws:
EntityDocumentsException- See Also:
-
ensureEntityModelFolder
- Specified by:
ensureEntityModelFolderin interfaceInternalEntityDocumentsService- Throws:
EntityDocumentsException
-
createEntityDocumentsInvoker
- Specified by:
createEntityDocumentsInvokerin interfaceEntityDocumentsService
-