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


Java WorkflowDocument.addAttributeDefinition方法代码示例

本文整理汇总了Java中org.kuali.rice.kew.api.WorkflowDocument.addAttributeDefinition方法的典型用法代码示例。如果您正苦于以下问题:Java WorkflowDocument.addAttributeDefinition方法的具体用法?Java WorkflowDocument.addAttributeDefinition怎么用?Java WorkflowDocument.addAttributeDefinition使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在org.kuali.rice.kew.api.WorkflowDocument的用法示例。


在下文中一共展示了WorkflowDocument.addAttributeDefinition方法的8个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: testNonMatchingExtensionKey

import org.kuali.rice.kew.api.WorkflowDocument; //导入方法依赖的package包/类
/**
 * Tests SGXA attribute matching behavior with extension value keys that do not necessarily match
 * a field defined in the attribute
 */
@Test public void testNonMatchingExtensionKey() throws WorkflowException {
    loadXmlFile("TestExtensionValueMatching.xml");
    WorkflowDocument doc = WorkflowDocumentFactory.createDocument(getPrincipalIdForName("arh14"), "TestDocument");

    WorkflowAttributeDefinition.Builder attr = WorkflowAttributeDefinition.Builder.create(StandardGenericXMLRuleAttribute.class.getName());
    attr.setAttributeName("Attr1");
    // expected to match RuleTemplate with extension value: value='1' with xpath expression /xmlRouting/field[@name=attr1] = wf:ruledata('value')
    attr.addPropertyDefinition("attr1", "2");
    doc.addAttributeDefinition(attr.build());

    doc.route("");

    String id = doc.getDocumentId();

    doc = WorkflowDocumentFactory.loadDocument(getPrincipalIdForName("user1"), id);
    assertTrue("Request should have been generated to user1", doc.isApprovalRequested());

    doc = WorkflowDocumentFactory.loadDocument(getPrincipalIdForName("user2"), id);
    assertTrue("Expected approval request to user2", doc.isApprovalRequested());
}
 
开发者ID:kuali,项目名称:kc-rice,代码行数:25,代码来源:StandardGenericXMLRuleAttributeTest.java

示例2: testParameterizedNetworkIdAttribute

import org.kuali.rice.kew.api.WorkflowDocument; //导入方法依赖的package包/类
@Test
public void testParameterizedNetworkIdAttribute() throws Exception {
	loadXmlFile("ParameterizedNetworkIdRoleAttributeTestConfig.xml");

	WorkflowDocument document = WorkflowDocumentFactory.createDocument(getPrincipalIdForName(
			"ewestfal"), "NetworkIdRoleAttributeTest");

	WorkflowAttributeDefinition.Builder networkIdDef1 = WorkflowAttributeDefinition.Builder.create(
			"NetworkIdRoleAttribute");
	PropertyDefinition networkIdProp1 = PropertyDefinition.create(
			NETWORK_ID_PROP, "rkirkend");
	networkIdDef1.addPropertyDefinition(networkIdProp1);

	document.addAttributeDefinition(networkIdDef1.build());

	document.route("Routing!");

	// load the document as rkirkend

	document = WorkflowDocumentFactory.loadDocument(getPrincipalIdForName("rkirkend"), document
			.getDocumentId());
	assertTrue("Document should be ENROUTE", document.isEnroute());
	assertTrue("rkirkend should have an approve request.", document
			.isApprovalRequested());

	// now let's verify the XML

	XPath xPath = XPathHelper.newXPath();
	assertTrue("Should have found the ID.", (Boolean) xPath.evaluate(
			"//" + ATTRIBUTE_NAME + "/thisIdRocks", new InputSource(
					new StringReader(document.getDocumentContent()
							.getFullContent())), XPathConstants.BOOLEAN));

}
 
开发者ID:kuali,项目名称:kc-rice,代码行数:35,代码来源:NetworkIdRoleAttributeTest.java

示例3: testParameterizedPrincipalIdAttribute

