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

java.lang.Object
  extended by org.squashtest.tm.service.internal.customfield.CustomCustomFieldManagerServiceImpl
All Implemented Interfaces:
CustomCustomFieldManagerService

@Service(value="CustomCustomFieldManagerService")
public class CustomCustomFieldManagerServiceImpl
extends Object
implements CustomCustomFieldManagerService

Implementations for (non dynamically generated) custom-field management services.

Author:
mpagnon

Constructor Summary
CustomCustomFieldManagerServiceImpl()
           
 
Method Summary
 void addOption(Long customFieldId, org.squashtest.tm.domain.customfield.CustomFieldOption option)
          Will check if the new option's label is available among all the concerned CustomField's CustomFieldOption, check also if the code is available,if so, will add the new option at the bottom of the list.
 void changeCode(long customFieldId, String code)
          Will change the code of the custom field after having checked that : the code is unique among all custom fields, and that the code contains only letters (upper and lower cases), numbers or under-scores.
 void changeName(long customFieldId, String newName)
          Will check if new name is available among all custom fields and, if so, will change the name of the concerned CustomField.
 void changeOptional(Long customFieldId, Boolean optional)
          If custom-field becomes mandatory, will check that a default value exist.
 void changeOptionCode(long customFieldId, String optionLabel, String newCode)
          Will check if the new code is available among all the concerned CustomField's CustomFieldOption, if so, will change the code of the concerned custom-field's option.
 void changeOptionLabel(Long customFieldId, String optionLabel, String newLabel)
          Will check if the new label is available among all the concerned CustomField's CustomFieldOption, if so, will change the label of the concerned custom-field's option.
 void changeOptionsPositions(long customFieldId, int newIndex, List<String> optionsLabels)
          Will change custom field's options positions.
 void deleteCustomField(long customFieldId)
          Will delete the custom-field entity
 org.squashtest.tm.domain.customfield.SingleSelectField findSingleSelectFieldById(Long customFieldId)
          Will find the SingleSelectField of the given id
 org.squashtest.tm.core.foundation.collection.PagedCollectionHolder<List<org.squashtest.tm.domain.customfield.CustomField>> findSortedCustomFields(org.squashtest.tm.core.foundation.collection.PagingAndSorting filter)
          Will find all custom fields available and return them ordered according to the given parameters.
 void persist(org.squashtest.tm.domain.customfield.CustomField newCustomField)
          Will persist the given custom field.
 void removeOption(long customFieldId, String optionLabel)
          Will remove the from the custom-field's option list.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

CustomCustomFieldManagerServiceImpl

public CustomCustomFieldManagerServiceImpl()
Method Detail

findSortedCustomFields

public org.squashtest.tm.core.foundation.collection.PagedCollectionHolder<List<org.squashtest.tm.domain.customfield.CustomField>> findSortedCustomFields(org.squashtest.tm.core.foundation.collection.PagingAndSorting filter)
Description copied from interface: CustomCustomFieldManagerService
Will find all custom fields available and return them ordered according to the given parameters.

Specified by:
findSortedCustomFields in interface CustomCustomFieldManagerService
Parameters:
filter - the PagedCollectionHolder that holds order and paging params.
Returns:
the filtered collection of all custom field available in squash
See Also:
CustomFieldFinderService.findSortedCustomFields(PagingAndSorting)

deleteCustomField

public void deleteCustomField(long customFieldId)
Description copied from interface: CustomCustomFieldManagerService
Will delete the custom-field entity

Specified by:
deleteCustomField in interface CustomCustomFieldManagerService
Parameters:
customFieldId - : the id of the custom field to delete
See Also:
CustomCustomFieldManagerService.deleteCustomField(long)

persist

@PreAuthorize(value="hasRole(\'ROLE_ADMIN\')")
public void persist(org.squashtest.tm.domain.customfield.CustomField newCustomField)
Description copied from interface: CustomCustomFieldManagerService
Will persist the given custom field.

Specified by:
persist in interface CustomCustomFieldManagerService
Parameters:
newCustomField - : the custom field to persist
See Also:
CustomCustomFieldManagerService.persist(org.squashtest.tm.domain.customfield.CustomField)

changeName

public void changeName(long customFieldId,
                       String newName)
Description copied from interface: CustomCustomFieldManagerService
Will check if new name is available among all custom fields and, if so, will change the name of the concerned CustomField.

Specified by:
changeName in interface CustomCustomFieldManagerService
Parameters:
customFieldId - the id of the concerned CustomField
newName - the CustomField potential new name
See Also:
CustomCustomFieldManagerService.changeName(long, String)

