public class CustomFieldHelper
extends java.lang.Object
| Modifier and Type | Field and Description |
|---|---|
static java.util.Comparator<ICustomFieldPossibleValue<?>> |
POSSIBLE_VALUES_COMPARATOR
Comparator for possible values (any ICustomFieldPossibleValue with a null value will be placed first in the
sorted result)
|
static java.lang.String |
VALUE_SEPARATOR
Separator used when multiple values are parsed from a String
|
| Constructor and Description |
|---|
CustomFieldHelper() |
| Modifier and Type | Method and Description |
|---|---|
static void |
fillNewFieldValue(CustomFieldDetailedVO field,
CustomFieldValueDTO customValue)
Fills-in a new custom field value instance for a new value on the given field.
|
static void |
fillNewFieldValue(UserCustomFieldDetailedVO field,
UserCustomFieldValueDTO customValue)
Same as
fillNewFieldValue(CustomFieldDetailedVO, CustomFieldValueDTO) but working with
UserCustomFieldDetailedVO |
static UserProfileFieldActions |
findActions(ProfileField profileField,
java.lang.Iterable<UserProfileFieldActions> actions)
Returns the actions collection for the given profile field
|
static <V extends ICustomFieldValue<?,?>> |
findValue(ICustomField field,
java.util.Collection<? extends V> values)
Finds a custom field value inside a collection
We assume that the values collection and the field passed are of the same entity, so we can unqualify both of
them
|
static CustomFieldValueDTO |
findValueOrNew(CustomFieldDetailedVO field,
java.util.Collection<CustomFieldValueDTO> customValues)
Finds a custom field value inside a collection.
|
static java.util.List<UserCustomFieldDetailedVO> |
getCustomFields(java.lang.Iterable<UserProfileFieldActions> actions)
Returns the custom fields in the given collection of actions
|
static java.lang.Object |
getCustomFieldValue(CustomFieldType type,
ICustomFieldValue value)
Returns the property used to retrieve the value of a field given it's type
|
static java.lang.Object |
getCustomFieldValue(ICustomFieldValue<?,?> value)
Returns the property used to retrieve the value of a field given it's type
|
static java.lang.Object |
getDefaultValue(CustomFieldDetailedVO field)
Returns the default value for the given field
|
static java.util.Collection<CustomFieldPossibleValueVO> |
getEnumeratedValues(ICustomFieldValue<?,?> fieldValue) |
static EntityVO |
getLinkedEntity(LinkedEntityVO vo)
Returns the specific
EntityVO associated with the given LinkedEntityVO, according to the
subclass. |
static ProfileField |
getProfileField(UserProfileFieldActions actions)
Returns the profile field for the given actions collection
|
static java.lang.String |
getReferenceValue(ICustomFieldValue<?,?> fieldValue) |
static java.lang.Object |
getValue(java.lang.Long customFieldId,
java.util.Collection<? extends ICustomFieldValue<?,?>> customValues)
Returns the value of a custom field from a collection, finding the value by internal name.
|
static java.lang.Object |
getValue(java.lang.String internalName,
java.util.Collection<? extends ICustomFieldValue<?,?>> customValues)
Returns the value of a custom field from a collection, finding the value by internal name.
|
static java.lang.Object |
getValue(UserWithFieldsVO user,
ProfileField profileField)
Returns a profile field value for a given
UserWithFieldsVO |
static java.util.List<?> |
getValuesList(CustomFieldDetailedVO field)
Returns the values list from a given custom field
|
static boolean |
hasAnyFieldWithInformation(java.util.Collection<?> fieldActions)
Returns whether at least one of the given fields (either field detailed or field actions)
have information text
|
static boolean |
hasValue(CustomFieldValueDTO fieldValue) |
static CustomFieldValueDTO |
newFieldValue(CustomFieldDetailedVO field)
Creates a new custom field value for the given field
|
static void |
qualifyInternalName(java.lang.String customFieldInternalName,
CustomFieldPossibleValueVO possibleValue)
Qualifies the internal name of the given possible value with the custom field internal name.
|
static void |
setCustomFieldValue(ICustomFieldValue<?,?> fieldValue,
java.lang.Object value)
Returns the property used to retrieve the value of a field given it's type
|
static boolean |
setValue(java.lang.String internalName,
java.util.Collection<? extends ICustomFieldValue<?,?>> customValues,
java.lang.Object value)
Sets the value of a custom field given the values collection, finding by field internal name
|
static java.util.Map<java.lang.String,ICustomField> |
toFieldsMap(java.util.Collection<? extends ICustomField> fields)
Returns a Map, keyed by the custom field's unqualified internal name , whose value is the custom field of the
received
collection.
|
static java.util.Map<ICustomField,ICustomFieldValue> |
toMap(java.util.Collection<? extends ICustomFieldValue> customValues)
Returns a Map, keyed by the custom field , whose values are the custom field values of the received collection.
|
static java.lang.String |
toReference(ICustomFieldValue<RawFileVO,ImageVO> fieldValue)
Converts a
ICustomFieldValue to a reference, that is, a string representation |
public static java.lang.String VALUE_SEPARATOR
public static java.util.Comparator<ICustomFieldPossibleValue<?>> POSSIBLE_VALUES_COMPARATOR
public static void fillNewFieldValue(CustomFieldDetailedVO field, CustomFieldValueDTO customValue)
CustomFieldValueDTO and newFieldValue(CustomFieldDetailedVO) is not enough. Sets the field
reference and the default value.public static void fillNewFieldValue(UserCustomFieldDetailedVO field, UserCustomFieldValueDTO customValue)
fillNewFieldValue(CustomFieldDetailedVO, CustomFieldValueDTO) but working with
UserCustomFieldDetailedVOpublic static UserProfileFieldActions findActions(ProfileField profileField, java.lang.Iterable<UserProfileFieldActions> actions)
public static <V extends ICustomFieldValue<?,?>> V findValue(ICustomField field, java.util.Collection<? extends V> values)
public static CustomFieldValueDTO findValueOrNew(CustomFieldDetailedVO field, java.util.Collection<CustomFieldValueDTO> customValues)
public static java.util.List<UserCustomFieldDetailedVO> getCustomFields(java.lang.Iterable<UserProfileFieldActions> actions)
public static java.lang.Object getCustomFieldValue(CustomFieldType type, ICustomFieldValue value)
public static java.lang.Object getCustomFieldValue(ICustomFieldValue<?,?> value)
public static java.lang.Object getDefaultValue(CustomFieldDetailedVO field)
public static java.util.Collection<CustomFieldPossibleValueVO> getEnumeratedValues(ICustomFieldValue<?,?> fieldValue)
public static EntityVO getLinkedEntity(LinkedEntityVO vo)
EntityVO associated with the given LinkedEntityVO, according to the
subclass.public static ProfileField getProfileField(UserProfileFieldActions actions)
public static java.lang.String getReferenceValue(ICustomFieldValue<?,?> fieldValue)
public static java.lang.Object getValue(java.lang.Long customFieldId,
java.util.Collection<? extends ICustomFieldValue<?,?>> customValues)
public static java.lang.Object getValue(java.lang.String internalName,
java.util.Collection<? extends ICustomFieldValue<?,?>> customValues)
public static java.lang.Object getValue(UserWithFieldsVO user, ProfileField profileField)
UserWithFieldsVOpublic static java.util.List<?> getValuesList(CustomFieldDetailedVO field)
public static boolean hasAnyFieldWithInformation(java.util.Collection<?> fieldActions)
public static boolean hasValue(CustomFieldValueDTO fieldValue)
public static CustomFieldValueDTO newFieldValue(CustomFieldDetailedVO field)
public static void qualifyInternalName(java.lang.String customFieldInternalName,
CustomFieldPossibleValueVO possibleValue)
public static void setCustomFieldValue(ICustomFieldValue<?,?> fieldValue, java.lang.Object value)
public static boolean setValue(java.lang.String internalName,
java.util.Collection<? extends ICustomFieldValue<?,?>> customValues,
java.lang.Object value)
public static java.util.Map<java.lang.String,ICustomField> toFieldsMap(java.util.Collection<? extends ICustomField> fields)
public static java.util.Map<ICustomField,ICustomFieldValue> toMap(java.util.Collection<? extends ICustomFieldValue> customValues)
public static java.lang.String toReference(ICustomFieldValue<RawFileVO,ImageVO> fieldValue)
ICustomFieldValue to a reference, that is, a string representation