org.squashtest.tm.service.internal.customfield
Class AbstractCustomFieldHelper<X extends org.squashtest.tm.domain.customfield.BoundEntity>

java.lang.Object
  extended by org.squashtest.tm.service.internal.customfield.AbstractCustomFieldHelper<X>
Type Parameters:
X -
All Implemented Interfaces:
CustomFieldHelper<X>
Direct Known Subclasses:
CustomFieldHelperImpl, NoValuesCustomFieldHelper

public abstract class AbstractCustomFieldHelper<X extends org.squashtest.tm.domain.customfield.BoundEntity>
extends Object
implements CustomFieldHelper<X>

Author:
bsiri, Gregory Fouquet

Nested Class Summary
protected static class AbstractCustomFieldHelper.BindingFieldCollector
           
protected static class AbstractCustomFieldHelper.BindingLocationFilter
           
protected static class AbstractCustomFieldHelper.BindingSorter
           
protected static class AbstractCustomFieldHelper.CustomFieldDefinitionStrategy
           
 
Field Summary
protected  CustomFieldBindingFinderService cufBindingService
           
protected  List<org.squashtest.tm.domain.customfield.CustomField> customFields
           
 
Constructor Summary
AbstractCustomFieldHelper()
           
 
Method Summary
protected abstract  List<org.squashtest.tm.domain.customfield.CustomFieldValue> doGetCustomFieldValues()
           
protected  List<org.squashtest.tm.domain.customfield.CustomField> findCustomFields(long projectId, org.squashtest.tm.domain.customfield.BindableEntity entityType, Collection<org.squashtest.tm.domain.customfield.RenderingLocation> optionalLocations)
          Return the CustomFields referenced by the CustomFieldBindings for the given project and BindableEntity type, ordered by their position.
protected  AbstractCustomFieldHelper.CustomFieldDefinitionStrategy getAddingStrategy()
           
protected  CustomFieldValueManagerService getCufValuesService()
           
 List<org.squashtest.tm.domain.customfield.CustomField> getCustomFieldConfiguration()
          sorted by position, filtered by location.
 List<org.squashtest.tm.domain.customfield.CustomFieldValue> getCustomFieldValues()
           
protected  Collection<org.squashtest.tm.domain.customfield.RenderingLocation> getLocations()
           
 CustomFieldHelper<X> includeAllCustomFields()
          tells the helper to include every custom fields it finds.
protected abstract  void initCustomFields()
          When called, this method should initialize the customFields attribute.
 CustomFieldHelper<X> restrictToCommonFields()
          tells the helper to retain only the custom fields that are common to all the entities (in case they come from mixed projects, or are of mixed concrete classes)
protected  void setCufBindingService(CustomFieldBindingFinderService cufBindingService)
           
protected  void setCufValuesService(CustomFieldValueManagerService cufValuesService)
           
 CustomFieldHelper<X> setRenderingLocations(Collection<org.squashtest.tm.domain.customfield.RenderingLocation> locations)
           
 CustomFieldHelper<X> setRenderingLocations(org.squashtest.tm.domain.customfield.RenderingLocation... locations)
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

cufBindingService

protected CustomFieldBindingFinderService cufBindingService

customFields

protected List<org.squashtest.tm.domain.customfield.CustomField> customFields
Constructor Detail

AbstractCustomFieldHelper

public AbstractCustomFieldHelper()
Method Detail

initCustomFields

protected abstract void initCustomFields()
When called, this method should initialize the customFields attribute.


doGetCustomFieldValues

protected abstract List<org.squashtest.tm.domain.customfield.CustomFieldValue> doGetCustomFieldValues()

setRenderingLocations

public CustomFieldHelper<X> setRenderingLocations(org.squashtest.tm.domain.customfield.RenderingLocation... locations)
Specified by:
setRenderingLocations in interface CustomFieldHelper<X extends org.squashtest.tm.domain.customfield.BoundEntity>

setRenderingLocations

public CustomFieldHelper<X> setRenderingLocations(Collection<org.squashtest.tm.domain.customfield.RenderingLocation> locations)
Specified by:
setRenderingLocations in interface CustomFieldHelper<X extends org.squashtest.tm.domain.customfield.BoundEntity>

restrictToCommonFields

public CustomFieldHelper<X> restrictToCommonFields()
Description copied from interface: CustomFieldHelper
tells the helper to retain only the custom fields that are common to all the entities (in case they come from mixed projects, or are of mixed concrete classes)

Specified by:
restrictToCommonFields in interface CustomFieldHelper<X extends org.squashtest.tm.domain.customfield.BoundEntity>
Returns:
this object

includeAllCustomFields

public CustomFieldHelper<X> includeAllCustomFields()
Description copied from interface: CustomFieldHelper
tells the helper to include every custom fields it finds.

Specified by:
includeAllCustomFields in interface CustomFieldHelper<X extends org.squashtest.tm.domain.customfield.BoundEntity>
Returns:

getCustomFieldConfiguration

public final List<org.squashtest.tm.domain.customfield.CustomField> getCustomFieldConfiguration()
Description copied from interface: CustomFieldHelper
sorted by position, filtered by location.

Specified by:
getCustomFieldConfiguration in interface CustomFieldHelper<X extends org.squashtest.tm.domain.customfield.BoundEntity>
Returns:

getCustomFieldValues

public final List<org.squashtest.tm.domain.customfield.CustomFieldValue> getCustomFieldValues()
Specified by:
getCustomFieldValues in interface CustomFieldHelper<X extends org.squashtest.tm.domain.customfield.BoundEntity>

findCustomFields

protected final List<org.squashtest.tm.domain.customfield.CustomField> findCustomFields(long projectId,
                                                                                        org.squashtest.tm.domain.customfield.BindableEntity entityType,
                                                                                        Collection<org.squashtest.tm.domain.customfield.RenderingLocation> optionalLocations)
Return the CustomFields referenced by the CustomFieldBindings for the given project and BindableEntity type, ordered by their position. The location argument is optional, if set then only the custom fields that are rendered in at least one of these locations will be returned.

Parameters:
projectId -
entityType -
Returns:

setCufBindingService

protected void setCufBindingService(CustomFieldBindingFinderService cufBindingService)

getCufValuesService

protected CustomFieldValueManagerService getCufValuesService()
Returns:
the cufValuesService

setCufValuesService

protected void setCufValuesService(CustomFieldValueManagerService cufValuesService)

getAddingStrategy

protected final AbstractCustomFieldHelper.CustomFieldDefinitionStrategy getAddingStrategy()
Returns:
the addingStrategy

getLocations

protected Collection<org.squashtest.tm.domain.customfield.RenderingLocation> getLocations()
Returns:
the locations


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