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
ConstructorDescriptionEntityDocumentsServiceImpl
(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 Domainboolean
isEntityDetailDocument
(ResourceNode resourceNode) boolean
isEntityDetailDocument
(Entity resourceEntity) boolean
isEntityDocument
(ResourceNode resourceNode) boolean
isEntityDocument
(Entity resourceEntity) boolean
isEntityDocumentFolder
(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.boolean
isEntityDocumentFolder
(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.boolean
isEntityModelFolder
(Entity entity) check if the entity is the root folder for an entity modelboolean
isEntityRootFolder
(Entity entity) check if the entity is the root folder for an entityboolean
isRelationToRelatedEntity
(String relationName) Determine if a freely chosen relation is a relation from an entity document/folder to the related entity.void
removeRelatedEntity
(ContentTreeNode contentTreeNode) Remove the related entity from the ContentTreeNodevoid
setRelatedEntity
(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:EntityDocumentsService
Get the System Domain- Specified by:
getSystemDomain
in interfaceEntityDocumentsService
- Returns:
- System Domain
- Throws:
EntityDocumentsException
-
getEntityModelFolder
Description copied from interface:EntityDocumentsService
Get the entity documents folder for an entity model- Specified by:
getEntityModelFolder
in interfaceEntityDocumentsService
- Parameters:
modelName
- name of the entity model- Returns:
- entity documents folder
- Throws:
EntityDocumentsException
-
getEntityModelFolder
Description copied from interface:EntityDocumentsService
Get the entity documents folder for an entity model- Specified by:
getEntityModelFolder
in interfaceEntityDocumentsService
- Parameters:
entityModel
- entity model- Returns:
- entity documents folder
- Throws:
EntityDocumentsException
-
getEntityDocumentsFolder
Description copied from interface:EntityDocumentsService
Get the entity's document folder- [entity model folder] \- [entity folder] <-- <b>folder returned</b> \- [language folder]
- Specified by:
getEntityDocumentsFolder
in interfaceEntityDocumentsService
- Parameters:
entity
- the entity- Returns:
- entity's document folder
- Throws:
EntityDocumentsException
-
getRelatedEntityRelationName
public Optional<String> getRelatedEntityRelationName(String relatedEntityName) throws EntityDocumentsException - Specified by:
getRelatedEntityRelationName
in 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:EntityDocumentsService
Determine 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:
isRelationToRelatedEntity
in 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:EntityDocumentsService
Get the related entity associated with this ContentTreeNode- Specified by:
getRelatedEntity
in interfaceEntityDocumentsService
- Parameters:
contentTreeNode
- ContentTreeNode- Returns:
- an
Optional
containing the related entity (if available) or anOptional.empty()
) - Throws:
EntityDocumentsException
-
isEntityRootFolder
Description copied from interface:EntityDocumentsService
check if the entity is the root folder for an entity- Specified by:
isEntityRootFolder
in interfaceEntityDocumentsService
- Parameters:
entity
- the folder entity- Returns:
- true / false
- Throws:
PersistException
-
isEntityModelFolder
Description copied from interface:EntityDocumentsService
check if the entity is the root folder for an entity model- Specified by:
isEntityModelFolder
in interfaceEntityDocumentsService
- Parameters:
entity
- the folder entity- Returns:
- true / false
- Throws:
PersistException
-
isEntityDocumentFolder
Description copied from interface:EntityDocumentsService
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.- Specified by:
isEntityDocumentFolder
in interfaceEntityDocumentsService
- Parameters:
entity
- the folder entity- Returns:
- true / false
-
isEntityDocumentFolder
Description copied from interface:EntityDocumentsService
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.- Specified by:
isEntityDocumentFolder
in interfaceEntityDocumentsService
- Parameters:
folderNode
- the folder node- Returns:
- true / false
-
addTimestampToFilename
- Specified by:
addTimestampToFilename
in interfaceEntityDocumentsService
-
isEntityDocument
- Specified by:
isEntityDocument
in interfaceEntityDocumentsService
- Throws:
PersistException
-
isEntityDocument
- Specified by:
isEntityDocument
in interfaceEntityDocumentsService
- Throws:
PersistException
-
isEntityDetailDocument
- Specified by:
isEntityDetailDocument
in interfaceEntityDocumentsService
- Throws:
PersistException
-
isEntityDetailDocument
- Specified by:
isEntityDetailDocument
in interfaceEntityDocumentsService
- Throws:
PersistException
-
getDetailDocumentFileName
Description copied from interface:EntityDocumentsService
Get the file name for a detail document- Specified by:
getDetailDocumentFileName
in interfaceEntityDocumentsService
- Parameters:
resourceNode
- a detail documentResourceNode
(will throw an exception if any otherResourceNode
s are provided.- Returns:
- the file name for the detail document
- Throws:
PersistException
-
getDetailDocumentForField
- Specified by:
getDetailDocumentForField
in interfaceEntityDocumentsService
-
setRelatedEntity
public void setRelatedEntity(ContentTreeNode contentTreeNode, Entity entity) throws EntityDocumentsException Description copied from interface:InternalEntityDocumentsService
Set a related entity for the ContentTreeNode- Specified by:
setRelatedEntity
in 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:InternalEntityDocumentsService
Remove the related entity from the ContentTreeNode- Specified by:
removeRelatedEntity
in interfaceInternalEntityDocumentsService
- Parameters:
contentTreeNode
- ContentTreeNode- Throws:
EntityDocumentsException
-
getOrCreateEntityDocumentsFolder
Description copied from interface:InternalEntityDocumentsService
Get or create an entity's document folder. It also creates potential required sub-folders (e.g. language folders for multi-language entities).- Specified by:
getOrCreateEntityDocumentsFolder
in 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:InternalEntityDocumentsService
Create an entity's document folder. It also creates potential required sub-folders (e.g. language folders for multi-language entities).- Specified by:
createEntityDocumentsFolder
in 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:
ensureEntityModelFolder
in interfaceInternalEntityDocumentsService
- Throws:
EntityDocumentsException
-
createEntityDocumentsInvoker
- Specified by:
createEntityDocumentsInvoker
in interfaceEntityDocumentsService
-