本文整理汇总了Java中org.kuali.rice.kew.attribute.XMLAttributeUtils类的典型用法代码示例。如果您正苦于以下问题:Java XMLAttributeUtils类的具体用法?Java XMLAttributeUtils怎么用?Java XMLAttributeUtils使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
XMLAttributeUtils类属于org.kuali.rice.kew.attribute包,在下文中一共展示了XMLAttributeUtils类的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: getRows
import org.kuali.rice.kew.attribute.XMLAttributeUtils; //导入依赖的package包/类
private List<Row> getRows(Element root, String[] types) {
List<Row> rows = new ArrayList<Row>();
XPath xpath = XPathHelper.newXPath();
NodeList fieldNodeList;
try {
fieldNodeList = getFields(xpath, root, types);
} catch (XPathExpressionException e) {
LOG.error("Error evaluating fields expression");
return rows;
}
if (fieldNodeList != null) {
for (int i = 0; i < fieldNodeList.getLength(); i++) {
Node field = fieldNodeList.item(i);
NamedNodeMap fieldAttributes = field.getAttributes();
List<Field> fields = new ArrayList<Field>();
Field myField = new Field(fieldAttributes.getNamedItem("title").getNodeValue(), "", "", false, fieldAttributes.getNamedItem("name").getNodeValue(), "", false, false, null, "");
String quickfinderService = null;
for (int j = 0; j < field.getChildNodes().getLength(); j++) {
Node childNode = field.getChildNodes().item(j);
if ("value".equals(childNode.getNodeName())) {
myField.setPropertyValue(childNode.getFirstChild().getNodeValue());
} else if ("display".equals(childNode.getNodeName())) {
List<KeyValue> options = new ArrayList<KeyValue>();
List<String> selectedOptions = new ArrayList<String>();
for (int k = 0; k < childNode.getChildNodes().getLength(); k++) {
Node displayChildNode = childNode.getChildNodes().item(k);
if ("type".equals(displayChildNode.getNodeName())) {
myField.setFieldType(convertTypeToFieldType(displayChildNode.getFirstChild().getNodeValue()));
} else if ("meta".equals(displayChildNode.getNodeName())) {
// i don't think the rule creation support things in this node.
// i don't think the flex Routing report supports things in this node.
} else if ("values".equals(displayChildNode.getNodeName())) {
NamedNodeMap valuesAttributes = displayChildNode.getAttributes();
String optionValue = "";
// if element is empty then child will be null
Node firstChild = displayChildNode.getFirstChild();
if (firstChild != null) {
optionValue = firstChild.getNodeValue();
}
if (valuesAttributes.getNamedItem("selected") != null) {
selectedOptions.add(optionValue);
}
String title = "";
Node titleAttribute = valuesAttributes.getNamedItem("title");
if (titleAttribute != null) {
title = titleAttribute.getNodeValue();
}
options.add(new ConcreteKeyValue(optionValue, title));
}
}
if (!options.isEmpty()) {
myField.setFieldValidValues(options);
if (!selectedOptions.isEmpty()) {
//if (Field.MULTI_VALUE_FIELD_TYPES.contains(myField.getFieldType())) {
// String[] newSelectedOptions = new String[selectedOptions.size()];
// int k = 0;
// for (Iterator iter = selectedOptions.iterator(); iter.hasNext();) {
// String option = (String) iter.next();
// newSelectedOptions[k] = option;
// k++;
// }
// myField.setPropertyValues(newSelectedOptions);
//} else {
//
myField.setPropertyValue((String)selectedOptions.get(0));
//}
}
}
} else if ("lookup".equals(childNode.getNodeName())) {
XMLAttributeUtils.establishFieldLookup(myField, childNode);
}
}
fields.add(myField);
rows.add(new Row(fields));
}
}
return rows;
}