1 | |
|
2 | |
|
3 | |
|
4 | |
|
5 | |
|
6 | |
|
7 | |
|
8 | |
|
9 | |
|
10 | |
|
11 | |
|
12 | |
|
13 | |
|
14 | |
|
15 | |
|
16 | |
package org.kuali.rice.kew.attribute; |
17 | |
|
18 | |
import org.kuali.rice.kns.web.ui.Field; |
19 | |
import org.w3c.dom.NamedNodeMap; |
20 | |
import org.w3c.dom.Node; |
21 | |
|
22 | |
import java.util.HashMap; |
23 | |
import java.util.Map; |
24 | |
|
25 | |
|
26 | |
|
27 | |
|
28 | |
|
29 | |
|
30 | |
|
31 | |
|
32 | |
public final class XMLAttributeUtils { |
33 | |
|
34 | 0 | private XMLAttributeUtils() { |
35 | 0 | throw new UnsupportedOperationException("do not call"); |
36 | |
} |
37 | |
|
38 | |
public static void establishFieldLookup(Field field, Node lookupNode) { |
39 | 0 | NamedNodeMap quickfinderAttributes = lookupNode.getAttributes(); |
40 | 0 | String businessObjectClass = quickfinderAttributes.getNamedItem("dataObjectClass").getNodeValue(); |
41 | 0 | field.setQuickFinderClassNameImpl(businessObjectClass); |
42 | 0 | for (int lcIndex = 0; lcIndex < lookupNode.getChildNodes().getLength(); lcIndex++) { |
43 | 0 | Map<String, String> fieldConversionsMap = new HashMap<String, String>(); |
44 | 0 | Node fieldConversionsChildNode = lookupNode.getChildNodes().item(lcIndex); |
45 | 0 | if ("fieldConversions".equals(fieldConversionsChildNode)) { |
46 | 0 | for (int fcIndex = 0; fcIndex < fieldConversionsChildNode.getChildNodes().getLength(); fcIndex++) { |
47 | 0 | Node fieldConversionChildNode = fieldConversionsChildNode.getChildNodes().item(fcIndex); |
48 | 0 | if ("fieldConversion".equals(fieldConversionChildNode)) { |
49 | 0 | NamedNodeMap fieldConversionAttributes = fieldConversionChildNode.getAttributes(); |
50 | 0 | String lookupFieldName = fieldConversionAttributes.getNamedItem("lookupFieldName").getNodeValue(); |
51 | 0 | String localFieldName = fieldConversionAttributes.getNamedItem("localFieldName").getNodeValue(); |
52 | 0 | fieldConversionsMap.put(lookupFieldName, localFieldName); |
53 | |
} |
54 | |
} |
55 | |
} |
56 | 0 | field.setFieldConversions(fieldConversionsMap); |
57 | |
} |
58 | 0 | } |
59 | |
|
60 | |
} |