当前位置: 首页>>代码示例>>Java>>正文


Java KEWServiceLocator.getRuleService方法代码示例

本文整理汇总了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);
}
 
开发者ID:kuali,项目名称:kc-rice,代码行数:16,代码来源:RuleXmlParserTest.java

示例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());
}
 
开发者ID:kuali,项目名称:kc-rice,代码行数:32,代码来源:RuleXmlParserTest.java

示例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());
}
 
开发者ID:kuali,项目名称:kc-rice,代码行数:31,代码来源:RuleXmlParserTest.java

示例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());
}
 
开发者ID:kuali,项目名称:kc-rice,代码行数:29,代码来源:RuleXmlParserTest.java

示例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());
}
 
开发者ID:kuali,项目名称:kc-rice,代码行数:35,代码来源:RuleXmlParserTest.java

示例6: getRuleService

import org.kuali.rice.kew.service.KEWServiceLocator; //导入方法依赖的package包/类
private RuleServiceInternal getRuleService() {
	return KEWServiceLocator.getRuleService();
}
 
开发者ID:kuali,项目名称:kc-rice,代码行数:4,代码来源:RuleQuickLinksAction.java

示例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());
}
 
开发者ID:kuali,项目名称:kc-rice,代码行数:60,代码来源:RuleXmlParserTest.java


注:本文中的org.kuali.rice.kew.service.KEWServiceLocator.getRuleService方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。