import org.kuali.rice.kew.api.WorkflowDocument; //导入方法依赖的package包/类
@Test
public void testParameterizedPrincipalIdAttribute() throws Exception {
	loadXmlFile("ParameterizedPrincipalIdRoleAttributeTestConfig.xml");

	WorkflowDocument document = WorkflowDocumentFactory.createDocument(getPrincipalIdForName(
			"ewestfal"), "PrincipalIdRoleAttributeTest");

	WorkflowAttributeDefinition.Builder principalIdDef1 = WorkflowAttributeDefinition.Builder.create(
			"PrincipalIdRoleAttribute");
	PropertyDefinition principalIdProp1 = PropertyDefinition.create(
			PRINCIPAL_ID_PROP, KimApiServiceLocator.getIdentityService().getPrincipalByPrincipalName("rkirkend").getPrincipalId());
	principalIdDef1.addPropertyDefinition(principalIdProp1);

	document.addAttributeDefinition(principalIdDef1.build());

	document.route("Routing!");

	// load the document as rkirkend

	document = WorkflowDocumentFactory.loadDocument(getPrincipalIdForName("rkirkend"), document
			.getDocumentId());
	assertTrue("Document should be ENROUTE", document.isEnroute());
	assertTrue("rkirkend should have an approve request.", document
			.isApprovalRequested());

	// now let's verify the XML

	XPath xPath = XPathHelper.newXPath();
	assertTrue("Should have found the ID.", (Boolean) xPath.evaluate(
			"//" + ATTRIBUTE_NAME + "/thisIdRocks", new InputSource(
					new StringReader(document.getDocumentContent()
							.getFullContent())), XPathConstants.BOOLEAN));

}
 
开发者ID:kuali,项目名称:kc-rice,代码行数:35,代码来源:PrincipalIdRoleAttributeTest.java

示例4: routeRuleWithDelegate

import org.kuali.rice.kew.api.WorkflowDocument; //导入方法依赖的package包/类
@Override
    public String routeRuleWithDelegate(String documentId, RuleBaseValues parentRule, RuleBaseValues delegateRule, PrincipalContract principal, String annotation, boolean blanketApprove) throws Exception {
        if (parentRule == null) {
            throw new IllegalArgumentException("Cannot route a delegate without a parent rule.");
        }
        if (parentRule.getDelegateRule().booleanValue()) {
            throw new IllegalArgumentException("Parent rule cannot be a delegate.");
        }
        if (parentRule.getPreviousRuleId() == null && delegateRule.getPreviousRuleId() == null) {
            throw new IllegalArgumentException("Previous rule version required.");
        }

        // if the parent rule is new, unsaved, then save it
//      boolean isRoutingParent = parentRule.getId() == null;
//      if (isRoutingParent) {
//      // it's very important that we do not save delegations here (that's what the false parameter is for)
//      // this is because, if we save the delegations, the existing delegations on our parent rule will become
//      // saved as "non current" before the rule is approved!!!
//      save2(parentRule, null, false);
//      //save2(parentRule, null, true);
//      }

        // XXX: added when the RuleValidation stuff was added, basically we just need to get the RuleDelegation
        // that points to our delegate rule, this rule code is scary...
        RuleDelegationBo ruleDelegation = getRuleDelegation(parentRule, delegateRule);

        save2(delegateRule, ruleDelegation, true);

//      if the parent rule is new, unsaved, then save it
        // It's important to save the parent rule after the delegate rule is saved, that way we can ensure that any new rule
        // delegations have a valid, saved, delegation rule to point to (otherwise we end up with a null constraint violation)
        boolean isRoutingParent = parentRule.getId() == null;
        if (isRoutingParent) {
            // it's very important that we do not save delegations here (that's what the false parameter is for)
            // this is because, if we save the delegations, the existing delegations on our parent rule will become
            // saved as "non current" before the rule is approved!!!
            save2(parentRule, null, false);
            //save2(parentRule, null, true);
        }

        WorkflowDocument workflowDocument = null;
        if (documentId != null) {
            workflowDocument = WorkflowDocumentFactory.loadDocument(principal.getPrincipalId(), documentId);
        } else {
            List<RuleBaseValues> rules = new ArrayList<RuleBaseValues>();
            rules.add(delegateRule);
            rules.add(parentRule);
            workflowDocument = WorkflowDocumentFactory.createDocument(principal.getPrincipalId(), getRuleDocumentTypeName(
                    rules));
        }
        workflowDocument.setTitle(generateTitle(parentRule, delegateRule));
        delegateRule.setDocumentId(workflowDocument.getDocumentId());
        workflowDocument.addAttributeDefinition(RuleRoutingDefinition.createAttributeDefinition(parentRule.getDocTypeName()));
        getRuleDAO().save(delegateRule);
        if (isRoutingParent) {
            parentRule.setDocumentId(workflowDocument.getDocumentId());
            getRuleDAO().save(parentRule);
        }
        if (blanketApprove) {
            workflowDocument.blanketApprove(annotation);
        } else {
            workflowDocument.route(annotation);
        }
        return workflowDocument.getDocumentId();
    }
 
开发者ID:kuali,项目名称:kc-rice,代码行数:66,代码来源:RuleServiceInternalImpl.java

示例5: testNetworkIdAttribute

import org.kuali.rice.kew.api.WorkflowDocument; //导入方法依赖的package包/类
@Test
public void testNetworkIdAttribute() throws Exception {
	loadXmlFile("NetworkIdRoleAttributeTestConfig.xml");

	WorkflowDocument document = WorkflowDocumentFactory.createDocument(getPrincipalIdForName(
			"ewestfal"), "NetworkIdRoleAttributeTest");

	WorkflowAttributeDefinition.Builder networkIdDef1 = WorkflowAttributeDefinition.Builder.create("NetworkIdRoleAttribute");
	PropertyDefinition networkIdProp1 = PropertyDefinition.create(
			NETWORK_ID_PROP, "rkirkend");
	networkIdDef1.addPropertyDefinition(networkIdProp1);

	WorkflowAttributeDefinition.Builder networkIdDef2 = WorkflowAttributeDefinition.Builder.create(
			"NetworkIdRoleAttribute");
	PropertyDefinition networkIdProp2 = PropertyDefinition.create(
			NETWORK_ID_PROP, "bmcgough");
	networkIdDef2.addPropertyDefinition(networkIdProp2);

	document.addAttributeDefinition(networkIdDef1.build());
	document.addAttributeDefinition(networkIdDef2.build());

	document.route("Routing!");

	// load the document as rkirkend

	document = WorkflowDocumentFactory.loadDocument(getPrincipalIdForName("rkirkend"), document
			.getDocumentId());
	assertTrue("Document should be ENROUTE", document.isEnroute());
	assertTrue("rkirkend should have an approve request.", document
			.isApprovalRequested());

	// load the document as bmcgough
	document = WorkflowDocumentFactory.loadDocument(getPrincipalIdForName("bmcgough"), document
			.getDocumentId());
	assertTrue("bmcgough should have an approve request.", document
			.isApprovalRequested());

	// submit an approve as bmcgough
	document.approve("i approve");

	// reload as rkirkend, verify still enroute
	document = WorkflowDocumentFactory.loadDocument(getPrincipalIdForName("rkirkend"), document
			.getDocumentId());
	assertTrue("Document should be ENROUTE", document.isEnroute());
	assertTrue("rkirkend should have an approve request.", document
			.isApprovalRequested());
	document.approve("i also approve");

	// now the document should be FINAL
	assertTrue("Document should be FINAL", document.isFinal());

}
 
开发者ID:kuali,项目名称:kc-rice,代码行数:53,代码来源:NetworkIdRoleAttributeTest.java

示例6: testUniversityIdAttribute

import org.kuali.rice.kew.api.WorkflowDocument; //导入方法依赖的package包/类
@Test
   public void testUniversityIdAttribute() throws Exception {
loadXmlFile("UniversityIdRoleAttributeTestConfig.xml");

// network id to university id mapping as defined in DefaultSuiteTestData.xml
// -----------------------------------
// ewestfal     ->     2001
// rkirkend     ->     2002
// bmcgough     ->     2004

WorkflowDocument document = WorkflowDocumentFactory.createDocument("2001", "UniversityIdRoleAttributeTest");

WorkflowAttributeDefinition.Builder universityIdDef1 = WorkflowAttributeDefinition.Builder.create("UniversityIdRoleAttribute");
PropertyDefinition universityIdProp1 = PropertyDefinition.create(UNIVERSITY_ID_PROP, "2002");
universityIdDef1.addPropertyDefinition(universityIdProp1);

WorkflowAttributeDefinition.Builder universityIdDef2 = WorkflowAttributeDefinition.Builder.create("UniversityIdRoleAttribute");
PropertyDefinition universityIdProp2 = PropertyDefinition.create(UNIVERSITY_ID_PROP, "2004");
universityIdDef2.addPropertyDefinition(universityIdProp2);

document.addAttributeDefinition(universityIdDef1.build());
document.addAttributeDefinition(universityIdDef2.build());

document.route("Routing!");

// load the document as rkirkend

document = WorkflowDocumentFactory.loadDocument("2002", document.getDocumentId());
assertTrue("Document should be ENROUTE", document.isEnroute());
assertTrue("rkirkend should have an approve request.", document.isApprovalRequested());

// load the document as bmcgough
document = WorkflowDocumentFactory.loadDocument("2004", document.getDocumentId());
assertTrue("bmcgough should have an approve request.", document.isApprovalRequested());

// submit an approve as bmcgough
document.approve("i approve");

// reload as rkirkend, verify still enroute
document = WorkflowDocumentFactory.loadDocument("2002", document.getDocumentId());
assertTrue("Document should be ENROUTE", document.isEnroute());
assertTrue("rkirkend should have an approve request.", document.isApprovalRequested());
document.approve("i also approve");

// now the document should be FINAL
assertTrue("Document should be FINAL", document.isFinal());

   }
 
