org.squashtest.tm.service.internal.customfield
Class PrivateCustomFieldValueServiceImpl

java.lang.Object
  extended by org.squashtest.tm.service.internal.customfield.PrivateCustomFieldValueServiceImpl
All Implemented Interfaces:
CustomFieldValueFinderService, CustomFieldValueManagerService, PrivateCustomFieldValueService

@Service(value="squashtest.tm.service.CustomFieldValueManagerService")
@Transactional
public class PrivateCustomFieldValueServiceImpl
extends Object
implements PrivateCustomFieldValueService


Constructor Summary
PrivateCustomFieldValueServiceImpl()
           
 
Method Summary
 boolean areValuesEditable(long boundEntityId, org.squashtest.tm.domain.customfield.BindableEntity bindableEntity)
          Tells if the CF values of the given entity are editable, according to both security rules and sensible business rules.
 void cascadeCustomFieldValuesCreation(org.squashtest.tm.domain.customfield.CustomFieldBinding binding)
          Will create a custom field value for all the entities affected by the given binding
 void cascadeCustomFieldValuesDeletion(org.squashtest.tm.domain.customfield.CustomFieldBinding binding)
          Will remove the custom field values corresponding to the given binding
 void cascadeCustomFieldValuesDeletion(List<Long> customFieldBindingIds)
          Will remove the custom field values corresponding to the bindings, given their ids.
 void changeValue(long customFieldValueId, String newValue)
          Will update the value of a CustomFieldValue using its Id.
 void copyCustomFieldValues(org.squashtest.tm.domain.customfield.BoundEntity source, org.squashtest.tm.domain.customfield.BoundEntity recipient)
          Will copy the custom field values from an entity to another entity, creating them in the process
 void copyCustomFieldValuesContent(org.squashtest.tm.domain.customfield.BoundEntity source, org.squashtest.tm.domain.customfield.BoundEntity recipient)
          Will copy the custom field values from an entity to another entity.
 void createAllCustomFieldValues(org.squashtest.tm.domain.customfield.BoundEntity entity)
          Will create all the custom field values for one entity.
 void deleteAllCustomFieldValues(org.squashtest.tm.domain.customfield.BindableEntity entityType, List<Long> entityIds)
          Will delete all the custom field values for multiple BoundEntities
 void deleteAllCustomFieldValues(org.squashtest.tm.domain.customfield.BoundEntity entity)
          will delete all the custom field vales for one entity
 List<org.squashtest.tm.domain.customfield.CustomFieldValue> findAllCustomFieldValues(org.squashtest.tm.domain.customfield.BoundEntity boundEntity)
          Will return the list of the custom field values associated to the specified bound entity.
 List<org.squashtest.tm.domain.customfield.CustomFieldValue> findAllCustomFieldValues(Collection<? extends org.squashtest.tm.domain.customfield.BoundEntity> boundEntities)
          Same as CustomFieldValueFinderService.findAllCustomFieldValues(BoundEntity), using a List of entities instead.
 List<org.squashtest.tm.domain.customfield.CustomFieldValue> findAllCustomFieldValues(Collection<? extends org.squashtest.tm.domain.customfield.BoundEntity> boundEntities, Collection<org.squashtest.tm.domain.customfield.CustomField> restrictedToThoseCustomfields)
          Same as CustomFieldValueFinderService.findAllCustomFieldValues(Collection), but only the values refering to one of the custom fields given as argument will be retained.
 List<org.squashtest.tm.domain.customfield.CustomFieldValue> findAllCustomFieldValues(long boundEntityId, org.squashtest.tm.domain.customfield.BindableEntity bindableEntity)
          Same as CustomFieldValueFinderService.findAllCustomFieldValues(BoundEntity), but the properties identifying a BoundEntity are broken down into its ID and type.
 boolean hasCustomFields(org.squashtest.tm.domain.customfield.BoundEntity boundEntity)
          Tells whether the given bound entity has custom fields or not.
 boolean hasCustomFields(Long boundEntityId, org.squashtest.tm.domain.customfield.BindableEntity bindableEntity)
          Same as CustomFieldValueFinderService.hasCustomFields(BoundEntity), the bound entity being identified by its type and id
 void migrateCustomFieldValues(org.squashtest.tm.domain.customfield.BoundEntity entity)
          Will ensure that the custom field values of an entity are consistent with the custom fields bound to the project it belongs to, at the time when the method is invoked.
 void migrateCustomFieldValues(Collection<org.squashtest.tm.domain.customfield.BoundEntity> entities)
          Same as PrivateCustomFieldValueService.migrateCustomFieldValues(BoundEntity), batched version.
 void setPermissionService(PermissionEvaluationService permissionService)
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

