|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object org.kuali.rice.kns.util.FieldUtils
public final class FieldUtils
This class is used to build Field objects from underlying data dictionary and general utility methods for handling fields.
Method Summary | |
---|---|
static void |
applyAuthorization(Field field,
String maintenanceAction,
MaintenanceDocumentRestrictions auths,
String documentStatus,
String documentInitiatorPrincipalId)
|
static Column |
constructColumnFromAttributeField(RemotableAttributeField attributeField)
|
static List<Column> |
constructColumnsFromAttributeFields(List<RemotableAttributeField> attributeFields)
|
static Field |
constructContainerField(String name,
String label,
List fields)
Wraps list of fields into a Field of type CONTAINER |
static Field |
constructContainerField(String name,
String label,
List fields,
int numberOfColumns)
Wraps list of fields into a Field of type CONTAINER and arrange them into multiple columns. |
static RemotableAttributeField |
convertFieldToAttributeField(Field field)
|
static List<Field> |
convertRemotableAttributeField(RemotableAttributeField remotableAttributeField)
|
static List<Row> |
convertRemotableAttributeFields(List<RemotableAttributeField> remotableAttributeFields)
|
static List<RemotableAttributeField> |
convertRowsToAttributeFields(List<Row> rows)
|
static List<RemotableAttributeField> |
convertRowToAttributeFields(Row row)
|
static List<Field> |
createAndPopulateFieldsForLookup(List<String> lookupFieldAttributeList,
List<String> readOnlyFieldsList,
Class businessObjectClass)
|
static Field |
createRangeDateField(Field field)
creates an extra field for date from/to ranges |
static Field |
fixFieldForForm(Field field,
List keyFieldNames,
String namePrefix,
String maintenanceAction,
boolean readOnly,
MaintenanceDocumentRestrictions auths,
String documentStatus,
String documentInitiatorPrincipalId)
Does prefixing and read only settings of a Field UI for display in a maintenance document. |
static Formatter |
getFormatterForDataType(DataType dataType)
|
static Field |
getPropertyField(Class businessObjectClass,
String attributeName,
boolean convertForLookup)
Builds up a Field object based on the propertyName and business object class. |
static boolean |
isCollectionMultipleLookupEnabled(MaintainableCollectionDefinition definition)
Returns whether the passed in collection has been properly configured in the maint doc dictionary to support multiple value lookups. |
protected static boolean |
isLookupFieldLevelHelpDisabled(Class businessObjectClass,
String attributeName)
Determines whether field level help is disabled for the field corresponding to the dataObjectClass and attribute name If this value is true and isLookupFieldLevelHelpEnabled(Class, String) returns false,
then the field level help will not be rendered. |
protected static boolean |
isLookupFieldLevelHelpEnabled(Class businessObjectClass,
String attributeName)
Determines whether field level help is enabled for the field corresponding to the dataObjectClass and attribute name If this value is true, then the field level help will be enabled. |
static List |
meshFields(List oldFields,
List newFields,
List keyFieldNames,
String maintenanceAction,
boolean readOnly,
MaintenanceDocumentRestrictions auths,
String documentStatus,
String documentInitiatorPrincipalId)
Merges together fields and an old maintainble row and new maintainable row, for each field call fixFieldForForm. |
static List |
meshRows(List oldRows,
List newRows,
List keyFieldNames,
String maintenanceAction,
boolean readOnly,
MaintenanceDocumentRestrictions auths,
String documentStatus,
String documentInitiatorPrincipalId)
Merges together rows of an old maintainable section and new maintainable section. |
static List |
meshSections(List oldSections,
List newSections,
List keyFieldNames,
String maintenanceAction,
boolean readOnly,
MaintenanceDocumentRestrictions auths,
String documentStatus,
String documentInitiatorPrincipalId)
Merges together sections of the old maintainable and new maintainable. |
static void |
modifyFieldToSupportMultipleValueLookups(Field field,
String parents,
MaintainableCollectionDefinition definition)
This method modifies the passed in field so that it may be used to render a multiple values lookup button |
static Map |
populateBusinessObjectFromMap(BusinessObject bo,
Map fieldValues)
Uses reflection to get the property names of the business object, then checks for the property name as a key in the passed map. |
static Map |
populateBusinessObjectFromMap(BusinessObject bo,
Map<String,?> fieldValues,
String propertyNamePrefix)
Uses reflection to get the property names of the business object, then checks for the property name as a key in the passed map. |
static List<Field> |
populateFieldsFromBusinessObject(List<Field> fields,
BusinessObject bo)
Uses reflection to get the property names of the business object, then checks for a matching field property name. |
static void |
populateReadableField(Field field,
BusinessObject businessObject)
|
static void |
populateSecureField(Field field,
Object fieldValue)
|
static String |
scrubWhitespace(String s)
This method removes any duplicating spacing (internal or on the ends) from a String, meant to be exposed as a tag library function. |
static void |
setAdditionalDisplayPropertyForCodes(Class businessObjectClass,
String attributeName,
PropertyRenderingConfigElement field)
For attributes that are codes (determined by whether they have a reference to a KualiCode bo and similar naming) sets the name as an additional display property |
static void |
setFieldControl(Class businessObjectClass,
String attributeName,
boolean convertForLookup,
Field field)
Sets the control on the field based on the data dictionary definition |
static void |
setInquiryURL(Field field,
BusinessObject bo,
String propertyName)
|
static List |
wrapFields(List fields)
Wraps each Field in the list into a Row. |
static List<Row> |
wrapFields(List<Field> fields,
int numberOfColumns)
This method is to implement multiple columns where the numberOfColumns is obtained from data dictionary. |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Method Detail |
---|
public static void setInquiryURL(Field field, BusinessObject bo, String propertyName)
public static void setFieldControl(Class businessObjectClass, String attributeName, boolean convertForLookup, Field field)
businessObjectClass
- - business object class for the field attributeattributeName
- - name of the attribute whose Field
is being setconvertForLookup
- - whether the field is being build for lookup search which impacts the control chosenfield
- - Field
to set control onpublic static Field getPropertyField(Class businessObjectClass, String attributeName, boolean convertForLookup)
public static void setAdditionalDisplayPropertyForCodes(Class businessObjectClass, String attributeName, PropertyRenderingConfigElement field)
businessObjectClass
- -
class containing attributeattributeName
- -
name of attribute in the business objectfield
- -
property display elementpublic static List wrapFields(List fields)
fields
-
public static List<Row> wrapFields(List<Field> fields, int numberOfColumns)
fields
- numberOfColumns
-
public static Field constructContainerField(String name, String label, List fields)
name
- name for the fieldlabel
- label for the fieldfields
- list of fields that should be contained in the container
public static Field constructContainerField(String name, String label, List fields, int numberOfColumns)
name
- name for the fieldlabel
- label for the fieldfields
- list of fields that should be contained in the containernumberOfColumns
- the number of columns for each row that the fields should be arranged into
public static List<Field> populateFieldsFromBusinessObject(List<Field> fields, BusinessObject bo)
fields
- list of Field object to populatebo
- business object to get field values from
public static void populateReadableField(Field field, BusinessObject businessObject)
public static void populateSecureField(Field field, Object fieldValue)
public static Map populateBusinessObjectFromMap(BusinessObject bo, Map fieldValues)
bo
- fieldValues
-
public static Map populateBusinessObjectFromMap(BusinessObject bo, Map<String,?> fieldValues, String propertyNamePrefix)
bo
- fieldValues
- propertyNamePrefix
- this value will be prepended to all property names in the returned unformattable values map
public static Field fixFieldForForm(Field field, List keyFieldNames, String namePrefix, String maintenanceAction, boolean readOnly, MaintenanceDocumentRestrictions auths, String documentStatus, String documentInitiatorPrincipalId)
field
- - the Field object to be displayedkeyFieldNames
- - Primary key property names for the business object being maintained.namePrefix
- - String to prefix Field names with.maintenanceAction
- - The maintenance action requested.readOnly
- - Indicates whether all fields should be read only.
public static void applyAuthorization(Field field, String maintenanceAction, MaintenanceDocumentRestrictions auths, String documentStatus, String documentInitiatorPrincipalId)
public static List meshSections(List oldSections, List newSections, List keyFieldNames, String maintenanceAction, boolean readOnly, MaintenanceDocumentRestrictions auths, String documentStatus, String documentInitiatorPrincipalId)
oldSections
- newSections
- keyFieldNames
- maintenanceAction
- readOnly
-
public static List meshRows(List oldRows, List newRows, List keyFieldNames, String maintenanceAction, boolean readOnly, MaintenanceDocumentRestrictions auths, String documentStatus, String documentInitiatorPrincipalId)
oldRows
- newRows
- keyFieldNames
- maintenanceAction
- readOnly
-
public static List meshFields(List oldFields, List newFields, List keyFieldNames, String maintenanceAction, boolean readOnly, MaintenanceDocumentRestrictions auths, String documentStatus, String documentInitiatorPrincipalId)
oldFields
- newFields
- keyFieldNames
- maintenanceAction
- readOnly
-
protected static boolean isLookupFieldLevelHelpEnabled(Class businessObjectClass, String attributeName)
isLookupFieldLevelHelpDisabled(Class, String)
and the system-wide
parameter setting. Note that if a field is read-only, that may cause field-level help to not be rendered.
businessObjectClass
- the looked up classattributeName
- the attribute for the field
protected static boolean isLookupFieldLevelHelpDisabled(Class businessObjectClass, String attributeName)
isLookupFieldLevelHelpEnabled(Class, String)
returns false,
then the field level help will not be rendered. If both this and isLookupFieldLevelHelpEnabled(Class, String)
return false, then the system-wide
setting will determine whether field level help is enabled. Note that if a field is read-only, that may cause field-level help to not be rendered.
businessObjectClass
- the looked up classattributeName
- the attribute for the field
public static List<Field> createAndPopulateFieldsForLookup(List<String> lookupFieldAttributeList, List<String> readOnlyFieldsList, Class businessObjectClass) throws InstantiationException, IllegalAccessException
InstantiationException
IllegalAccessException
public static Field createRangeDateField(Field field)
field
-
public static final void modifyFieldToSupportMultipleValueLookups(Field field, String parents, MaintainableCollectionDefinition definition)
field
- this object will be modified by this methodparents
- definition
- public static final boolean isCollectionMultipleLookupEnabled(MaintainableCollectionDefinition definition)
definition
-
public static String scrubWhitespace(String s)
s
- String to remove duplicate spacing from.
public static List<Row> convertRemotableAttributeFields(List<RemotableAttributeField> remotableAttributeFields)
public static List<Field> convertRemotableAttributeField(RemotableAttributeField remotableAttributeField)
public static List<RemotableAttributeField> convertRowsToAttributeFields(List<Row> rows)
public static List<RemotableAttributeField> convertRowToAttributeFields(Row row)
public static RemotableAttributeField convertFieldToAttributeField(Field field)
public static Column constructColumnFromAttributeField(RemotableAttributeField attributeField)
public static List<Column> constructColumnsFromAttributeFields(List<RemotableAttributeField> attributeFields)
public static Formatter getFormatterForDataType(DataType dataType)
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |