本文整理匯總了Java中org.kuali.rice.kew.rule.bo.RuleAttribute.setXmlConfigData方法的典型用法代碼示例。如果您正苦於以下問題:Java RuleAttribute.setXmlConfigData方法的具體用法?Java RuleAttribute.setXmlConfigData怎麽用?Java RuleAttribute.setXmlConfigData使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類org.kuali.rice.kew.rule.bo.RuleAttribute
的用法示例。
在下文中一共展示了RuleAttribute.setXmlConfigData方法的2個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。
示例1: parseRuleAttribute
import org.kuali.rice.kew.rule.bo.RuleAttribute; //導入方法依賴的package包/類
private RuleAttribute parseRuleAttribute(Node ruleAttributeNode) throws XmlException {
String name = "";
String className = "";
String label = "";
String description = "";
String type = "";
String applicationId = null;
Node xmlConfig = null;
for (int i = 0; i < ruleAttributeNode.getChildNodes().getLength(); i++) {
Node childNode = ruleAttributeNode.getChildNodes().item(i);
if(NAME.equals(childNode.getNodeName())){
name = childNode.getFirstChild().getNodeValue();
} else if(CLASS_NAME.equals(childNode.getNodeName())){
className = childNode.getFirstChild().getNodeValue();
} else if(LABEL.equals(childNode.getNodeName())){
label = childNode.getFirstChild().getNodeValue();
} else if(DESCRIPTION.equals(childNode.getNodeName())){
description = childNode.getFirstChild().getNodeValue();
} else if(TYPE.equals(childNode.getNodeName())){
type = childNode.getFirstChild().getNodeValue();
} else if(XmlConstants.ROUTING_CONFIG.equals(childNode.getNodeName()) || XmlConstants.SEARCHING_CONFIG.equals(childNode.getNodeName()) ||
XmlConstants.SEARCH_RESULT_CONFIG.equals(childNode.getNodeName()) || XmlConstants.RESOLVER_CONFIG.equals(childNode.getNodeName()) ||
CONFIG.equals(childNode.getNodeName())){
xmlConfig = childNode;
} else if (XmlConstants.SERVICE_NAMESPACE.equals(childNode.getNodeName())) {
applicationId = childNode.getFirstChild().getNodeValue();
LOG.warn(XmlConstants.SERVICE_NAMESPACE + " element was set on rule attribute type XML but is deprecated and will be removed in a future version, please use " + APPLICATION_ID + " instead.");
} else if (XmlConstants.APPLICATION_ID.equals(childNode.getNodeName())) {
applicationId = childNode.getFirstChild().getNodeValue();
}
}
if (org.apache.commons.lang.StringUtils.isEmpty(name)) {
throw new XmlException("RuleAttribute must have a name");
}
if (org.apache.commons.lang.StringUtils.isEmpty(className)) {
throw new XmlException("RuleAttribute must have a className");
}
if (org.apache.commons.lang.StringUtils.isEmpty(label)) {
LOG.warn("Label empty defaulting to name");
label = name;
}
if (org.apache.commons.lang.StringUtils.isEmpty(type)) {
LOG.debug("No type specified, default to " + KewApiConstants.RULE_ATTRIBUTE_TYPE);
type = KewApiConstants.RULE_ATTRIBUTE_TYPE;
//throw new XmlException("RuleAttribute must have an attribute type");
}
type = type.trim();
validateRuleAttributeType(type);
RuleAttribute ruleAttribute = new RuleAttribute();
ruleAttribute.setName(name.trim());
ruleAttribute.setResourceDescriptor(className.trim());
ruleAttribute.setType(type.trim());
ruleAttribute.setLabel(label.trim());
// default description to label
if (StringUtils.isEmpty(description)) {
description = label;
}
ruleAttribute.setDescription(description.trim());
if (applicationId != null)
{
applicationId = applicationId.trim();
}
ruleAttribute.setApplicationId(applicationId);
if(xmlConfig != null){
ruleAttribute.setXmlConfigData(XmlJotter.jotNode(xmlConfig));
} else {
if(KewApiConstants.RULE_XML_ATTRIBUTE_TYPE.equals(type)){
throw new XmlException("A routing config must be present to be of type: "+type);
} else if(KewApiConstants.SEARCHABLE_XML_ATTRIBUTE_TYPE.equals(type)){
throw new XmlException("A searching config must be present to be of type: "+type);
}
}
return ruleAttribute;
}
示例2: testGetRuleRows
import org.kuali.rice.kew.rule.bo.RuleAttribute; //導入方法依賴的package包/類
@Test public void testGetRuleRows() {
assertTrue("Invalid number of rule rows", attribute.getRuleRows().size() == 5);
String routingConfigWithQuickfinders =
"<routingConfig>"+
"<globalEvaluations>" +
"<xpathexpression>//field/value != 'Nothing'</xpathexpression>" +
"</globalEvaluations>"+
"<fieldDef name=\"chart\" title=\"Chart\" workflowType=\"ALL\">"+
"<value>BL</value>"+
"<display>"+
"<type>text</type>"+
"<meta><name>size</name><value>20</value></meta>"+
"</display>" +
"<fieldEvaluation><xpathexpression>//xmlContent/field[@name='chart']/value = wf:ruledata('chart')</xpathexpression></fieldEvaluation>"+
"</fieldDef>"+
"<fieldDef name=\"org\" title=\"Org\" workflowType=\"ALL\">"+
"<display>"+
"<type>text</type>"+
"</display>" +
"<lookup businessObjectClass=\"ChartOrgLookupableImplService\">" +
"<fieldConversions>" +
"<fieldConversion lookupFieldName=\"fin_coa_cd\" localFieldName=\"chart\"/>" +
"<fieldConversion lookupFieldName=\"org_cd\" localFieldName=\"org\"/>" +
"</fieldConversions>" +
"</lookup>" +
"<fieldEvaluation><xpathexpression>//xmlContent/field[@name='gender']/value = wf:ruledata('gender')</xpathexpression></fieldEvaluation>"+
"</fieldDef>" +
"</routingConfig>";
RuleAttribute ruleAttribute = new RuleAttribute();
ruleAttribute.setXmlConfigData(routingConfigWithQuickfinders);
ruleAttribute.setName("MyUniqueRuleAttribute3");
ruleAttribute.setType("SearchableXmlAttribute");
ruleAttribute.setResourceDescriptor(StandardGenericXMLSearchableAttribute.class.getName());
StandardGenericXMLRuleAttribute myAttribute = new StandardGenericXMLRuleAttribute();
myAttribute.setExtensionDefinition(RuleAttribute.to(ruleAttribute));
for (Iterator iter = myAttribute.getRuleRows().iterator(); iter.hasNext();) {
Row row = (Row) iter.next();
for (Iterator iterator = row.getFields().iterator(); iterator.hasNext();) {
Field field = (Field) iterator.next();
if(field.getFieldType().equals(Field.QUICKFINDER)){
assertTrue("Did not find quickfinder.", true);
}
}
}
assertTrue("Should have 2 rows and 3 fields: chart, org, and quickfinder.", myAttribute.getRuleRows().size() == 2);
}