开发者ID:kuali,项目名称:kc-rice,代码行数:49,代码来源:UniversityIdRoleAttributeTest.java

示例7: testParameterizedUniversityIdAttribute

import org.kuali.rice.kew.api.WorkflowDocument; //导入方法依赖的package包/类
@Test
   public void testParameterizedUniversityIdAttribute() throws Exception {
loadXmlFile("ParameterizedUniversityIdRoleAttributeTestConfig.xml");

WorkflowDocument document = WorkflowDocumentFactory.createDocument(getPrincipalIdForName("ewestfal"), "UniversityIdRoleAttributeTest");

WorkflowAttributeDefinition.Builder univIdDef1 = WorkflowAttributeDefinition.Builder.create("UniversityIdRoleAttribute");
PropertyDefinition univIdProp1 = PropertyDefinition.create(UNIVERSITY_ID_PROP, "2002");
univIdDef1.addPropertyDefinition(univIdProp1);
	
document.addAttributeDefinition(univIdDef1.build());

document.route("Routing!");

// load the document as rkirkend

document = WorkflowDocumentFactory.loadDocument("2002", document.getDocumentId());
assertTrue("Document should be ENROUTE", document.isEnroute());
assertTrue("rkirkend should have an approve request.", document.isApprovalRequested());

// now let's verify the XML

XPath xPath = XPathHelper.newXPath();
assertTrue("Should have found the ID.", (Boolean)xPath.evaluate("//UniversityIdRoleAttribute/thisIdRocks", new InputSource(new StringReader(document.getDocumentContent().getFullContent())), XPathConstants.BOOLEAN));

   }
 
开发者ID:kuali,项目名称:kc-rice,代码行数:27,代码来源:UniversityIdRoleAttributeTest.java

示例8: testPrincipalIdAttribute

import org.kuali.rice.kew.api.WorkflowDocument; //导入方法依赖的package包/类
@Test
public void testPrincipalIdAttribute() throws Exception {
	loadXmlFile("PrincipalIdRoleAttributeTestConfig.xml");

	WorkflowDocument document = WorkflowDocumentFactory.createDocument(getPrincipalIdForName(
			"ewestfal"), "PrincipalIdRoleAttributeTest");

	WorkflowAttributeDefinition.Builder principalIdDef1 = WorkflowAttributeDefinition.Builder.create(
			"PrincipalIdRoleAttribute");
	PropertyDefinition principalIdProp1 = PropertyDefinition.create(
			PRINCIPAL_ID_PROP, KimApiServiceLocator.getIdentityService().getPrincipalByPrincipalName("rkirkend").getPrincipalId());
	principalIdDef1.addPropertyDefinition(principalIdProp1);

	WorkflowAttributeDefinition.Builder principalIdDef2 = WorkflowAttributeDefinition.Builder.create(
			"PrincipalIdRoleAttribute");
	PropertyDefinition principalIdProp2 = PropertyDefinition.create(
			PRINCIPAL_ID_PROP, KimApiServiceLocator.getIdentityService().getPrincipalByPrincipalName("bmcgough").getPrincipalId());
	principalIdDef2.addPropertyDefinition(principalIdProp2);

	document.addAttributeDefinition(principalIdDef1.build());
	document.addAttributeDefinition(principalIdDef2.build());

	document.route("Routing!");

	// load the document as rkirkend

	document = WorkflowDocumentFactory.loadDocument(getPrincipalIdForName("rkirkend"), document
			.getDocumentId());
	assertTrue("Document should be ENROUTE", document.isEnroute());
	assertTrue("rkirkend should have an approve request.", document
			.isApprovalRequested());

	// load the document as bmcgough
	document = WorkflowDocumentFactory.loadDocument(getPrincipalIdForName("bmcgough"), document
			.getDocumentId());
	assertTrue("bmcgough should have an approve request.", document
			.isApprovalRequested());

	// submit an approve as bmcgough
	document.approve("i approve");

	// reload as rkirkend, verify still enroute
	document = WorkflowDocumentFactory.loadDocument(getPrincipalIdForName("rkirkend"), document
			.getDocumentId());
	assertTrue("Document should be ENROUTE", document.isEnroute());
	assertTrue("rkirkend should have an approve request.", document
			.isApprovalRequested());
	document.approve("i also approve");

	// now the document should be FINAL
	assertTrue("Document should be FINAL", document.isFinal());

}
 
开发者ID:kuali,项目名称:kc-rice,代码行数:54,代码来源:PrincipalIdRoleAttributeTest.java


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