本文整理汇总了Java中org.kuali.rice.kew.service.KEWServiceLocator.getRuleService方法的典型用法代码示例。如果您正苦于以下问题:Java KEWServiceLocator.getRuleService方法的具体用法?Java KEWServiceLocator.getRuleService怎么用?Java KEWServiceLocator.getRuleService使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类org.kuali.rice.kew.service.KEWServiceLocator
的用法示例。
在下文中一共展示了KEWServiceLocator.getRuleService方法的7个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: testRuleXmlParserCacheUpdate
import org.kuali.rice.kew.service.KEWServiceLocator; //导入方法依赖的package包/类
@Test public void testRuleXmlParserCacheUpdate() throws Exception {
RuleServiceInternal ruleService = KEWServiceLocator.getRuleService();
int ruleSize = ruleService.fetchAllCurrentRulesForTemplateDocCombination("TestRuleTemplate", "TestDocumentType").size();
List collections = new ArrayList();
//ultimately it is the content of RulesToImport that determines whether or not we're
//going to hit the rules xml parser
InputStream xmlFile = TestUtilities.loadResource(this.getClass(), "RulesToImport.xml");
collections.add(KEWXmlDataLoader.getFileXmlDocCollection(xmlFile, "WorkflowUnitTestTemp"));
CoreApiServiceLocator.getXmlIngesterService().ingest(collections, null);
Thread.sleep(5000);//give cache time to reload;
int newRuleSize = ruleService.fetchAllCurrentRulesForTemplateDocCombination("TestRuleTemplate", "TestDocumentType").size();
assertEquals("Three more rules should have been returned from the cached service", ruleSize + 3, newRuleSize);
}
示例2: testNamedRule
import org.kuali.rice.kew.service.KEWServiceLocator; //导入方法依赖的package包/类
@Test public void testNamedRule() {
loadXmlFile("NamedRule.xml");
RuleServiceInternal ruleService = KEWServiceLocator.getRuleService();
RuleBaseValues rule = ruleService.getRuleByName("ANamedRule");
assertNotNull(rule);
assertEquals("ANamedRule", rule.getName());
assertEquals("A named rule", rule.getDescription());
LOG.info("Before Testing To and From Dates : " + rule.getToDateString()+" "+rule.getFromDateString());
assertNull(rule.getToDateString());
assertNull(rule.getFromDateString());
LOG.info("Rule To and From Dates : " + rule.getDocTypeName()+" "+rule.getName());
List extensions = rule.getRuleExtensions();
assertEquals(1, extensions.size());
RuleExtensionBo extension = (RuleExtensionBo) extensions.get(0);
assertEquals("TestRuleAttribute", extension.getRuleTemplateAttribute().getRuleAttribute().getName());
List extensionValues = extension.getExtensionValues();
assertEquals(2, extensionValues.size());
//RuleExtensionValue extensionValue = (RuleExtensionValue) extensionValues.get(0);
RuleExtensionValue extensionValue = getExtensionValue(extensionValues, "color");
assertEquals("color", extensionValue.getKey());
assertEquals("green", extensionValue.getValue());
//extensionValue = (RuleExtensionValue) extensionValues.get(1);
extensionValue = getExtensionValue(extensionValues, "shape");
assertEquals("shape", extensionValue.getKey());
assertEquals("square", extensionValue.getValue());
List responsibilities = rule.getRuleResponsibilities();
assertEquals(1, responsibilities.size());
RuleResponsibilityBo responsibility = (RuleResponsibilityBo) responsibilities.get(0);
assertEquals("user1", responsibility.getPrincipal().getPrincipalName());
assertEquals("A", responsibility.getActionRequestedCd());
}
示例3: testNamedRuleWithExpression
import org.kuali.rice.kew.service.KEWServiceLocator; //导入方法依赖的package包/类
@Test public void testNamedRuleWithExpression() {
loadXmlFile("NamedRuleWithExpression.xml");
RuleServiceInternal ruleService = KEWServiceLocator.getRuleService();
RuleBaseValues rule = ruleService.getRuleByName("ANamedRule");
assertNotNull(rule);
assertEquals("ANamedRule", rule.getName());
assertEquals("A named rule", rule.getDescription());
List extensions = rule.getRuleExtensions();
assertEquals(1, extensions.size());
RuleExtensionBo extension = (RuleExtensionBo) extensions.get(0);
assertEquals("TestRuleAttribute", extension.getRuleTemplateAttribute().getRuleAttribute().getName());
List extensionValues = extension.getExtensionValues();
assertEquals(2, extensionValues.size());
//RuleExtensionValue extensionValue = (RuleExtensionValue) extensionValues.get(0);
RuleExtensionValue extensionValue = getExtensionValue(extensionValues, "color");
assertEquals("color", extensionValue.getKey());
assertEquals("green", extensionValue.getValue());
//extensionValue = (RuleExtensionValue) extensionValues.get(1);
extensionValue = getExtensionValue(extensionValues, "shape");
assertEquals("shape", extensionValue.getKey());
assertEquals("square", extensionValue.getValue());
List responsibilities = rule.getRuleResponsibilities();
assertEquals(1, responsibilities.size());
RuleResponsibilityBo responsibility = (RuleResponsibilityBo) responsibilities.get(0);
assertEquals("user1", responsibility.getPrincipal().getPrincipalName());
assertEquals("A", responsibility.getActionRequestedCd());
assertNotNull(rule.getRuleExpressionDef());
assertEquals("someType", rule.getRuleExpressionDef().getType());
assertEquals("some expression", rule.getRuleExpressionDef().getExpression());
}
示例4: testUpdatedRuleWithExpression
import org.kuali.rice.kew.service.KEWServiceLocator; //导入方法依赖的package包/类
@Test public void testUpdatedRuleWithExpression() {
testNamedRule();
loadXmlFile("UpdatedNamedRuleWithExpression.xml");
RuleServiceInternal ruleService = KEWServiceLocator.getRuleService();
RuleBaseValues rule = ruleService.getRuleByName("ANamedRule");
assertNotNull(rule);
assertEquals("ANamedRule", rule.getName());
assertEquals("A named rule with an updated description, rule extension values, and responsibilities", rule.getDescription());
List extensions = rule.getRuleExtensions();
assertEquals(1, extensions.size());
RuleExtensionBo extension = (RuleExtensionBo) extensions.get(0);
assertEquals("TestRuleAttribute", extension.getRuleTemplateAttribute().getRuleAttribute().getName());
List extensionValues = extension.getExtensionValues();
assertEquals(2, extensionValues.size());
//RuleExtensionValue extensionValue = (RuleExtensionValue) extensionValues.get(0);
RuleExtensionValue extensionValue = getExtensionValue(extensionValues, "flavor");
assertEquals("flavor", extensionValue.getKey());
assertEquals("vanilla", extensionValue.getValue());
//extensionValue = (RuleExtensionValue) extensionValues.get(1);
extensionValue = getExtensionValue(extensionValues, "value");
assertEquals("value", extensionValue.getKey());
assertEquals("10", extensionValue.getValue());
List responsibilities = rule.getRuleResponsibilities();
assertEquals(1, responsibilities.size());
RuleResponsibilityBo responsibility = (RuleResponsibilityBo) responsibilities.get(0);
assertEquals("user2", responsibility.getPrincipal().getPrincipalName());
assertEquals("F", responsibility.getActionRequestedCd());
}
示例5: testRulesWithDifferentResponsibilityTypes
import org.kuali.rice.kew.service.KEWServiceLocator; //导入方法依赖的package包/类
@Test public void testRulesWithDifferentResponsibilityTypes() throws Exception {
loadXmlFile("RulesWithDifferentResponsibilityTypes.xml");
RuleServiceInternal ruleService = KEWServiceLocator.getRuleService();
RuleBaseValues rule = ruleService.getRuleByName("RespTypeTest1");
assertNotNull(rule);
assertEquals("Rule should have a principal responsibility", KewApiConstants.RULE_RESPONSIBILITY_WORKFLOW_ID, rule.getRuleResponsibilities().get(0).getRuleResponsibilityType());
assertEquals("Rule should have a principal id of user1", "user1", rule.getRuleResponsibilities().get(0).getRuleResponsibilityName());
rule = ruleService.getRuleByName("RespTypeTest2");
assertNotNull(rule);
assertEquals("Rule should have a principal responsibility", KewApiConstants.RULE_RESPONSIBILITY_WORKFLOW_ID, rule.getRuleResponsibilities().get(0).getRuleResponsibilityType());
assertEquals("Rule should have a principal id of user1", "user1", rule.getRuleResponsibilities().get(0).getRuleResponsibilityName());
rule = ruleService.getRuleByName("RespTypeTest3");
assertNotNull(rule);
assertEquals("Rule should have a group responsibility", KewApiConstants.RULE_RESPONSIBILITY_GROUP_ID, rule.getRuleResponsibilities().get(0).getRuleResponsibilityType());
assertEquals("Rule should have a group id of 3001", "3001", rule.getRuleResponsibilities().get(0).getRuleResponsibilityName());
rule = ruleService.getRuleByName("RespTypeTest4");
assertNotNull(rule);
assertEquals("Rule should have a group responsibility", KewApiConstants.RULE_RESPONSIBILITY_GROUP_ID, rule.getRuleResponsibilities().get(0).getRuleResponsibilityType());
assertEquals("Rule should have a group id of 1", "1", rule.getRuleResponsibilities().get(0).getRuleResponsibilityName());
rule = ruleService.getRuleByName("RespTypeTest5");
assertNotNull(rule);
assertEquals("Rule should have a role responsibility", KewApiConstants.RULE_RESPONSIBILITY_ROLE_ID, rule.getRuleResponsibilities().get(0).getRuleResponsibilityType());
assertEquals("Invalid role name", "org.kuali.rice.kew.rule.TestRuleAttribute!TEST", rule.getRuleResponsibilities().get(0).getRuleResponsibilityName());
rule = ruleService.getRuleByName("RespTypeTest6");
assertNotNull(rule);
assertEquals("Rule should have a role responsibility", KewApiConstants.RULE_RESPONSIBILITY_ROLE_ID, rule.getRuleResponsibilities().get(0).getRuleResponsibilityType());
assertEquals("Invalid role name", "org.kuali.rice.kew.rule.TestRuleAttribute!TEST", rule.getRuleResponsibilities().get(0).getRuleResponsibilityName());
}
示例6: getRuleService
import org.kuali.rice.kew.service.KEWServiceLocator; //导入方法依赖的package包/类
private RuleServiceInternal getRuleService() {
return KEWServiceLocator.getRuleService();
}
示例7: testUpdatedRule
import org.kuali.rice.kew.service.KEWServiceLocator; //导入方法依赖的package包/类
@Test public void testUpdatedRule() {
testNamedRule();
RuleServiceInternal ruleService = KEWServiceLocator.getRuleService();
// let's grab the responsibility id from the original named rule
RuleBaseValues rule = ruleService.getRuleByName("ANamedRule");
String responsibilityId = rule.getRuleResponsibilities().get(0).getResponsibilityId();
String ruleId = rule.getId();
Integer versionNumber = rule.getVersionNbr();
loadXmlFile("UpdatedNamedRule.xml");
rule = ruleService.getRuleByName("ANamedRule");
assertNotNull(rule);
assertEquals("ANamedRule", rule.getName());
assertTrue("Rule should be current.", rule.getCurrentInd());
assertFalse("Rule should not be a delegate rule.", rule.getDelegateRule());
assertFalse("Rule should not be a template rule.", rule.getTemplateRuleInd());
assertNull("Rule should not have a from date.", rule.getFromDateValue());
assertNull("Rule should not have a to date.", rule.getToDateValue());
// check that the previous versions line up and that the rule is not the same
assertFalse("Rule ids should be different", ruleId.equals(rule.getId()));
assertEquals("Previous version id should be correct", ruleId, rule.getPreviousRuleId());
assertEquals("Version ids are incorrect", new Integer(versionNumber + 1), rule.getVersionNbr());
// fetch the original rule and verify that it's no longer current
RuleBaseValues oldRule = ruleService.findRuleBaseValuesById(ruleId);
assertFalse("Old rule should no longer be current.", oldRule.getCurrentInd());
assertEquals("A named rule with an updated description, rule extension values, and responsibilities", rule.getDescription());
List extensions = rule.getRuleExtensions();
assertEquals(1, extensions.size());
RuleExtensionBo extension = (RuleExtensionBo) extensions.get(0);
assertEquals("TestRuleAttribute", extension.getRuleTemplateAttribute().getRuleAttribute().getName());
List extensionValues = extension.getExtensionValues();
assertEquals(2, extensionValues.size());
//RuleExtensionValue extensionValue = (RuleExtensionValue) extensionValues.get(0);
RuleExtensionValue extensionValue = getExtensionValue(extensionValues, "flavor");
assertEquals("flavor", extensionValue.getKey());
assertEquals("vanilla", extensionValue.getValue());
//extensionValue = (RuleExtensionValue) extensionValues.get(1);
extensionValue = getExtensionValue(extensionValues, "value");
assertEquals("value", extensionValue.getKey());
assertEquals("10", extensionValue.getValue());
List responsibilities = rule.getRuleResponsibilities();
assertEquals(2, responsibilities.size());
// responsibility should have the same id as our original responsibility
RuleResponsibilityBo responsibility = (RuleResponsibilityBo) responsibilities.get(0);
assertEquals(responsibilityId, responsibility.getResponsibilityId());
assertEquals("user1", responsibility.getPrincipal().getPrincipalName());
assertEquals("A", responsibility.getActionRequestedCd());
assertEquals(new Integer(1), responsibility.getPriority());
responsibility = (RuleResponsibilityBo) responsibilities.get(1);
assertFalse(responsibilityId.equals(responsibility.getResponsibilityId()));
assertEquals("user2", responsibility.getPrincipal().getPrincipalName());
assertEquals("F", responsibility.getActionRequestedCd());
assertEquals(new Integer(1), responsibility.getPriority());
}