本文整理汇总了Java中org.kuali.rice.kew.api.action.RoutingReportActionToTake类的典型用法代码示例。如果您正苦于以下问题:Java RoutingReportActionToTake类的具体用法?Java RoutingReportActionToTake怎么用?Java RoutingReportActionToTake使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
RoutingReportActionToTake类属于org.kuali.rice.kew.api.action包,在下文中一共展示了RoutingReportActionToTake类的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: from
import org.kuali.rice.kew.api.action.RoutingReportActionToTake; //导入依赖的package包/类
public static SimulationActionToTake from(RoutingReportActionToTake actionToTake) {
if (actionToTake == null) {
return null;
}
SimulationActionToTake simActionToTake = new SimulationActionToTake();
simActionToTake.setNodeName(actionToTake.getNodeName());
if (StringUtils.isBlank(actionToTake.getActionToPerform())) {
throw new IllegalArgumentException("ReportActionToTakeVO must contain an action taken code and does not");
}
simActionToTake.setActionToPerform(actionToTake.getActionToPerform());
if (actionToTake.getPrincipalId() == null) {
throw new IllegalArgumentException("ReportActionToTakeVO must contain a principalId and does not");
}
Principal kPrinc = KEWServiceLocator.getIdentityHelperService().getPrincipal(actionToTake.getPrincipalId());
Person user = KimApiServiceLocator.getPersonService().getPerson(kPrinc.getPrincipalId());
if (user == null) {
throw new IllegalStateException("Could not locate Person for the given id: " + actionToTake.getPrincipalId());
}
simActionToTake.setUser(user);
return simActionToTake;
}
示例2: from
import org.kuali.rice.kew.api.action.RoutingReportActionToTake; //导入依赖的package包/类
public static SimulationCriteria from(RoutingReportCriteria criteriaVO) {
if (criteriaVO == null) {
return null;
}
SimulationCriteria criteria = new SimulationCriteria();
criteria.setDestinationNodeName(criteriaVO.getTargetNodeName());
criteria.setDocumentId(criteriaVO.getDocumentId());
criteria.setDocumentTypeName(criteriaVO.getDocumentTypeName());
criteria.setXmlContent(criteriaVO.getXmlContent());
criteria.setActivateRequests(criteriaVO.isActivateRequests());
criteria.setFlattenNodes(criteriaVO.isFlattenNodes());
if (criteriaVO.getRoutingPrincipalId() != null) {
Principal kPrinc = KEWServiceLocator.getIdentityHelperService().
getPrincipal(criteriaVO.getRoutingPrincipalId());
Person user = KimApiServiceLocator.getPersonService().getPerson(kPrinc.getPrincipalId());
if (user == null) {
throw new RiceRuntimeException(
"Could not locate user for the given id: " + criteriaVO.getRoutingPrincipalId());
}
criteria.setRoutingUser(user);
}
if (criteriaVO.getRuleTemplateNames() != null) {
criteria.setRuleTemplateNames(criteriaVO.getRuleTemplateNames());
}
if (criteriaVO.getNodeNames() != null) {
criteria.setNodeNames(criteriaVO.getNodeNames());
}
if (criteriaVO.getTargetPrincipalIds() != null) {
for (String targetPrincipalId : criteriaVO.getTargetPrincipalIds()) {
Principal principal = KEWServiceLocator.getIdentityHelperService().getPrincipal(targetPrincipalId);
criteria.getDestinationRecipients().add(new KimPrincipalRecipient(principal));
}
}
if (criteriaVO.getActionsToTake() != null) {
for (RoutingReportActionToTake actionToTake : criteriaVO.getActionsToTake()) {
criteria.getActionsToTake().add(SimulationActionToTake.from(actionToTake));
}
}
return criteria;
}
示例3: testFutureRequestsWithRoutingAndWorkflowInfoActionRequestCheck
import org.kuali.rice.kew.api.action.RoutingReportActionToTake; //导入依赖的package包/类
/**
* Tests future requests operation
*
* @throws Exception
*/
@Test
public void testFutureRequestsWithRoutingAndWorkflowInfoActionRequestCheck() throws Exception {
this.loadXmlFile(this.getClass(), "FutureRequestsConfig.xml");
String user1PrincipalId = getPrincipalIdForName("user1");
String user2PrincipalId = getPrincipalIdForName("user2");
WorkflowDocument document = WorkflowDocumentFactory.createDocument(user1PrincipalId, "FutureRequestsDoc");
document.route("");
// Node1
//user1 should have approval requested
document = WorkflowDocumentFactory.loadDocument(user1PrincipalId, document.getDocumentId());
WorkflowDocumentActionsService actionService = KewApiServiceLocator.getWorkflowDocumentActionsService();
RoutingReportCriteria.Builder reportCriteria = RoutingReportCriteria.Builder.createByDocumentId(document.getDocumentId());
reportCriteria.setTargetPrincipalIds(Collections.singletonList(user1PrincipalId));
String actionToTakeNode = "Node1";
reportCriteria.setActionsToTake(Collections.singletonList(RoutingReportActionToTake.Builder.create(
KewApiConstants.ACTION_TAKEN_APPROVED_CD, user1PrincipalId, actionToTakeNode)));
assertTrue("User " + user1PrincipalId + " should have approval requests on the document",
actionService.documentWillHaveAtLeastOneActionRequest(reportCriteria.build(),
Collections.singletonList(KewApiConstants.ACTION_REQUEST_APPROVE_REQ), false));
reportCriteria = RoutingReportCriteria.Builder.createByDocumentId(document.getDocumentId());
reportCriteria.setTargetPrincipalIds(Collections.singletonList(user1PrincipalId));
actionToTakeNode = "Node1";
reportCriteria.setActionsToTake(Collections.singletonList(RoutingReportActionToTake.Builder.create(KewApiConstants.ACTION_TAKEN_APPROVED_CD, user1PrincipalId, actionToTakeNode)));
DocumentDetail documentVO = KewApiServiceLocator.getWorkflowDocumentActionsService().executeSimulation(reportCriteria.build());
assertTrue("User " + user1PrincipalId + " should have one or more approval requests on the document", documentVO.getActionRequests().size() > 0);
reportCriteria = RoutingReportCriteria.Builder.createByDocumentId(document.getDocumentId());
String delyeaPrincipalId = getPrincipalIdForName("delyea");
reportCriteria.setTargetPrincipalIds(Collections.singletonList(user1PrincipalId));
actionToTakeNode = "Node1";
reportCriteria.setActionsToTake(Collections.singletonList(RoutingReportActionToTake.Builder.create(KewApiConstants.ACTION_TAKEN_APPROVED_CD, user1PrincipalId, actionToTakeNode)));
documentVO = actionService.executeSimulation(reportCriteria.build());
assertTrue("User " + delyeaPrincipalId + " should not have any requests on the document but executeSimulation() method should return all action requests anyway", documentVO.getActionRequests().size() > 0);
document = WorkflowDocumentFactory.createDocument(user1PrincipalId, "FutureRequestsDoc");
document.setDoNotReceiveFutureRequests();
document.route("");
document = WorkflowDocumentFactory.loadDocument(user1PrincipalId, document.getDocumentId());
assertFalse(document.isApprovalRequested());
// user1 should not have approval requested
reportCriteria = RoutingReportCriteria.Builder.createByDocumentId(document.getDocumentId());
reportCriteria.setTargetPrincipalIds(Collections.singletonList(user1PrincipalId));
assertFalse("User " + user1PrincipalId + " should not have any approval request on the document", actionService.documentWillHaveAtLeastOneActionRequest(reportCriteria.build(), Collections.singletonList(KewApiConstants.ACTION_REQUEST_APPROVE_REQ), false));
// user2 should have approval requested
reportCriteria = RoutingReportCriteria.Builder.createByDocumentId(document.getDocumentId());
reportCriteria.setTargetPrincipalIds(Collections.singletonList(user2PrincipalId));
assertTrue("User " + user2PrincipalId + " should have any approval request on the document", actionService.documentWillHaveAtLeastOneActionRequest(reportCriteria.build(), Collections.singletonList(KewApiConstants.ACTION_REQUEST_APPROVE_REQ), false));
}
示例4: runDocumentWillHaveApproveOrCompleteRequestAtNode
import org.kuali.rice.kew.api.action.RoutingReportActionToTake; //导入依赖的package包/类
private void runDocumentWillHaveApproveOrCompleteRequestAtNode(String documentType,ReportCriteriaGenerator generator) throws Exception {
/*
name="WorkflowDocument"
- bmcgough - Approve - false
- rkirkend - Approve - false
name="WorkflowDocument2"
- pmckown - Approve - false
name="Acknowledge1"
- temay - Ack - false
name="Acknowledge2"
- jhopf - Ack - false
*/
WorkflowDocumentActionsService wdas = KewApiServiceLocator.getWorkflowDocumentActionsService();
WorkflowDocument document = WorkflowDocumentFactory.createDocument(getPrincipalIdForName("ewestfal"), documentType);
RoutingReportCriteria.Builder builder = RoutingReportCriteria.Builder.createByDocumentId(document.getDocumentId());
builder.setXmlContent(document.getDocumentContent().getApplicationContent());
builder.setTargetNodeName("WorkflowDocument2");
builder.setRoutingPrincipalId(getPrincipalIdForName("bmcgough"));
assertTrue("Document should have one unfulfilled approve/complete request", wdas.documentWillHaveAtLeastOneActionRequest(builder.build(), Arrays.asList(new String[]{KewApiConstants.ACTION_REQUEST_APPROVE_REQ,KewApiConstants.ACTION_REQUEST_COMPLETE_REQ}), false));
builder.setTargetPrincipalIds(Collections.singletonList(getPrincipalIdForName("bmcgough")));
assertFalse("Document should not have any unfulfilled approve/complete requests", wdas.documentWillHaveAtLeastOneActionRequest(builder.build(), Arrays.asList(new String[]{KewApiConstants.ACTION_REQUEST_APPROVE_REQ,KewApiConstants.ACTION_REQUEST_COMPLETE_REQ}), false));
builder = RoutingReportCriteria.Builder.createByDocumentId(document.getDocumentId());
builder.setXmlContent(document.getDocumentContent().getApplicationContent());
builder.setTargetNodeName("WorkflowDocument2");
builder.setRoutingPrincipalId(getPrincipalIdForName("bmcgough"));
List<RoutingReportActionToTake.Builder> actionsToTake = new ArrayList<RoutingReportActionToTake.Builder>();
// actionsToTake[0] = new ReportActionToTakeDTO(KewApiConstants.ACTION_TAKEN_APPROVED_CD,getPrincipalIdForName("rkirkend"),"WorkflowDocument");
actionsToTake.add(RoutingReportActionToTake.Builder.create(KewApiConstants.ACTION_TAKEN_APPROVED_CD,getPrincipalIdForName("pmckown"),"WorkflowDocument2"));
builder.setActionsToTake(actionsToTake);
assertFalse("Document should not have any unfulfilled approve/complete requests", wdas.documentWillHaveAtLeastOneActionRequest(builder.build(), Arrays.asList(new String[]{KewApiConstants.ACTION_REQUEST_APPROVE_REQ,KewApiConstants.ACTION_REQUEST_COMPLETE_REQ}), false));
builder = RoutingReportCriteria.Builder.createByDocumentId(document.getDocumentId());
builder.setXmlContent(document.getDocumentContent().getApplicationContent());
builder.setTargetNodeName("WorkflowDocument2");
actionsToTake = new ArrayList<RoutingReportActionToTake.Builder>();
actionsToTake.add(RoutingReportActionToTake.Builder.create(KewApiConstants.ACTION_TAKEN_APPROVED_CD,getPrincipalIdForName("bmcgough"),"WorkflowDocument"));
actionsToTake.add(RoutingReportActionToTake.Builder.create(KewApiConstants.ACTION_TAKEN_APPROVED_CD,getPrincipalIdForName("rkirkend"),"WorkflowDocument"));
builder.setActionsToTake(actionsToTake);
builder.setRoutingPrincipalId(getPrincipalIdForName("pmckown"));
assertFalse("Document should not have any unfulfilled approve/complete requests", wdas.documentWillHaveAtLeastOneActionRequest(builder.build(), Arrays.asList(new String[]{KewApiConstants.ACTION_REQUEST_APPROVE_REQ,KewApiConstants.ACTION_REQUEST_COMPLETE_REQ}), false));
document = WorkflowDocumentFactory.createDocument(getPrincipalIdForName("ewestfal"), documentType);
document.route("");
assertTrue(document.isEnroute());
document = WorkflowDocumentFactory.loadDocument(getPrincipalIdForName("bmcgough"), document.getDocumentId());
document.approve("");
document = WorkflowDocumentFactory.loadDocument(getPrincipalIdForName("rkirkend"), document.getDocumentId());
document.approve("");
builder = RoutingReportCriteria.Builder.createByDocumentId(document.getDocumentId());
builder.setXmlContent(document.getDocumentContent().getApplicationContent());
builder.setTargetNodeName("WorkflowDocument2");
assertTrue("Document should have one unfulfilled approve/complete request", wdas.documentWillHaveAtLeastOneActionRequest(builder.build(), Arrays.asList(new String[]{KewApiConstants.ACTION_REQUEST_APPROVE_REQ,KewApiConstants.ACTION_REQUEST_COMPLETE_REQ}), false));
document = WorkflowDocumentFactory.loadDocument(getPrincipalIdForName("pmckown"), document.getDocumentId());
document.approve("");
assertTrue(document.isProcessed());
builder = RoutingReportCriteria.Builder.createByDocumentId(document.getDocumentId());
builder.setXmlContent(document.getDocumentContent().getApplicationContent());
builder.setTargetNodeName("Acknowledge1");
assertFalse("Document should not have any unfulfilled approve/complete requests when in processed status", wdas.documentWillHaveAtLeastOneActionRequest(builder.build(), Arrays.asList(new String[]{KewApiConstants.ACTION_REQUEST_APPROVE_REQ,KewApiConstants.ACTION_REQUEST_COMPLETE_REQ}), false));
builder = RoutingReportCriteria.Builder.createByDocumentId(document.getDocumentId());
builder.setXmlContent(document.getDocumentContent().getApplicationContent());
builder.setTargetNodeName("Acknowledge1");
assertTrue("Document should have one unfulfilled Ack request when in final status", wdas.documentWillHaveAtLeastOneActionRequest(builder.build(), Arrays.asList(new String[]{KewApiConstants.ACTION_REQUEST_ACKNOWLEDGE_REQ}), false));
if (generator.isCriteriaRouteHeaderBased()) {
assertFalse("Document should have no unfulfilled Ack request generated when in final status", wdas.documentWillHaveAtLeastOneActionRequest(builder.build(), Arrays.asList(new String[]{KewApiConstants.ACTION_REQUEST_ACKNOWLEDGE_REQ}), true));
}
// if temay acknowledges the document here it will move to processed and no more simulations would need to be tested
document = WorkflowDocumentFactory.loadDocument(getPrincipalIdForName("temay"), document.getDocumentId());
document.acknowledge("");
assertTrue(document.isProcessed());
}