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 class XMLAttributeUtils {
33
34 public static void establishFieldLookup(Field field, Node lookupNode) {
35 NamedNodeMap quickfinderAttributes = lookupNode.getAttributes();
36 String businessObjectClass = quickfinderAttributes.getNamedItem("businessObjectClass").getNodeValue();
37 field.setQuickFinderClassNameImpl(businessObjectClass);
38 for (int lcIndex = 0; lcIndex < lookupNode.getChildNodes().getLength(); lcIndex++) {
39 Map<String, String> fieldConversionsMap = new HashMap<String, String>();
40 Node fieldConversionsChildNode = lookupNode.getChildNodes().item(lcIndex);
41 if ("fieldConversions".equals(fieldConversionsChildNode)) {
42 for (int fcIndex = 0; fcIndex < fieldConversionsChildNode.getChildNodes().getLength(); fcIndex++) {
43 Node fieldConversionChildNode = fieldConversionsChildNode.getChildNodes().item(fcIndex);
44 if ("fieldConversion".equals(fieldConversionChildNode)) {
45 NamedNodeMap fieldConversionAttributes = fieldConversionChildNode.getAttributes();
46 String lookupFieldName = fieldConversionAttributes.getNamedItem("lookupFieldName").getNodeValue();
47 String localFieldName = fieldConversionAttributes.getNamedItem("localFieldName").getNodeValue();
48 fieldConversionsMap.put(lookupFieldName, localFieldName);
49 }
50 }
51 }
52 field.setFieldConversions(fieldConversionsMap);
53 }
54 }
55
56 }