Table of Contents
Note that the code example is very inclusive to show the configurations that have changed. As a result the lookups themselve have conflicting settings (i.e. why have custom search buttons when hiding them).
KNS Code example:
1 <bean id="EntityType-lookupDefinition" parent="LookupDefinition"> 2 <property name="title" value="Entity Type Lookup"/> 3 <property name="menubar" value="<a href="javascript:void(0)" 4 onclick="alert('JavaScript triggered action.')">Custom Button</a>"/> 5 <property name="numOfColumns" value="2"/> 6 <property name="extraButtonSource" value="images/tinybutton-createnew.gif"/> 7 <property name="extraButtonParams" value="createNew"/> 8 <property name="disableSearchButtons" value="true"/> 9 <property name="lookupFields"> 10 <list> 11 <bean parent="FieldDefinition" p:attributeName="code" p:treadWildcardsAndOperatorsAsLiteral="true"/> 12 <bean parent="FieldDefinition" p:attributeName="name" p:noLookup="true" p:treadWildcardsAndOperatorsAsLiteral="true"/> 13 <bean parent="FieldDefinition" p:attributeName="active" p:defaultValue="Y"/> 14 </list> 15 </property> 16 <property name="resultFields"> 17 <list> 18 <bean parent="FieldDefinition" p:attributeName="code" p:triggerOnChange="true"/> 19 <bean parent="FieldDefinition" p:attributeName="name" p:noLookup="true"/> 20 <bean parent="FieldDefinition" p:attributeName="sortCode" p:forceInquiry="true"/> 21 <bean parent="FieldDefinition" p:attributeName="ammount" p:total="true"/> 22 <bean parent="FieldDefinition" p:attributeName="active"/> 23 </list> 24 </property> 25 <property name="defaultSort"> 26 <bean parent="SortDefinition"> 27 <property name="sortAscending" value="false" /> 28 <property name="attributeNames"> 29 <list> 30 <value>code</value> 31 </list> 32 </property> 33 </bean> 34 </property> 35 </bean>
KRAD code example:
1 <bean id="EntityTypeLookupView" parent="Uif-LookupView"> 2 <property name="dataObjectClassName" value="org.kuali.rice.kim.impl.identity.EntityTypeBo"/> 3 <property name="headerText" value="Entity Type Lookup" /> 4 <property name="page.header.lowerGroup.items"> 5 <list merge="true"> 6 <bean parent="Uif-SecondaryActionButton" p:actionLabel="Custom Button" 7 p:actionScript="alert('JavaScript triggered action.')"/> 8 </list> 9 </property> 10 <property name="renderLookupCriteria" value="false"/> 11 <property name="criteriaGroup.layoutManager.numberOfColumns" value="4"/> 12 <property name="criteriaGroup.footer"> 13 <bean parent="Uif-LookupCriteriaFooter"> 14 <property name="items"> 15 <list merge="true"> 16 <bean parent="Uif-PrimaryActionButton" p:methodToCall="createNew" p:actionLabel="create new"/> 17 </list> 18 </property> 19 </bean> 20 </property> 21 <property name="renderSearchButtons" value="false"/> 22 <property name="criteriaFields"> 23 <list> 24 <bean parent="Uif-LookupCriteriaInputField" p:propertyName="code" p:triggerOnChange="true"/> 25 <bean parent="Uif-LookupCriteriaInputField" p:propertyName="name" p:quickfinder.render="false" 26 p:disableWildcardsAndOperators="true"/> 27 <bean parent="Uif-LookupCriteriaInputField" p:propertyName="active" p:defaultValue="Y"/> 28 </list> 29 </property> 30 <property name="resultFields"> 31 <list> 32 <bean parent="Uif-DataField" p:propertyName="code"/> 33 <bean parent="Uif-DataField" p:propertyName="name"/> 34 <bean parent="Uif-DataField" p:propertyName="sortCode"/> 35 <bean parent="Uif-DataField" p:propertyName="ammount"/> 36 <bean parent="Uif-DataField" p:propertyName="active"/> 37 </list> 38 </property> 39 <property name="defaultSortAscending" value="false"/> 40 <property name="defaultSortAttributeNames"> 41 <list> 42 <value>code</value> 43 </list> 44 </property> 45 <property name="resultsGroup.layoutManager.columnCalculations"> 46 <list> 47 <bean parent="Uif-ColumnCalculationInfo-Sum" p:propertyName="ammount" /> 48 </list> 49 </property> 50 </bean>
Lookups are now defined via Uif-LookupView definitions
instead of the KNS LookupDefinition
beans. [KNS line: 1, KRAD line: 1]
The title of the view is specified via the headerText
property instead of the title
property. [KNS line: 2, KRAD line: 3]
The data object class is specified via the dataObjectClassName property and is no longer specified
via the BusinessObjectEntry as it
doesn't exist in KRAD anymore. A businessObject is no longer required and any object can
be used. [KNS line: n/a, KRAD line: 2]
Instead of specifying the supplemental menu bar via the menubar property, the page.header.lowerGroup.items property is
used. [KNS line: 3-4, KRAD line: 4-9]
The property that contains the lookup criteria fields was renamed from lookupFields to criteriaFields. [KNS line: 9, KRAD line: 22]
Criteria fields changed from FieldDefinition to Uif-LookupCriteriaInput. [KNS line: 11-13,
KRAD line: 24-26]
The attributeName property on the
field is now a propertyName
property. [KNS line: 11-13, KRAD line: 24-26]
Not rendering a quickfinder on a lookup criteria field is specified
via thequickfinder.render property
instead of the noLookup property.
[KNS line: 12, KRAD line 25]
Adding additional buttons to the bottom of the search criterias is
done by adding a Uif-PrimaryActionButton to the criteriaGroup.footer item list instead of using the
extraButtonSource and extraButtonParms properties. [KNS line:
6-7, KRAD line: 12-20]
The property that specifies wether or not to show the search buttons
changed from disableSearchButtons to
renderSearchButtons. [KNS line:
8, KRAD line: 21]
The rendering of search criterias was suppressed in KNS by adding the
searchCriteriaEnabled=false
parameter to the URL. In KRAD the URL parameter is renamed to renderLookupCriteria. Alternatively the
renderLookupCriteria can be set
on the Uif-LookupView. [KNS line: n/a, KRAD line: 10]
To use multiple columns for the criteria fields use the criteriaGroup.layoutManager.numberOfColumns property to
configure the layout manager instead of specifying the numOfColumns property. Note that in the
layout manager the field label and the field itself have their own
columns and therefore the old numOfColumns value needs to be doubled. [KNS line: 5,
KRAD line: 11]
The treatWildcardsAndOperatorsAsLiteral property of
FieldDefinition changed to
disableWildcardsAndOperators on
Uif-LookupCriteriaInputField.
[KNS line: 13, KRAD line: 26]
Criteria fields changed from FieldDefinition to Uif-DataField. [KNS line: 18-21, KRAD line: 30-33]
The attributeName property on the
field is now a propertyName
property. [KNS line: 18-21, KRAD line: 30-33]
The forceInquiry property does not
need to be set as inquiry links are rendered automatically. Set the
inquiry.render property on the
Uif-DataField to false to
supress the rendering of the inquiry link. [KNS line: 20, KRAD line:
n/a]
Custom actions in the result rows are no longer specified by
overriding the getCustomActionUrls
method of LookupableHelperService.
Instead the resultsGroup.lineActions
property list is extended or overridden.
Look
in UifLookupDefinition.xml to see
how the edit, copy and delete actions are defined.
The SortDefinition bean with the
sortAscending and attributeName properties has been
replaced. The sort order is specified via the defaultSortAscending property and the sort fields via
the defaultSortAttributeName
property list on the Uif-Lookup-View. [KNS line: 24-33, KRAD line: 36-43]
Column totaling is now specified with the Uif-ColumnCalculationInfo-Sum property on the layout
manager instead via the total
property on the field definition. [KNS line: , KRAD line: ]
The system and application wide configuration for the lookup resultset
set limit uses now KR-KRAD as the namespace instead of KR-NS.
SELECT * FROM KRCR_PARM_T
WHERE NMSPC_CD = 'KR-KRAD'
AND CMPNT_CD = 'Lookup'
AND PARM_NM = 'RESULTS_LIMIT'
The system and application wide configuration for lookup page size
limit uses now KR-KRAD as the namespace instead of KR-NS.
SELECT * FROM KRCR_PARM_T
WHERE NMSPC_CD = 'KR-KRAD'
AND CMPNT_CD = 'Lookup'
AND PARM_NM = 'MULTIPLE_VALUE_RESULTS_PER_PAGE'
The system and application wide configuration for lookup page size
limit uses now KR-KRAD as the namespace instead of KR-NS.
KNS example:
SELECT * FROM KRCR_PARM_T
WHERE NMSPC_CD = 'KR-NS'
AND CMPNT_CD = 'Lookup'
AND PARM_NM = 'RESULTS_DEFAULT_MAX_COLUMN_LENGTH'
KRAD example:
1 <bean id="Uif-TextControl" parent="Uif-TextControl-parentBean"/>
2 <bean id="Uif-TextControl-parentBean" abstract="true" class="org.kuali.rice.krad.uif.control.TextControl"
3 scope="prototype" parent="Uif-ControlBase">
4 <property name="template" value="/krad/WEB-INF/ftl/components/control/text.ftl"/>
5 <property name="templateName" value="uif_text"/>
6 <property name="cssClasses">
7 <list merge="true">
8 <value>uif-textControl</value>
9 </list>
10 </property>
11 <property name="size" value="30"/>
12 </bean>
KRAD combines the Lookupable and LookupableHelperService from KNS. The LookupableImpl does not need to be extended unless advanced customizations are required.
set/getBusinessObjectClasshave been renamed to set/getDataObjectClass. Since now all data objects are supported the requirement that the object is a BusinessObject has been removed. The rename of these methods reflect this change. However, don't use this method. In KRAD the data object is be specified via the dataObjectClassName property of the extended Uif-LookupView bean.
1 <bean id="Sample-LookupView" parent="Uif-LookupView"> 2 <property name="dataObjectClassName" value="org.kuali.rice.SampleBo" /> 3 ... 4 </bean>
getHtmlMenuBar/getSupplementalMenuBarhave been removed. Instead these menu bars are configred via Uif. The HtmlMenuBar used to add additional HTML content to the right of the "Create New" button, while the SupplementalMenuBar replaces the "Create New" button with the specified HTML content. Note that with KRAD the "Create New" has been moved out of the lookup header area and instead is right below the header, still at the right side. The following sample displays how to add content after the "Create New". In this example a Message is used but any Uif component could be used. Append a custom button after the "Create New":
1 <bean id="Sample-LookupView" parent="Uif-LookupView"> 2 ... 3 <property name="page.header.lowerGroup.items"> 4 <list> 5 <bean parent="Uif-CreateNewLink" /> 6 <bean parent="Uif-SecondaryActionButton" p:actionLabel="Custom Button" 7 p:actionScript="alert('JavaScript triggered action.')"/> 8 </list> 9 </property> 10 ... 11 </bean>
Append a custom message to the right in the header
1 <bean id="Sample-LookupView" parent="Uif-LookupView"> 2 ... 3 <property name="header.rightGroup"> 4 <bean parent="Uif-HeaderRightGroup"> 5 <property name="items"> 6 <list> 7 <bean parent="Uif-Message" p:messageText="Right Group of headerText"/> 8 </list> 9 </property 10 </bean> 11 </property> 12 ... 13 </bean>
Instead of "rightGroup", "upperGroup" and "lowerGroup" can be used to position components above and below the header.
getRows has been removed. Criteria fields can be conditionally displayed and configured via Uif.
getColumns has been removed. The result columns are now specified via the Uif-LookupView (see resultFields property).
1 <bean id="Sample-LookupView" parent="Uif-LookupView"> 2 ... 3 <property name="resultFields"> 4 <list> 5 <bean parent="Uif-DataField" p:propertyName="cd" /> 6 <bean parent="Uif-DataField" p:propertyName="description" /> 7 </list> 8 </property> 9 ... 10 </bean>
validateSearchParameters takes the LookupForm as an additional parameter and returns a boolean value indicating that no validation error message has occurred (true = no error). Warning and informational messages do not affect this return indicator. A ValidationException is no longer thrown. Try using Uif configurations for more complex validation that the default KRAD validation can't handle (e.g. Constraints)
performLookup has been renamed to performSearch. The resultTable parameter has been removed and takes searchCriteria as an additional parameter.
getSearchResults takes the LookupForm and indicator for bounded/unbounded search as additional parameters. getSearchResultsUnbounded has been removed.
performClear takes the searchCriteria map as an additional parameter since it is no longer stored in the Lookupable. The searchCriteria map is returned after clearing the criteria and setting their default values.
getReturnUrl has been renamed to getReturnUrlForResults which accepts the LinkField that returns the result from the lookup and the model. Configuration via the Uif-LookupView is also possible:
1 <bean id="Sample-LookupView" parent="Uif-LookupView"> 2 ... 3 <property name="resultsReturnField"> 4 <bean parent="Uif-linkField" p:href="http://www.kuali.org" p:linkText="Kuali"/> 5 </property> 6 ... 7 </bean>
getCreateNewUrl has been removed. The create new url is now specified via the Uif-LookupView:
1 <bean id="Sample-LookupView" parent="Uif-LookupView"> 2 ... 3 <property name="page.header.lowerGroup.items"> 4 <list> 5 <bean parent="Uif-Link" p:linkText="Create New" p:href="http://www.kuali.org"> 6 <property name="cssClasses"> 7 <list merge="true"> 8 <value>uif-createNewLink</value> 9 </list> 10 </property> 11 </bean> 12 </list> 13 </property> 14 ... 15 </bean>
getTitle has been removed. The title is now specified via the Uif-LookupView (see headerText property).
1 <bean id="Sample-LookupView" parent="Uif-LookupView"> 2 <property name="headerText" value="Sample Lookup" /> 3 ... 4 </bean>
getReturnKeys takes the LookupView, LookupForm and the data object as an additional parameter.
getReturnLocation has been removed. The return location is now stored on the form. Use LookupForm.getReturnLocation.
getExtraButtonSource has been removed. Buttons are configured via Uif-LookupCriteriaGroup (see footer property).
getExtraButtonParams has been removed. Buttons are configured via Uif-LookupCriteriaGroup (see footer property).
checkForAdditionalFields has been removed. Use progressive disclosure of the Uif.
getDefaultSortColumns has been removed. Sort columns are configured via Uif-LookupView (see defaultSortAttributeNames property).
1 <bean id="Sample-LookupView" parent="Uif-LookupView"> 2 ... 3 <property name="defaultSortAttributeNames"> 4 <list> 5 <value>cd</value> 6 <value>description</value> 7 </list> 8 </property> 9 ... 10 </bean> 11
set/getDocFormKey has been removed. The document form key is stored on the form. Use LookupForm.getFormKey.
setFieldConversions has been removed. The field conversion is specified via Uif (see quickfinder.fieldConversions property).
1 <bean parent="Uif-InputField"> 2 ... 3 <property name="quickfinder.fieldConversions"> 4 <map> 5 <entry key="cd" value="sampleCd" /> 6 <entry key="description" value="sample.description" /> 7 </map> 8 </property> 9 ... 10 </bean>
setReadOnlyFieldsList has been removed. Read only criteria fields are specified via Uif (see readOnly property).
1 <bean id="Sample-LookupView" parent="Uif-LookupView"> 2 ... 3 <property name="criteriaFields"> 4 <list> 5 <bean parent="Uif-LookupCriteriaInputField" p:propertyName="namespace" 6 p:readOnly="true" /> 7 <bean parent="Uif-LookupCriteriaInputField" p:propertyName="cd" /> 8 </list> 9 </property> 10 ... 11 </bean>
set/getLookupableHelperService has been removed. Lookupable helper services are specified via Uif-LookupView:
1 <bean id="Sample-LookupView" parent="Uif-LookupView"> 2 <property name="viewHelperServiceClass" 3 value="org.kuali.rice.SampleLookupableHelperServiceImpl" /> 4 ... 5 </bean>
isSearchUsingOnlyPrimaryKeyValues has been removed.
getPrimaryKeyFieldLabels has been removed.
shouldDisplayHeaderNonMaintActions has been removed.
shouldDisplayLookupCriteria has been removed.
performCustomAction has been removed. Create methodToCall methods for the actions in the controller for the data object.
getExtraField has been removed (see getHtmlMenuBar/getSupplementalMenuBar above).
get/setExtraOnLoad has been removed. OnLoad scripts can be specified via the Uif-LookupView:
1 <bean id="Sample-LookupView" parent="Uif-LookupView"> 2 <property name="onLoadScript" value="alert('Hi!')" /> 3 ... 4 </bean>
applyFieldAuthorizationsFromNestedLookups has been removed.
applyConditionalLogicForFieldDisplay has been removed. Conditional displaying of criteria field is done through Uif configuration.
1 <bean id="Sample-LookupView" parent="Uif-LookupView"> 2 ... 3 <property name="criteriaFields"> 4 <list> 5 <bean parent="Uif-LookupCriteriaInputField" p:propertyName="cd" 6 p:readOnly="@{!#empty(#dp.lookupCriteria['cd'])}" /> 7 <bean parent="Uif-DataField" p:propertyName="description" 8 p:required="@{#dp.lookupCriteria['CD'] == 'A_CD'}" /> 9 <bean parent="Uif-LookupCriteriaInputField" p:propertyName="namespace" 10 p:render="@{#dp.lookupCriteria['CD'] == 'A_CD'}" /> 11 </list> 12 </property> 13 ... 14 </bean> 15
The functionality of LookupableHelper can now be found in the LookupableImpl class.
The method allowsMaintenanceNewOrCopyAction, allowsMaintenanceEditAction, and allowsMaintenanceDeleteAction remain the same.
The functionality of getActionUrl and getMaintenanceUrl is handled by getMaintenanceActionLink.
The method getSearchResults now accepts the form, search criteria and the unbounded indicator.
The overrideLookupClass and
overrideFieldConversions don't
exist in KRAD since the quickfinder can be directly configured via the
quickfinder.dataObjectClassName
and quickfinder.fieldConversions
properties
KNS code example:
1 <bean parent="MaintainableFieldDefinition" p:name="entityTypeCode"/> 2 <property name="overrideLookupClass" value="org.kuali.rice.kim.impl.identity.EntityTypeBo"/> 3 <property name="overrideFieldConversions"> 4 <map> 5 <entry key="code" value="entityTypeCode"/> 6 </map> 7 </property> 8 </bean>
KRAD code example:
1 <bean parent="Uif-InputField" p:propertyName="entityTypeCode"> 2 <property name="quickfinder.dataObjectClassName" value="org.kuali.rice.kim.impl.identity.EntityTypeBo"/> 3 <property name="quickfinder.fieldConversions"> 4 <map> 5 <entry key="code" value="entityTypeCode"/> 6 </map> 7 </property> 8 </bean>
KNS to KRAD conversion is setup into four steps:
Convert data dictionary into krad compliant format
Convert validation patterns to constraint |
Convert control definitions into uif controls |
Convert KNS definitions into KRAD UIF components
Convert inquiry and lookup definitions into view |
Convert section definition into uif groups |
Convert field definitions into uif input fields |
Convert struts to spring mvc
Convert struts and their actions into uif controllers |
Convert action paths into request mapping annotations in the controller |
Convert jsp and tags into uif components
Convert jsp tags into UIF components |
Convert jstl calls into spring el conditionals |
Convert document into view |
Convert kul:tabs into UIF disclosure |
Convert html tables into grid layouts |
Convert attributes/control tags into UIF input fields |
Convert image submit tags into action buttons |
The existing script for KRAD conversion is included in KRADConversion.groovy. The script will process lookup, inquiry, and MaintenanceDocumentEntries into KRAD-compliant XML files.