changeOptional

public void changeOptional(Long customFieldId,
                           Boolean optional)
Description copied from interface: CustomCustomFieldManagerService
If custom-field becomes mandatory, will check that a default value exist. If so, all necessary CustomFieldValues will be added, otherwise an exception is thrown.
If custom-field becomes optional the change is done without check of special action.

Specified by:
changeOptional in interface CustomCustomFieldManagerService
Parameters:
customFieldId - the id of the concerned CustomField
optional - : true if the custom-field changes to be optional
false if it changes to be mandatory
See Also:
CustomCustomFieldManagerService.changeOptional(Long, Boolean)

changeOptionLabel

public void changeOptionLabel(Long customFieldId,
                              String optionLabel,
                              String newLabel)
Description copied from interface: CustomCustomFieldManagerService
Will check if the new label is available among all the concerned CustomField's CustomFieldOption, if so, will change the label of the concerned custom-field's option.

Specified by:
changeOptionLabel in interface CustomCustomFieldManagerService
Parameters:
customFieldId - : the id of the concerned CustomField
optionLabel - : the current CustomFieldOption's label
newLabel - : the potential new label for the concerned custom-field's option
See Also:
CustomCustomFieldManagerService.changeOptionLabel(Long, String, String)

changeOptionCode

public void changeOptionCode(long customFieldId,
                             String optionLabel,
                             String newCode)
Description copied from interface: CustomCustomFieldManagerService
Will check if the new code is available among all the concerned CustomField's CustomFieldOption, if so, will change the code of the concerned custom-field's option.

Specified by:
changeOptionCode in interface CustomCustomFieldManagerService
Parameters:
customFieldId - : the id of the concerned CustomField
optionLabel - : the CustomFieldOption's label
newCode - : the potential new code for the concerned custom-field's option
See Also:
org.squashtest.tm.service.customfield.CustomCustomFieldManagerService#changeOptionCode(Long, String, String)

addOption

public void addOption(Long customFieldId,
                      org.squashtest.tm.domain.customfield.CustomFieldOption option)
Description copied from interface: CustomCustomFieldManagerService
Will check if the new option's label is available among all the concerned CustomField's CustomFieldOption, check also if the code is available,if so, will add the new option at the bottom of the list.

Specified by:
addOption in interface CustomCustomFieldManagerService
Parameters:
customFieldId - : the id of the concerned CustomField
option - : the new CustomFieldOption
See Also:
CustomCustomFieldManagerService.addOption(Long, CustomFieldOption)

findSingleSelectFieldById

public org.squashtest.tm.domain.customfield.SingleSelectField findSingleSelectFieldById(Long customFieldId)
Description copied from interface: CustomCustomFieldManagerService
Will find the SingleSelectField of the given id

Specified by:
findSingleSelectFieldById in interface CustomCustomFieldManagerService
Parameters:
customFieldId - the id of the SingleSelectField
Returns:
the SingleSelectField or null
See Also:
CustomFieldFinderService.findSingleSelectFieldById(Long)

removeOption

public void removeOption(long customFieldId,
                         String optionLabel)
Description copied from interface: CustomCustomFieldManagerService
Will remove the from the custom-field's option list. If the option to remove is the default one, will throw a CannotDeleteDefaultOptionException

Specified by:
removeOption in interface CustomCustomFieldManagerService
Parameters:
customFieldId - : the id of the concerned SingleSelectField
optionLabel - : the label of the CustomFieldOption to remove.
See Also:
CustomCustomFieldManagerService.removeOption(long, String)

changeOptionsPositions

public void changeOptionsPositions(long customFieldId,
                                   int newIndex,
                                   List<String> optionsLabels)
Description copied from interface: CustomCustomFieldManagerService
Will change custom field's options positions.

Specified by:
changeOptionsPositions in interface CustomCustomFieldManagerService
Parameters:
customFieldId - : the id of the concerned CustomField.
newIndex - : the lowest index for the moved selection
optionsLabels - : the labels of the moved options
See Also:
CustomCustomFieldManagerService.changeOptionsPositions(long, int, List)

changeCode

public void changeCode(long customFieldId,
                       String code)
Description copied from interface: CustomCustomFieldManagerService
Will change the code of the custom field after having checked that : the code is unique among all custom fields, and that the code contains only letters (upper and lower cases), numbers or under-scores.

Specified by:
changeCode in interface CustomCustomFieldManagerService
Parameters:
customFieldId - : the id of the concerned CustomField
code - : the new code
See Also:
CustomCustomFieldManagerService.changeCode(long, String)


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