本文整理汇总了Java中org.kuali.rice.kew.service.KEWServiceLocator类的典型用法代码示例。如果您正苦于以下问题:Java KEWServiceLocator类的具体用法?Java KEWServiceLocator怎么用?Java KEWServiceLocator使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
KEWServiceLocator类属于org.kuali.rice.kew.service包,在下文中一共展示了KEWServiceLocator类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: testSystemBranchState
import org.kuali.rice.kew.service.KEWServiceLocator; //导入依赖的package包/类
/**
* Tests that the proper state is set up on the root branch in the document
* to indicate that both PROCESSED and FINAL callbacks have been made into
* the post processor.
*/
@Test public void testSystemBranchState() throws Exception {
// route the document to final
WorkflowDocument document = WorkflowDocumentFactory.createDocument(getPrincipalIdForName("ewestfal"), "SimpleDocType");
document.route("");
assertTrue("Document should be final.", document.isFinal());
// now look at the branch state
DocumentRouteHeaderValue routeHeader = KEWServiceLocator.getRouteHeaderService().getRouteHeader(document.getDocumentId());
Branch rootBranch = routeHeader.getRootBranch();
assertNotNull(rootBranch);
BranchState processedBranchState = rootBranch.getBranchState(KewApiConstants.POST_PROCESSOR_PROCESSED_KEY);
BranchState finalBranchState = rootBranch.getBranchState(KewApiConstants.POST_PROCESSOR_FINAL_KEY);
assertNotNull(processedBranchState);
assertNotNull(finalBranchState);
assertEquals("true", processedBranchState.getValue());
assertEquals("true", finalBranchState.getValue());
assertEquals(1, TestPostProcessor.processedCount);
assertEquals(1, TestPostProcessor.finalCount);
}
示例2: assertExport
import org.kuali.rice.kew.service.KEWServiceLocator; //导入依赖的package包/类
protected void assertExport() throws Exception {
// export all existing rule attributes
List oldRuleAttributes = KEWServiceLocator.getRuleAttributeService().findAll();
KewExportDataSet dataSet = new KewExportDataSet();
dataSet.getRuleAttributes().addAll(oldRuleAttributes);
byte[] xmlBytes = CoreApiServiceLocator.getXmlExporterService().export(dataSet.createExportDataSet());
assertTrue("XML should be non empty.", xmlBytes != null && xmlBytes.length > 0);
// import the exported xml
loadXmlStream(new BufferedInputStream(new ByteArrayInputStream(xmlBytes)));
List newRuleAttributes = KEWServiceLocator.getRuleAttributeService().findAll();
assertEquals("Should have same number of old and new RuleAttributes.", oldRuleAttributes.size(), newRuleAttributes.size());
for (Iterator iterator = oldRuleAttributes.iterator(); iterator.hasNext();) {
RuleAttribute oldRuleAttribute = (RuleAttribute) iterator.next();
boolean foundAttribute = false;
for (Iterator iterator2 = newRuleAttributes.iterator(); iterator2.hasNext();) {
RuleAttribute newRuleAttribute = (RuleAttribute) iterator2.next();
if (oldRuleAttribute.getName().equals(newRuleAttribute.getName())) {
assertRuleAttributeExport(oldRuleAttribute, newRuleAttribute);
foundAttribute = true;
}
}
assertTrue("Could not locate the new rule attribute for name " + oldRuleAttribute.getName(), foundAttribute);
}
}
示例3: testLoadValidTemplateWithDescriptionDefault
import org.kuali.rice.kew.service.KEWServiceLocator; //导入依赖的package包/类
/**
* Tests loading a template with the minimal required ruleDefaults
*/
@Test public void testLoadValidTemplateWithDescriptionDefault() throws Exception {
testTemplate(TemplateParserGeneralFixture.VALID_TEMPLATE_WITH_DESCRIPTION_DEFAULT.fileNameParameter, null);
RuleTemplateBo template = KEWServiceLocator.getRuleTemplateService().findByRuleTemplateName(TemplateParserGeneralFixture.VALID_TEMPLATE_WITH_DESCRIPTION_DEFAULT.ruleTemplateName);
// test the rule template options; this one just has the instructions, nothing else
List<RuleTemplateOptionBo> options = template.getRuleTemplateOptions();
assertEquals(0, options.size());
// test those set in the default/template rule; everything default exception description which is specified
RuleBaseValues ruleDefaults = KEWServiceLocator.getRuleService().findDefaultRuleByRuleTemplateId(template.getId());
assertTrue(ruleDefaults.getTemplateRuleInd());
assertEquals("a description", ruleDefaults.getDescription());
assertFalse(ruleDefaults.isForceAction());
assertFalse(ruleDefaults.isActive());
// activation date defaults to current time
assertNull(ruleDefaults.getFromDateValue());
assertNotNull(ruleDefaults.getActivationDate());
assertTrue(new Date(System.currentTimeMillis() - 10000).before(ruleDefaults.getActivationDate()) && new Date(System.currentTimeMillis() + 100).after(ruleDefaults.getActivationDate()));
assertNull(ruleDefaults.getToDateString());
assertNull(ruleDefaults.getDeactivationDate());
}
示例4: createNewKualiMaintenanceForm
import org.kuali.rice.kew.service.KEWServiceLocator; //导入依赖的package包/类
/**
* Creates a KualiMaintenanceForm with the given rule template inside of its RuleBaseValues instance.
*
* @param rtName The rule template to use.
*/
private void createNewKualiMaintenanceForm(String rtName) {
// Initialize the required variables.
final KualiMaintenanceForm kmForm = new KualiMaintenanceForm();
final MaintenanceDocument maintDoc = new MaintenanceDocumentBase();
final Maintainable oldMaint = new RoutingRuleMaintainable();
final Maintainable newMaint = new RoutingRuleMaintainable();
final RuleBaseValues rbValues = new RuleBaseValues();
// Setup the rule base and the maintainables.
rbValues.setRuleTemplate(KEWServiceLocator.getRuleTemplateService().findByRuleTemplateName(rtName));
oldMaint.setBusinessObject(rbValues);
oldMaint.setBoClass(rbValues.getClass());
newMaint.setBusinessObject(rbValues);
newMaint.setBoClass(rbValues.getClass());
// Setup the maintenance document and the maintenance form.
maintDoc.setOldMaintainableObject(oldMaint);
maintDoc.setNewMaintainableObject(newMaint);
kmForm.setDocument(maintDoc);
KNSGlobalVariables.setKualiForm(kmForm);
}
示例5: testGenerateRemindersCustomStyleSheet
import org.kuali.rice.kew.service.KEWServiceLocator; //导入依赖的package包/类
/**
* tests custom stylesheet
* @throws Exception
*/
@Test
public void testGenerateRemindersCustomStyleSheet() throws Exception {
loadXmlFile("customEmailStyleData.xml");
assertNotNull(CoreServiceApiServiceLocator.getStyleService().getStyle("kew.email.style"));
Person user = KimApiServiceLocator.getPersonService().getPersonByPrincipalName("arh14");
int count = generateDocs(new String[] { "PingDocument", "PingDocumentWithEmailAttrib" }, user);
Collection<ActionItem> actionItems = org.kuali.rice.kew.actionitem.ActionItem.to(new ArrayList<org.kuali.rice.kew.actionitem.ActionItem>(KEWServiceLocator.getActionListService().getActionList(user.getPrincipalId(), null)));
assertEquals("user should have " + count + " items in his action list.", count, actionItems.size());
EmailContent content = styleableContentService.generateImmediateReminder(user, actionItems.iterator().next(), KEWServiceLocator.getDocumentTypeService().findByName(actionItems.iterator().next().getDocName()));
assertTrue("Unexpected subject", content.getSubject().startsWith("CUSTOM:"));
assertTrue("Unexpected body", content.getBody().startsWith("CUSTOM:"));
content = styleableContentService.generateDailyReminder(user, actionItems);
assertTrue("Unexpected subject", content.getSubject().startsWith("CUSTOM:"));
assertTrue("Unexpected body", content.getBody().startsWith("CUSTOM:"));
content = styleableContentService.generateWeeklyReminder(user, actionItems);
assertTrue("Unexpected subject", content.getSubject().startsWith("CUSTOM:"));
assertTrue("Unexpected body", content.getBody().startsWith("CUSTOM:"));
}
示例6: validateActionRules
import org.kuali.rice.kew.service.KEWServiceLocator; //导入依赖的package包/类
@Override
public String validateActionRules(List<ActionRequestValue> actionRequests) {
if (!getRouteHeader().isValidActionToTake(getActionPerformedCode())) {
return "Document of status '" + getRouteHeader().getDocRouteStatus() + "' cannot taken action '" + ActionType.fromCode(this.getActionTakenCode()).getLabel() + "' to node name " + this.nodeName;
}
// validate that recall action can be taken given prior actions taken
String errMsg = validateActionsTaken(getRouteHeader());
if (errMsg != null) {
return errMsg;
}
// validate that the doc will actually route to anybody
errMsg = validateRouting(getRouteHeader());
if (errMsg != null) {
return errMsg;
}
if (!KEWServiceLocator.getDocumentTypePermissionService().canRecall(getPrincipal().getPrincipalId(), getRouteHeader())) {
return "User is not authorized to Recall document";
}
return "";
}
示例7: activateRequest
import org.kuali.rice.kew.service.KEWServiceLocator; //导入依赖的package包/类
protected boolean activateRequest(RouteContext context, ActionRequestValue actionRequest,
RouteNodeInstance nodeInstance, List<ActionItem> generatedActionItems) {
if (actionRequest.isRoleRequest()) {
List<ActionRequestValue> actionRequests =
KEWServiceLocator.getActionRequestService().findPendingRootRequestsByDocIdAtRouteNode(
actionRequest.getDocumentId(), nodeInstance.getRouteNodeInstanceId());
for (ActionRequestValue siblingRequest : actionRequests) {
if (actionRequest.getRoleName().equals(siblingRequest.getRoleName())) {
KEWServiceLocator.getActionRequestService().activateRequestNoNotification(siblingRequest,
context.getActivationContext());
// the generated action items can be found in the activation context
generatedActionItems.addAll(context.getActivationContext().getGeneratedActionItems());
}
}
}
actionRequest = KEWServiceLocator.getActionRequestService().activateRequestNoNotification(actionRequest,
context.getActivationContext());
// the generated action items can be found in the activation context
generatedActionItems.addAll(context.getActivationContext().getGeneratedActionItems());
return actionRequest.isApproveOrCompleteRequest() && !actionRequest.isDone();
}
示例8: testBlanketApproveParallel
import org.kuali.rice.kew.service.KEWServiceLocator; //导入依赖的package包/类
@Test public void testBlanketApproveParallel() throws Exception {
WorkflowDocument document = WorkflowDocumentFactory.createDocument(getPrincipalIdForName(TEST_USER_EWESTFAL), ParallelSetup.DOCUMENT_TYPE_NAME);
document.blanketApprove("");
document = WorkflowDocumentFactory.loadDocument(getPrincipalIdForName(TEST_USER_EWESTFAL), document.getDocumentId());
assertTrue("Document should be processed.", document.isProcessed());
Collection nodeInstances = getRouteNodeService().getActiveNodeInstances(document.getDocumentId());
// once the document has gone processed there are no active nodes
assertEquals("Wrong number of active nodes.", 0, nodeInstances.size());
nodeInstances = getRouteNodeService().getTerminalNodeInstances(document.getDocumentId());
assertEquals("Wrong number of terminal nodes.", 1, nodeInstances.size());
RouteNodeInstance ackNodeInstance = (RouteNodeInstance)nodeInstances.iterator().next();
assertEquals("At wrong node.", SequentialSetup.ACKNOWLEDGE_2_NODE, ackNodeInstance.getRouteNode().getRouteNodeName());
assertTrue("Node should be complete.", ackNodeInstance.isComplete());
List actionRequests = KEWServiceLocator.getActionRequestService().findPendingByDoc(document.getDocumentId());
assertEquals("Wrong number of pending action requests.", 10, actionRequests.size());
}
示例9: load
import org.kuali.rice.kew.service.KEWServiceLocator; //导入依赖的package包/类
public Object load(Property property, final RouteContext context) {
XPath xpath = XPathHelper.newXPath();
final BranchService branchService = KEWServiceLocator.getBranchService();
xpath.setXPathVariableResolver(new XPathVariableResolver() {
public Object resolveVariable(QName name) {
LOG.debug("Resolving XPath variable: " + name);
String value = branchService.getScopedVariableValue(context.getNodeInstance().getBranch(), BranchState.VARIABLE_PREFIX + name.getLocalPart());
LOG.debug("Resolved XPath variable " + name + " to " + value);
return value;
}
});
try {
String docContent = context.getDocument().getDocContent();
LOG.debug("Executing xpath expression '" + property.locator + "' in doc '" + docContent + "'");
return xpath.evaluate(property.locator, new InputSource(new StringReader(docContent)), XPathConstants.STRING);
} catch (XPathExpressionException xpee) {
throw new RuntimeException("Error evaluating xpath expression '" + property.locator + "'", xpee);
}
}
示例10: takeGroupAuthority
import org.kuali.rice.kew.service.KEWServiceLocator; //导入依赖的package包/类
@Override
public DocumentActionResult takeGroupAuthority(DocumentActionParameters parameters,
final String groupId) {
incomingParamCheck(parameters, "parameters");
incomingParamCheck(groupId, "groupId");
return executeActionInternal(parameters,
new StandardDocumentActionCallback() {
public DocumentRouteHeaderValue doInDocumentBo(DocumentRouteHeaderValue documentBo,
String principalId, String annotation) throws WorkflowException {
return KEWServiceLocator.getWorkflowDocumentService().takeGroupAuthority(principalId,
documentBo, groupId, annotation);
}
public String getActionName() {
return ActionType.TAKE_GROUP_AUTHORITY.getLabel();
}
});
}
示例11: loadRows
import org.kuali.rice.kew.service.KEWServiceLocator; //导入依赖的package包/类
private void loadRows() {
getRoles().clear();
if (getRuleTemplateId() != null) {
RuleTemplateBo ruleTemplate = getRuleTemplateService().findByRuleTemplateId(getRuleTemplateId());
if (ruleTemplate != null) {
setRuleTemplateName(ruleTemplate.getName());
List<RuleTemplateAttributeBo> ruleTemplateAttributes = ruleTemplate.getActiveRuleTemplateAttributes();
Collections.sort(ruleTemplateAttributes);
List<Row> rows = new ArrayList<Row>();
for (RuleTemplateAttributeBo ruleTemplateAttribute : ruleTemplateAttributes) {
if (!ruleTemplateAttribute.isWorkflowAttribute()) {
continue;
}
WorkflowRuleAttributeRows workflowRuleAttributeRows =
KEWServiceLocator.getWorkflowRuleAttributeMediator().getRuleRows(getFieldMap(ruleTemplateAttribute.getId()), ruleTemplateAttribute);
rows.addAll(workflowRuleAttributeRows.getRows());
getRoles().addAll(KEWServiceLocator.getWorkflowRuleAttributeMediator().getRoleNames(ruleTemplateAttribute));
}
setRows(rows);
}
}
}
示例12: testFalseInitiatorMustSavePolicy
import org.kuali.rice.kew.service.KEWServiceLocator; //导入依赖的package包/类
/**
* Tests for when INITIATOR_MUST_SAVE policy is equal to false. In this case if non-initiator user
* attempts a save of a document with this policy an exception should NOT be thrown
*/
@Test public void testFalseInitiatorMustSavePolicy() throws Exception {
WorkflowDocument document = WorkflowDocumentFactory.createDocument(getPrincipalIdForName("ewestfal"), DOCUMENT_TYPE_NAME_NON_INITIATOR);
document.saveDocumentData();
// verify that there are no requests that have been generated
List actionRequests = KEWServiceLocator.getActionRequestService().findAllActionRequestsByDocumentId(document.getDocumentId());
assertEquals("There should be no action requests.", 0, actionRequests.size());
// try saving as a user who's not ewestfal
document = WorkflowDocumentFactory.loadDocument(getPrincipalIdForName("rkirkend"), document.getDocumentId());
assertTrue(document.isInitiated());
document.saveDocument("");
// ensure that the document was saved and the request was generated
assertTrue(document.isSaved());
actionRequests = KEWServiceLocator.getActionRequestService().findAllActionRequestsByDocumentId(document.getDocumentId());
assertEquals("There should be one action request.", 1, actionRequests.size());
}
示例13: testFilteringInitiator
import org.kuali.rice.kew.service.KEWServiceLocator; //导入依赖的package包/类
@Test public void testFilteringInitiator() throws Exception {
String documentType = "SecurityDoc_InitiatorOnly";
String initiator = getPrincipalId(STANDARD_USER_NETWORK_ID);
WorkflowDocument document = WorkflowDocumentFactory.createDocument(initiator, documentType);
document.route("");
assertFalse("Document should not be in init status after routing", document.isInitiated());
DocumentSearchCriteria.Builder criteria = DocumentSearchCriteria.Builder.create();
criteria.setDocumentId(document.getDocumentId());
DocumentSearchResults results = KEWServiceLocator.getDocumentSearchService().lookupDocuments(initiator, criteria.build());
assertEquals("Should retrive one record from search", 1, results.getSearchResults().size());
assertEquals("No rows should have been filtered due to security", 0, results.getNumberOfSecurityFilteredResults());
criteria = DocumentSearchCriteria.Builder.create();
criteria.setDocumentId(document.getDocumentId());
results = KEWServiceLocator.getDocumentSearchService().lookupDocuments(getPrincipalId("user3"), criteria.build());
assertEquals("Should retrive no records from search", 0, results.getSearchResults().size());
assertEquals("One row should have been filtered due to security", 1, results.getNumberOfSecurityFilteredResults());
criteria = DocumentSearchCriteria.Builder.create();
criteria.setDocumentId(document.getDocumentId());
results = KEWServiceLocator.getDocumentSearchService().lookupDocuments(getPrincipalId(WORKFLOW_ADMIN_USER_NETWORK_ID), criteria.build());
assertEquals("Should retrive one record from search", 1, results.getSearchResults().size());
assertEquals("No rows should have been filtered due to security", 0, results.getNumberOfSecurityFilteredResults());
}
示例14: deleteNotificationSuppression
import org.kuali.rice.kew.service.KEWServiceLocator; //导入依赖的package包/类
/**
* This method removes all NodeStates related to notification suppression, saving the RouteNodeInstance if there
* were any removed.
*
* @param routeNodeInstance
*/
@SuppressWarnings("unchecked")
private void deleteNotificationSuppression(
final RouteNodeInstance routeNodeInstance) {
// remove all suppress notification node states
List<NodeState> nodeStates = routeNodeInstance.getState();
if (nodeStates != null && nodeStates.size() > 0) {
List<String> nodeStateKeysToRemove = new ArrayList<String>(nodeStates.size());
for (NodeState nodeState : nodeStates) {
if (nodeState.getKey().startsWith(NotificationSuppression.SUPPRESS_NOTIFY_KEY_START)) {
nodeStateKeysToRemove.add(nodeState.getKey());
}
}
if (nodeStateKeysToRemove.size() > 0) {
for (String nodeStateKeyToRemove : nodeStateKeysToRemove) {
routeNodeInstance.removeNodeState(nodeStateKeyToRemove);
}
KEWServiceLocator.getRouteNodeService().save(routeNodeInstance);
}
}
}
示例15: testReResolveRole
import org.kuali.rice.kew.service.KEWServiceLocator; //导入依赖的package包/类
@Test public void testReResolveRole() throws Exception {
DocumentRouteHeaderValue loadedDocument = KEWServiceLocator.getRouteHeaderService().getRouteHeader(documentId);
assertEquals(KewApiConstants.ROUTE_HEADER_ENROUTE_CD, loadedDocument.getDocRouteStatus());
List<ActionRequestValue> requests = getTestRoleRequests(loadedDocument);
assertEquals("Incorrect number of role control requests.", 2, requests.size());
assertRequestGraphs(requests);
// change membership in TEST_GROUP_1 and TEST_GROUP_2
List<String> newGroup1 = new ArrayList<String>();
List<String> newGroup2 = new ArrayList<String>();
newGroup2.add(getPrincipalIdForName("ewestfal"));
newGroup2.add(getPrincipalIdForName("jthomas"));
// TEST_GROUP_1 should now be an empty role, therefore there should not be a request generated for it after re-resolution
TestRuleAttribute.setRecipientPrincipalIds(TEST_ROLE, TEST_GROUP_1, newGroup1);
TestRuleAttribute.setRecipientPrincipalIds(TEST_ROLE, TEST_GROUP_2, newGroup2);
// re-resolve entire role
roleService.reResolveRole(loadedDocument, TEST_ROLE);
loadedDocument = KEWServiceLocator.getRouteHeaderService().getRouteHeader(documentId);
assertEquals(KewApiConstants.ROUTE_HEADER_ENROUTE_CD, loadedDocument.getDocRouteStatus());
requests = getTestRoleRequests(loadedDocument);
// should be 1 because group 1 has no members
assertEquals("Incorrect number of role control requests.", 1, requests.size());
assertRequestGraphs(requests);
}