PrivateCustomFieldValueServiceImpl

public PrivateCustomFieldValueServiceImpl()
Method Detail

setPermissionService

public void setPermissionService(PermissionEvaluationService permissionService)

hasCustomFields

@Transactional(readOnly=true)
public boolean hasCustomFields(org.squashtest.tm.domain.customfield.BoundEntity boundEntity)
Description copied from interface: CustomFieldValueFinderService
Tells whether the given bound entity has custom fields or not.

Specified by:
hasCustomFields in interface CustomFieldValueFinderService
Returns:

hasCustomFields

@Transactional(readOnly=true)
public boolean hasCustomFields(Long boundEntityId,
                                             org.squashtest.tm.domain.customfield.BindableEntity bindableEntity)
Description copied from interface: CustomFieldValueFinderService
Same as CustomFieldValueFinderService.hasCustomFields(BoundEntity), the bound entity being identified by its type and id

Specified by:
hasCustomFields in interface CustomFieldValueFinderService
Returns:

findAllCustomFieldValues

@Transactional(readOnly=true)
public List<org.squashtest.tm.domain.customfield.CustomFieldValue> findAllCustomFieldValues(org.squashtest.tm.domain.customfield.BoundEntity boundEntity)
Description copied from interface: CustomFieldValueFinderService
Will return the list of the custom field values associated to the specified bound entity. The authenticated use must be administrator or have read permission on that entity.

Specified by:
findAllCustomFieldValues in interface CustomFieldValueFinderService
Returns:

findAllCustomFieldValues

@Transactional(readOnly=true)
public List<org.squashtest.tm.domain.customfield.CustomFieldValue> findAllCustomFieldValues(long boundEntityId,
                                                                                                          org.squashtest.tm.domain.customfield.BindableEntity bindableEntity)
Description copied from interface: CustomFieldValueFinderService
Same as CustomFieldValueFinderService.findAllCustomFieldValues(BoundEntity), but the properties identifying a BoundEntity are broken down into its ID and type.

Specified by:
findAllCustomFieldValues in interface CustomFieldValueFinderService
Returns:

findAllCustomFieldValues

public List<org.squashtest.tm.domain.customfield.CustomFieldValue> findAllCustomFieldValues(Collection<? extends org.squashtest.tm.domain.customfield.BoundEntity> boundEntities)
Description copied from interface: CustomFieldValueFinderService
Same as CustomFieldValueFinderService.findAllCustomFieldValues(BoundEntity), using a List of entities instead. This method is pure convenience, to fetch custom fields in bulk (and soften the db queries overhead). The order of the result is arbitrary.

Specified by:
findAllCustomFieldValues in interface CustomFieldValueFinderService
Returns:

findAllCustomFieldValues

public List<org.squashtest.tm.domain.customfield.CustomFieldValue> findAllCustomFieldValues(Collection<? extends org.squashtest.tm.domain.customfield.BoundEntity> boundEntities,
                                                                                            Collection<org.squashtest.tm.domain.customfield.CustomField> restrictedToThoseCustomfields)
Description copied from interface: CustomFieldValueFinderService
Same as CustomFieldValueFinderService.findAllCustomFieldValues(Collection), but only the values refering to one of the custom fields given as argument will be retained.

Specified by:
findAllCustomFieldValues in interface CustomFieldValueFinderService
Returns:

cascadeCustomFieldValuesCreation

public void cascadeCustomFieldValuesCreation(org.squashtest.tm.domain.customfield.CustomFieldBinding binding)
Description copied from interface: PrivateCustomFieldValueService
Will create a custom field value for all the entities affected by the given binding

Specified by:
cascadeCustomFieldValuesCreation in interface PrivateCustomFieldValueService

cascadeCustomFieldValuesDeletion

public void cascadeCustomFieldValuesDeletion(org.squashtest.tm.domain.customfield.CustomFieldBinding binding)
Description copied from interface: PrivateCustomFieldValueService
Will remove the custom field values corresponding to the given binding

Specified by:
cascadeCustomFieldValuesDeletion in interface PrivateCustomFieldValueService

