org.squashtest.tm.service.customfield
Interface CustomCustomFieldManagerService

All Known Subinterfaces:
CustomFieldManagerService
All Known Implementing Classes:
CustomCustomFieldManagerServiceImpl

@Transactional
@PreAuthorize(value="hasRole(\'ROLE_ADMIN\')")
public interface CustomCustomFieldManagerService

Custom-Field manager services which cannot be dynamically generated.

Author:
mpagnon

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.
 

Method Detail

deleteCustomField

void deleteCustomField(long customFieldId)
Will delete the custom-field entity

Parameters:
customFieldId - : the id of the custom field to delete

persist

void persist(@NotNull
             org.squashtest.tm.domain.customfield.CustomField newCustomField)
Will persist the given custom field.

Parameters:
newCustomField - : the custom field to persist

changeName

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.

Parameters:
customFieldId - the id of the concerned CustomField
newName - the CustomField potential new name

changeOptional

void changeOptional(Long customFieldId,
                    Boolean optional)
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.

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
Throws:
org.squashtest.tm.exception.customfield.DefaultValueRequiredException

changeOptionLabel

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.

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
Throws:
org.squashtest.tm.exception.customfield.OptionAlreadyExistException

changeOptionCode

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.

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
Throws:
CodeAlreadyExistException

addOption

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.

Parameters:
customFieldId - : the id of the concerned CustomField
option - : the new CustomFieldOption
Throws:
org.squashtest.tm.exception.customfield.OptionAlreadyExistException

removeOption

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

Parameters:
customFieldId - : the id of the concerned SingleSelectField
optionLabel - : the label of the CustomFieldOption to remove.
Throws:
org.squashtest.tm.exception.customfield.CannotDeleteDefaultOptionException

changeOptionsPositions

void changeOptionsPositions(long customFieldId,
                            int newIndex,
                            List<String> optionsLabels)
Will change custom field's options positions.

Parameters:
customFieldId - : the id of the concerned CustomField.
newIndex - : the lowest index for the moved selection
optionsLabels - : the labels of the moved options

findSortedCustomFields

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.

Parameters:
filter - the PagedCollectionHolder that holds order and paging params.
Returns:
the filtered collection of all custom field available in squash

findSingleSelectFieldById

org.squashtest.tm.domain.customfield.SingleSelectField findSingleSelectFieldById(Long customFieldId)
Will find the SingleSelectField of the given id

Parameters:
customFieldId - the id of the SingleSelectField
Returns:
the SingleSelectField or null

changeCode

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.

Parameters:
customFieldId - : the id of the concerned CustomField
code - : the new code


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