本文整理汇总了Java中org.kuali.rice.kew.rule.bo.RuleAttribute.setResourceDescriptor方法的典型用法代码示例。如果您正苦于以下问题:Java RuleAttribute.setResourceDescriptor方法的具体用法?Java RuleAttribute.setResourceDescriptor怎么用?Java RuleAttribute.setResourceDescriptor使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类org.kuali.rice.kew.rule.bo.RuleAttribute
的用法示例。
在下文中一共展示了RuleAttribute.setResourceDescriptor方法的6个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: validate
import org.kuali.rice.kew.rule.bo.RuleAttribute; //导入方法依赖的package包/类
private void validate(RuleAttribute ruleAttribute) {
LOG.debug("validating ruleAttribute");
Collection errors = new ArrayList();
if (ruleAttribute.getName() == null || ruleAttribute.getName().trim().equals("")) {
errors.add(new WorkflowServiceErrorImpl("Please enter a rule attribute name.", RULE_ATTRIBUTE_NAME_REQUIRED));
LOG.error("Rule attribute name is missing");
} else {
ruleAttribute.setName(ruleAttribute.getName().trim());
if (ruleAttribute.getId() == null) {
RuleAttribute nameInUse = findByName(ruleAttribute.getName());
if (nameInUse != null) {
errors.add(new WorkflowServiceErrorImpl("Rule attribute name already in use", "routetemplate.ruleattribute.name.duplicate"));
LOG.error("Rule attribute name already in use");
}
}
}
if (ruleAttribute.getResourceDescriptor() == null || ruleAttribute.getResourceDescriptor().trim().equals("")) {
errors.add(new WorkflowServiceErrorImpl("Please enter a rule attribute class name.", RULE_ATTRIBUTE_CLASS_REQUIRED));
LOG.error("Rule attribute class name is missing");
} else {
ruleAttribute.setResourceDescriptor(ruleAttribute.getResourceDescriptor().trim());
}
LOG.debug("end validating ruleAttribute");
if (!errors.isEmpty()) {
throw new WorkflowServiceErrorException("RuleAttribute Validation Error", errors);
}
}
示例2: setupRuleAttribute
import org.kuali.rice.kew.rule.bo.RuleAttribute; //导入方法依赖的package包/类
private RuleAttribute setupRuleAttribute() {
RuleAttribute ruleAttribute = new RuleAttribute();
ruleAttribute.setApplicationId("TST");
ruleAttribute.setDescription("Testing");
ruleAttribute.setLabel("New Label");
ruleAttribute.setResourceDescriptor("ResourceDescriptor");
ruleAttribute.setType("newType");
ruleAttribute.setName("Attr");
return getDataObjectService().save(ruleAttribute, PersistenceOption.FLUSH);
}
示例3: setupRuleAttribute
import org.kuali.rice.kew.rule.bo.RuleAttribute; //导入方法依赖的package包/类
private RuleAttribute setupRuleAttribute(){
RuleAttribute ruleAttribute = new RuleAttribute();
ruleAttribute.setApplicationId("TST");
ruleAttribute.setDescription("Testing");
ruleAttribute.setLabel("New Label");
ruleAttribute.setResourceDescriptor("ResourceDescriptor");
ruleAttribute.setType("newType");
ruleAttribute.setName("Attr");
return KRADServiceLocator.getDataObjectService().save(ruleAttribute, PersistenceOption.FLUSH);
}
示例4: setupRuleAttributeSimilar
import org.kuali.rice.kew.rule.bo.RuleAttribute; //导入方法依赖的package包/类
private RuleAttribute setupRuleAttributeSimilar(){
RuleAttribute ruleAttribute = new RuleAttribute();
ruleAttribute.setApplicationId("TST2");
ruleAttribute.setDescription("Testingfdsa");
ruleAttribute.setLabel("New Labefdsal");
ruleAttribute.setResourceDescriptor("ResourceDescriptor");
ruleAttribute.setType("newType");
ruleAttribute.setName("Attr2");
return KRADServiceLocator.getDataObjectService().save(ruleAttribute, PersistenceOption.FLUSH);
}
示例5: 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;
}
示例6: 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);
}