cascadeCustomFieldValuesDeletion

public void cascadeCustomFieldValuesDeletion(List<Long> customFieldBindingIds)
Description copied from interface: PrivateCustomFieldValueService
Will remove the custom field values corresponding to the bindings, given their ids.

Specified by:
cascadeCustomFieldValuesDeletion in interface PrivateCustomFieldValueService

createAllCustomFieldValues

public void createAllCustomFieldValues(org.squashtest.tm.domain.customfield.BoundEntity entity)
Description copied from interface: PrivateCustomFieldValueService
Will create all the custom field values for one entity.

Specified by:
createAllCustomFieldValues in interface PrivateCustomFieldValueService

deleteAllCustomFieldValues

public void deleteAllCustomFieldValues(org.squashtest.tm.domain.customfield.BoundEntity entity)
Description copied from interface: PrivateCustomFieldValueService
will delete all the custom field vales for one entity

Specified by:
deleteAllCustomFieldValues in interface PrivateCustomFieldValueService

deleteAllCustomFieldValues

public void deleteAllCustomFieldValues(org.squashtest.tm.domain.customfield.BindableEntity entityType,
                                       List<Long> entityIds)
Description copied from interface: PrivateCustomFieldValueService
Will delete all the custom field values for multiple BoundEntities

Specified by:
deleteAllCustomFieldValues in interface PrivateCustomFieldValueService
Parameters:
entityType - the BindableEntity that all of the BoundEntity must share
entityIds - the ids of those BoundEntities

copyCustomFieldValues

public void copyCustomFieldValues(org.squashtest.tm.domain.customfield.BoundEntity source,
                                  org.squashtest.tm.domain.customfield.BoundEntity recipient)
Description copied from interface: PrivateCustomFieldValueService
Will copy the custom field values from an entity to another entity, creating them in the process

Specified by:
copyCustomFieldValues in interface PrivateCustomFieldValueService

copyCustomFieldValuesContent

public void copyCustomFieldValuesContent(org.squashtest.tm.domain.customfield.BoundEntity source,
                                         org.squashtest.tm.domain.customfield.BoundEntity recipient)
Description copied from interface: PrivateCustomFieldValueService
Will copy the custom field values from an entity to another entity. It assumes that the custom field values already exists for both, and will simply invoke CustomFieldValue.setValue(String) from one to the other.

Specified by:
copyCustomFieldValuesContent in interface PrivateCustomFieldValueService

changeValue

public void changeValue(long customFieldValueId,
                        String newValue)
Description copied from interface: CustomFieldValueManagerService
Will update the value of a CustomFieldValue using its Id. The service will check that the requestor has the correct credentials.

Specified by:
changeValue in interface CustomFieldValueManagerService

migrateCustomFieldValues

public void migrateCustomFieldValues(org.squashtest.tm.domain.customfield.BoundEntity entity)
Description copied from interface: PrivateCustomFieldValueService
Will ensure that the custom field values of an entity are consistent with the custom fields bound to the project it belongs to, at the time when the method is invoked. Indeed inconsistencies arise when an entity is moved from one project to another. This method will fix these inconsistencies in three steps :
  1. creating the custom field values corresponding to the bindings of the current project,
  2. copy the custom field values from the former project into those of the new project if any matching values are found,
  3. delete the custom field values from the former project.
    1. Specified by:
      migrateCustomFieldValues in interface PrivateCustomFieldValueService

migrateCustomFieldValues

public void migrateCustomFieldValues(Collection<org.squashtest.tm.domain.customfield.BoundEntity> entities)
Description copied from interface: PrivateCustomFieldValueService
Same as PrivateCustomFieldValueService.migrateCustomFieldValues(BoundEntity), batched version.

Specified by:
migrateCustomFieldValues in interface PrivateCustomFieldValueService

areValuesEditable

public boolean areValuesEditable(long boundEntityId,
                                 org.squashtest.tm.domain.customfield.BindableEntity bindableEntity)
Description copied from interface: CustomFieldValueFinderService
Tells if the CF values of the given entity are editable, according to both security rules and sensible business rules.

Specified by:
areValuesEditable in interface CustomFieldValueFinderService
Returns:
See Also:
CustomFieldValueFinderService.areValuesEditable(long, org.squashtest.tm.domain.customfield.BindableEntity)


Copyright © 2010-2013 Henix, henix.fr. All Rights Reserved.