本文整理汇总了Java中org.kuali.rice.kew.rule.RuleResponsibilityBo.setRuleResponsibilityName方法的典型用法代码示例。如果您正苦于以下问题:Java RuleResponsibilityBo.setRuleResponsibilityName方法的具体用法?Java RuleResponsibilityBo.setRuleResponsibilityName怎么用?Java RuleResponsibilityBo.setRuleResponsibilityName使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类org.kuali.rice.kew.rule.RuleResponsibilityBo
的用法示例。
在下文中一共展示了RuleResponsibilityBo.setRuleResponsibilityName方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: parseResponsibility
import org.kuali.rice.kew.rule.RuleResponsibilityBo; //导入方法依赖的package包/类
public RuleResponsibilityBo parseResponsibility(Element element, RuleBaseValues rule) throws XmlException {
RuleResponsibilityBo responsibility = new RuleResponsibilityBo();
responsibility.setRuleBaseValues(rule);
String actionRequested = null;
String priority = null;
actionRequested = element.getChildText(ACTION_REQUESTED, element.getNamespace());
if (StringUtils.isBlank(actionRequested)) {
actionRequested = DEFAULT_ACTION_REQUESTED;
}
priority = element.getChildText(PRIORITY, element.getNamespace());
if (StringUtils.isBlank(priority)) {
priority = String.valueOf(DEFAULT_RULE_PRIORITY);
}
String approvePolicy = element.getChildText(APPROVE_POLICY, element.getNamespace());
Element delegations = element.getChild(DELEGATIONS, element.getNamespace());
if (actionRequested == null) {
throw new XmlException("actionRequested is required on responsibility");
}
if (!actionRequested.equals(KewApiConstants.ACTION_REQUEST_COMPLETE_REQ) && !actionRequested.equals(KewApiConstants.ACTION_REQUEST_APPROVE_REQ) && !actionRequested.equals(KewApiConstants.ACTION_REQUEST_ACKNOWLEDGE_REQ) && !actionRequested.equals(KewApiConstants.ACTION_REQUEST_FYI_REQ)) {
throw new XmlException("Invalid action requested code '" + actionRequested + "'");
}
if (StringUtils.isBlank(approvePolicy)) {
approvePolicy = DEFAULT_APPROVE_POLICY;
}
if (!approvePolicy.equals(ActionRequestPolicy.ALL.getCode()) && !approvePolicy.equals(ActionRequestPolicy.FIRST.getCode())) {
throw new XmlException("Invalid approve policy '" + approvePolicy + "'");
}
Integer priorityNumber = Integer.valueOf(priority);
responsibility.setActionRequestedCd(actionRequested);
responsibility.setPriority(priorityNumber);
responsibility.setApprovePolicy(approvePolicy);
RuleResponsibilityBo responsibilityNameAndType = CommonXmlParser.parseResponsibilityNameAndType(element);
if (responsibilityNameAndType == null) {
throw new XmlException("Could not locate a valid responsibility declaration on a responsibility on rule with description '" + rule.getDescription() + "'");
}
if (responsibilityNameAndType.getRuleResponsibilityType().equals(KewApiConstants.RULE_RESPONSIBILITY_GROUP_ID)
&& responsibility.getApprovePolicy().equals(ActionRequestPolicy.ALL.getCode())) {
throw new XmlException("Invalid approve policy '" + approvePolicy + "'. This policy is not supported with Groups.");
}
responsibility.setRuleResponsibilityName(responsibilityNameAndType.getRuleResponsibilityName());
responsibility.setRuleResponsibilityType(responsibilityNameAndType.getRuleResponsibilityType());
return responsibility;
}
示例2: setupRuleBaseValues
import org.kuali.rice.kew.rule.RuleResponsibilityBo; //导入方法依赖的package包/类
private RuleBaseValues setupRuleBaseValues() {
final RuleBaseValues rbv = new RuleBaseValues();
rbv.setActive(Boolean.TRUE);
rbv.setCurrentInd(Boolean.TRUE);
rbv.setDescription("A test rule");
rbv.setDocTypeName("TestDocumentType");
rbv.setForceAction(Boolean.FALSE);
RuleResponsibilityBo ruleResponsibilityBo = new RuleResponsibilityBo();
ruleResponsibilityBo.setResponsibilityId("1234");
ruleResponsibilityBo.setRuleBaseValues(rbv);
ruleResponsibilityBo.setRuleResponsibilityName("user2");
ruleResponsibilityBo.setRuleResponsibilityType(KewApiConstants.RULE_RESPONSIBILITY_WORKFLOW_ID);
rbv.getRuleResponsibilities().add(ruleResponsibilityBo);
RuleTemplateBo ruleTemplate = new RuleTemplateBo();
ruleTemplate.setName("test");
ruleTemplate.setDescription("description");
rbv.setRuleTemplate(ruleTemplate);
RuleTemplateOptionBo ruleTemplateOptionBo = new RuleTemplateOptionBo();
ruleTemplateOptionBo.setCode("TST");
ruleTemplateOptionBo.setValue("VAL");
ruleTemplateOptionBo.setRuleTemplate(ruleTemplate);
ruleTemplate.getRuleTemplateOptions().add(ruleTemplateOptionBo);
RuleTemplateAttributeBo ruleTemplateAttributeBo = new RuleTemplateAttributeBo();
ruleTemplateAttributeBo.setActive(true);
ruleTemplateAttributeBo.setDefaultValue("testAttr");
ruleTemplateAttributeBo.setDisplayOrder(1);
ruleTemplateAttributeBo.setRequired(true);
ruleTemplateAttributeBo.setRuleTemplate(ruleTemplate);
RuleAttribute ruleAttribute = setupRuleAttribute();
ruleTemplateAttributeBo.setRuleAttribute(ruleAttribute);
ruleTemplate.getRuleTemplateAttributes().add(ruleTemplateAttributeBo);
RuleExpressionDef ruleExpressionDef = new RuleExpressionDef();
ruleExpressionDef.setExpression("test");
ruleExpressionDef.setType("TST");
rbv.setRuleExpressionDef(ruleExpressionDef);
RuleExtensionBo ext = new RuleExtensionBo();
RuleExtensionValue val = new RuleExtensionValue();
val.setKey("emptyvalue");
val.setValue("testing");
val.setExtension(ext);
ext.getExtensionValues().add(val);
ext.setRuleBaseValues(rbv);
ext.setRuleTemplateAttribute(ruleTemplateAttributeBo);
rbv.getRuleExtensions().add(ext);
return KRADServiceLocator.getDataObjectService().save(rbv);
}