Coverage Report - org.kuali.rice.kew.attribute.XMLAttributeUtils
 
Classes in this File Line Coverage Branch Coverage Complexity
XMLAttributeUtils
0%
0/18
0%
0/8
3.5
 
 1  
 /*
 2  
  * Copyright 2009 The Kuali Foundation
 3  
  *
 4  
  * Licensed under the Educational Community License, Version 2.0 (the "License");
 5  
  * you may not use this file except in compliance with the License.
 6  
  * You may obtain a copy of the License at
 7  
  *
 8  
  * http://www.opensource.org/licenses/ecl2.php
 9  
  *
 10  
  * Unless required by applicable law or agreed to in writing, software
 11  
  * distributed under the License is distributed on an "AS IS" BASIS,
 12  
  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 13  
  * See the License for the specific language governing permissions and
 14  
  * limitations under the License.
 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  
  * This class provides some common shared utility methods shared by the XML-based
 27  
  * attribute implementations. 
 28  
  * 
 29  
  * @author Kuali Rice Team (rice.collab@kuali.org)
 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  
 }