Class LogicCopyServiceImpl
java.lang.Object
ch.tocco.nice2.entityoperation.impl.logiccopy.LogicCopyServiceImpl
- All Implemented Interfaces:
LogicCopyService
-
Constructor Summary
ConstructorDescriptionLogicCopyServiceImpl
(QueryBuilderFactory queryBuilderFactory, TextResources textResources, Context context, L10N l10N, EntityDefaultValueService defaultValueService) -
Method Summary
Modifier and TypeMethodDescriptioncopyRelations
(Entity copiedEntity, Entity originalEntity, Collection<String> excluded) same asLogicCopyService.copyRelations(Entity, Entity, Optional, Collection)
but passes an absent optional for the third parameter (parentEntity)copyRelations
(Entity copiedEntity, Entity originalEntity, Optional<Entity> parentEntity, Collection<String> excluded) copies the references of relations that: - are not the parentEntity if one exists - are not 1:n from the view of the original entity (as this would modify the original entity) - are not excluded.createLogicCopyOf
(Entity originalEntity) gives you a complete Copy of the given entity with all relations.
-
Constructor Details
-
LogicCopyServiceImpl
public LogicCopyServiceImpl(QueryBuilderFactory queryBuilderFactory, TextResources textResources, Context context, L10N l10N, EntityDefaultValueService defaultValueService)
-
-
Method Details
-
createLogicCopyOf
Description copied from interface:LogicCopyService
gives you a complete Copy of the given entity with all relations. the fluent interface can be used to define the copy behaviour. Example: logicCopyService.createLogicCopyOf(subproject).withRelatedEntitiesToCopy(ImmutableSet.of(relTask)) .withExcludedRelations(ImmutableSet.of(relTask.relTask_note)).doCopy()- Specified by:
createLogicCopyOf
in interfaceLogicCopyService
- Parameters:
originalEntity
- entity to copy- Returns:
- copied entity
-
copyRelations
public Entity copyRelations(Entity copiedEntity, Entity originalEntity, Collection<String> excluded) Description copied from interface:LogicCopyService
same asLogicCopyService.copyRelations(Entity, Entity, Optional, Collection)
but passes an absent optional for the third parameter (parentEntity)- Specified by:
copyRelations
in interfaceLogicCopyService
- Parameters:
copiedEntity
- the entity to copy the relations tooriginalEntity
- entity to get the relation values fromexcluded
- list of relations which should be excluded from copy
-
copyRelations
public Entity copyRelations(Entity copiedEntity, Entity originalEntity, Optional<Entity> parentEntity, Collection<String> excluded) Description copied from interface:LogicCopyService
copies the references of relations that: - are not the parentEntity if one exists - are not 1:n from the view of the original entity (as this would modify the original entity) - are not excluded. (note that the related entities will not get copied!)- Specified by:
copyRelations
in interfaceLogicCopyService
- Parameters:
copiedEntity
- the entity to copy the relations tooriginalEntity
- entity to get the relation values fromparentEntity
- parent to ignoreexcluded
- list of relations which should be excluded from copy
-