本文整理汇总了Java中org.kuali.rice.kew.service.KEWServiceLocator.getService方法的典型用法代码示例。如果您正苦于以下问题:Java KEWServiceLocator.getService方法的具体用法?Java KEWServiceLocator.getService怎么用?Java KEWServiceLocator.getService使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类org.kuali.rice.kew.service.KEWServiceLocator
的用法示例。
在下文中一共展示了KEWServiceLocator.getService方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: testStatsService
import org.kuali.rice.kew.service.KEWServiceLocator; //导入方法依赖的package包/类
@Test
public void testStatsService() throws Exception{
StatsService statsService = KEWServiceLocator.getService(KEWServiceLocator.STATS_SERVICE);
Stats stats = new Stats();
statsService.NumActiveItemsReport(stats);
statsService.DocumentsRoutedReport(stats, new java.util.Date(System.currentTimeMillis()),new java.util.Date(System.currentTimeMillis()));
statsService.NumberOfDocTypesReport(stats);
statsService.NumInitiatedDocsByDocTypeReport(stats);
statsService.NumUsersReport(stats);
assertTrue("Stats object populated", stats != null &&
StringUtils.equals(stats.getNumActionItems(),"0") &&
stats.getNumInitiatedDocsByDocType().size() == 0);
assertTrue("Number of document types", StringUtils.equals(stats.getNumDocTypes(),"6"));
}
示例2: isMatch
import org.kuali.rice.kew.service.KEWServiceLocator; //导入方法依赖的package包/类
@Override
public boolean isMatch(DocumentContent docContent, List<RuleExtension> ruleExtensions) {
setDoctypeName(getRuleDocumentTypeFromRuleExtensions(ruleExtensions));
DocumentTypeService service = (DocumentTypeService) KEWServiceLocator.getService(KEWServiceLocator.DOCUMENT_TYPE_SERVICE);
try {
String docTypeName = getDocTypNameFromXML(docContent);
if (docTypeName.equals(getDoctypeName())) {
return true;
}
DocumentType documentType = service.findByName(docTypeName);
while (documentType != null && documentType.getParentDocType() != null) {
documentType = documentType.getParentDocType();
if(documentType.getName().equals(getDoctypeName())){
return true;
}
}
} catch (XPathExpressionException e) {
throw new WorkflowRuntimeException(e);
}
if (ruleExtensions.isEmpty()) {
return true;
}
return false;
}
示例3: getRuleDelegationService
import org.kuali.rice.kew.service.KEWServiceLocator; //导入方法依赖的package包/类
private RuleDelegationService getRuleDelegationService() {
return (RuleDelegationService) KEWServiceLocator.getService(KEWServiceLocator.RULE_DELEGATION_SERVICE);
}
示例4: execute
import org.kuali.rice.kew.service.KEWServiceLocator; //导入方法依赖的package包/类
@Override
public ActionForward execute(ActionMapping mapping, ActionForm form, HttpServletRequest request, HttpServletResponse response) throws Exception {
DocHandlerForm docHandlerForm = (DocHandlerForm) form;
String docHandler = null;
if (request.getParameter(KewApiConstants.DOCUMENT_ID_PARAMETER) != null) {
RouteHeaderService rhSrv = (RouteHeaderService) KEWServiceLocator.getService(KEWServiceLocator.DOC_ROUTE_HEADER_SRV);
DocumentRouteHeaderValue routeHeader = rhSrv.getRouteHeader(docHandlerForm.getDocId());
if (!KEWServiceLocator.getDocumentSecurityService().routeLogAuthorized(GlobalVariables.getUserSession().getPrincipalId(), routeHeader, new SecuritySession(GlobalVariables.getUserSession().getPrincipalId()))) {
return mapping.findForward("NotAuthorized");
}
docHandler = routeHeader.getDocumentType().getResolvedDocumentHandlerUrl();
if (StringUtils.isBlank(docHandler)) {
throw new WorkflowRuntimeException("Document Type '" + routeHeader.getDocumentType().getName() + "' does not have a document handler url set (attempted to open document handler url for document id " + routeHeader.getDocumentId() + ")");
}
if (!docHandler.contains("?")) {
docHandler += "?";
} else {
docHandler += "&";
}
docHandler += KewApiConstants.DOCUMENT_ID_PARAMETER + "=" + docHandlerForm.getDocId();
if (StringUtils.isNotBlank(routeHeader.getAppDocId())) {
docHandler += "&" + KewApiConstants.APP_DOC_ID_PARAMETER + "=" + URLEncoder.encode(routeHeader.getAppDocId(), "UTF-8");
}
} else if (request.getParameter(KewApiConstants.DOCTYPE_PARAMETER) != null) {
DocumentTypeService documentTypeService = (DocumentTypeService) KEWServiceLocator.getService(KEWServiceLocator.DOCUMENT_TYPE_SERVICE);
DocumentType documentType = documentTypeService.findByName(docHandlerForm.getDocTypeName());
docHandler = documentType.getResolvedDocumentHandlerUrl();
if (StringUtils.isBlank(docHandler)) {
throw new WorkflowRuntimeException("Cannot find document handler url for document type '" + documentType.getName() + "'");
}
if (!docHandler.contains("?")) {
docHandler += "?";
} else {
docHandler += "&";
}
docHandler += KewApiConstants.DOCTYPE_PARAMETER + "=" + docHandlerForm.getDocTypeName();
} else {
//TODO what should happen here if parms are missing; no proper ActionForward from here
throw new RuntimeException ("Cannot determine document handler");
}
docHandler += "&" + KewApiConstants.COMMAND_PARAMETER + "=" + docHandlerForm.getCommand();
if (getUserSession(request).isBackdoorInUse()) {
docHandler += "&" + KewApiConstants.BACKDOOR_ID_PARAMETER + "=" + getUserSession(request).getPrincipalName();
}
return new ActionForward(docHandler, true);
}
示例5: getDocumentTypeService
import org.kuali.rice.kew.service.KEWServiceLocator; //导入方法依赖的package包/类
private DocumentTypeService getDocumentTypeService() {
return (DocumentTypeService) KEWServiceLocator.getService(KEWServiceLocator.DOCUMENT_TYPE_SERVICE);
}
示例6: getRuleTemplateService
import org.kuali.rice.kew.service.KEWServiceLocator; //导入方法依赖的package包/类
protected RuleTemplateService getRuleTemplateService() {
return (RuleTemplateService) KEWServiceLocator.getService(KEWServiceLocator.RULE_TEMPLATE_SERVICE);
}
示例7: getDocumentSearchService
import org.kuali.rice.kew.service.KEWServiceLocator; //导入方法依赖的package包/类
public DocumentSearchService getDocumentSearchService() {
return ((DocumentSearchService) KEWServiceLocator.getService(KEWServiceLocator.DOCUMENT_SEARCH_SERVICE));
}
示例8: getService
import org.kuali.rice.kew.service.KEWServiceLocator; //导入方法依赖的package包/类
protected Object getService(String serviceName) {
return KEWServiceLocator.getService(serviceName);
}
示例9: retrieveDocSearchSvc
import org.kuali.rice.kew.service.KEWServiceLocator; //导入方法依赖的package包/类
@Before
public void retrieveDocSearchSvc() {
docSearchService = (DocumentSearchService) KEWServiceLocator.getService(KEWServiceLocator.DOCUMENT_SEARCH_SERVICE);
}
示例10: testRouteDocumentWithInvalidSearchableAttributeContent
import org.kuali.rice.kew.service.KEWServiceLocator; //导入方法依赖的package包/类
/**
* Tests searching with client-generated documentContent which will not match what the SearchableAttributeOld
* is configured to look for. This should pass with zero search results, but should not throw an exception.
* @throws Exception
*/
@Test public void testRouteDocumentWithInvalidSearchableAttributeContent() throws Exception {
String documentTypeName = "SearchDocType";
String key = "givenname";
DocumentType docType = ((DocumentTypeService)KEWServiceLocator.getService(KEWServiceLocator.DOCUMENT_TYPE_SERVICE)).findByName(documentTypeName);
WorkflowDocument workflowDocument = WorkflowDocumentFactory.createDocument(getPrincipalIdForName("rkirkend"), documentTypeName);
workflowDocument.setApplicationContent("<documentContent><searchableContent><garbage>" +
"<blah>not going to match anything</blah>" +
"</garbage></searchableContent></documentContent>");
workflowDocument.setTitle("Routing style");
workflowDocument.route("routing this document.");
DocumentSearchService docSearchService = (DocumentSearchService) KEWServiceLocator.getService(KEWServiceLocator.DOCUMENT_SEARCH_SERVICE);
Person user = KimApiServiceLocator.getPersonService().getPersonByPrincipalName("rkirkend");
DocumentSearchCriteria.Builder criteria = DocumentSearchCriteria.Builder.create();
criteria.setDocumentTypeName(documentTypeName);
addSearchableAttribute(criteria, key, "jack");
DocumentSearchResults results = docSearchService.lookupDocuments(user.getPrincipalId(),
criteria.build());
assertEquals("Search results should be empty.", 0, results.getSearchResults().size());
criteria = DocumentSearchCriteria.Builder.create();
criteria.setDocumentTypeName(documentTypeName);
addSearchableAttribute(criteria, key, "fred");
results = docSearchService.lookupDocuments(user.getPrincipalId(), criteria.build());
assertEquals("Search results should be empty.", 0, results.getSearchResults().size());
criteria = DocumentSearchCriteria.Builder.create();
criteria.setDocumentTypeName(documentTypeName);
addSearchableAttribute(criteria, "fakeproperty", "doesntexist");
try {
results = docSearchService.lookupDocuments(user.getPrincipalId(), criteria.build());
fail("Search results should be throwing a validation exception for use of non-existant searchable attribute");
} catch (RuntimeException wsee) {
assertTrue(wsee.getMessage().contains("LookupException"));
}
}
示例11: getDocumentTypeService
import org.kuali.rice.kew.service.KEWServiceLocator; //导入方法依赖的package包/类
private DocumentTypeService getDocumentTypeService() {
return (DocumentTypeService) KEWServiceLocator.getService(KEWServiceLocator.DOCUMENT_TYPE_SERVICE);
}
示例12: testDocumentSearchAttributeWildcarding
import org.kuali.rice.kew.service.KEWServiceLocator; //导入方法依赖的package包/类
@Test public void testDocumentSearchAttributeWildcarding() throws Exception {
DocumentSearchService docSearchService = (DocumentSearchService) KEWServiceLocator.getService(KEWServiceLocator.DOCUMENT_SEARCH_SERVICE);
String documentTypeName = "SearchDocType";
String key = "givenname";
DocumentType docType = ((DocumentTypeService)KEWServiceLocator.getService(KEWServiceLocator.DOCUMENT_TYPE_SERVICE)).findByName(
documentTypeName);
WorkflowDocument workflowDocument = WorkflowDocumentFactory.createDocument(getPrincipalIdForName("rkirkend"),
documentTypeName);
WorkflowAttributeDefinition.Builder givennameXMLDef = WorkflowAttributeDefinition.Builder.create("XMLSearchableAttribute");
workflowDocument.setApplicationContent("<test></test>");
givennameXMLDef.addPropertyDefinition(key, "jack");
workflowDocument.addSearchableDefinition(givennameXMLDef.build());
workflowDocument.setTitle("Routing style");
workflowDocument.route("routing this document.");
Person user = KimApiServiceLocator.getPersonService().getPersonByPrincipalName("rkirkend");
DocumentSearchCriteria.Builder criteria = DocumentSearchCriteria.Builder.create();
criteria.setDocumentTypeName(documentTypeName);
addSearchableAttribute(criteria, key, "jack");
DocumentSearchResults results = docSearchService.lookupDocuments(user.getPrincipalId(), criteria.build());
assertEquals("Search results should have one document.", 1, results.getSearchResults().size());
criteria = DocumentSearchCriteria.Builder.create();
criteria.setDocumentTypeName(documentTypeName);
addSearchableAttribute(criteria, key, "ja*");
results = docSearchService.lookupDocuments(user.getPrincipalId(), criteria.build());
assertEquals("Search results should have one document.", 1, results.getSearchResults().size());
criteria = DocumentSearchCriteria.Builder.create();
criteria.setDocumentTypeName(documentTypeName);
addSearchableAttribute(criteria, key, "ja");
results = docSearchService.lookupDocuments(user.getPrincipalId(), criteria.build());
assertEquals("Search results should have one document.", 0, results.getSearchResults().size());
criteria = DocumentSearchCriteria.Builder.create();
criteria.setDocumentTypeName(documentTypeName);
addSearchableAttribute(criteria, key, "*ack");
results = docSearchService.lookupDocuments(user.getPrincipalId(), criteria.build());
assertEquals("Search results should have one document.", 1, results.getSearchResults().size());
}
示例13: testRouteDocumentWithMoreInvalidSearchableAttributeContent
import org.kuali.rice.kew.service.KEWServiceLocator; //导入方法依赖的package包/类
/**
* Tests searching with client-generated documentContent which will not match what the SearchableAttributeOld
* is configured to look for. This should pass with zero search results, but should not throw an exception.
* @throws Exception
*/
@Test public void testRouteDocumentWithMoreInvalidSearchableAttributeContent() throws Exception {
String documentTypeName = "SearchDocType";
String key = "givenname";
DocumentType docType = ((DocumentTypeService)KEWServiceLocator.getService(KEWServiceLocator.DOCUMENT_TYPE_SERVICE)).findByName(documentTypeName);
WorkflowDocument workflowDocument = WorkflowDocumentFactory.createDocument(getPrincipalIdForName("rkirkend"), documentTypeName);
workflowDocument.setApplicationContent("<documentContent><NOTsearchableContent><garbage>" +
"<blah>not going to match anything</blah>" +
"</garbage></NOTsearchableContent></documentContent>");
workflowDocument.setTitle("Routing style");
workflowDocument.route("routing this document.");
DocumentSearchService docSearchService = (DocumentSearchService) KEWServiceLocator.getService(KEWServiceLocator.DOCUMENT_SEARCH_SERVICE);
Person user = KimApiServiceLocator.getPersonService().getPersonByPrincipalName("rkirkend");
DocumentSearchCriteria.Builder criteria = DocumentSearchCriteria.Builder.create();
criteria.setDocumentTypeName(documentTypeName);
addSearchableAttribute(criteria, key, "jack");
DocumentSearchResults results = docSearchService.lookupDocuments(user.getPrincipalId(),
criteria.build());
assertEquals("Search results should be empty.", 0, results.getSearchResults().size());
criteria = DocumentSearchCriteria.Builder.create();
criteria.setDocumentTypeName(documentTypeName);
addSearchableAttribute(criteria, key, "fred");
results = docSearchService.lookupDocuments(user.getPrincipalId(), criteria.build());
assertEquals("Search results should be empty.", 0, results.getSearchResults().size());
criteria = DocumentSearchCriteria.Builder.create();
criteria.setDocumentTypeName(documentTypeName);
addSearchableAttribute(criteria, "fakeproperty", "doesntexist");
try {
results = docSearchService.lookupDocuments(user.getPrincipalId(), criteria.build());
fail("Search results should be throwing a validation exception for use of non-existant searchable attribute");
} catch (RuntimeException wsee) {
assertTrue(wsee.getMessage().contains("LookupException"));
}
}
示例14: getRuleTemplateService
import org.kuali.rice.kew.service.KEWServiceLocator; //导入方法依赖的package包/类
private RuleTemplateService getRuleTemplateService() {
return (RuleTemplateService) KEWServiceLocator.getService(KEWServiceLocator.RULE_TEMPLATE_SERVICE);
}
示例15: testSearchAttributesAcrossDocumentTypeVersions
import org.kuali.rice.kew.service.KEWServiceLocator; //导入方法依赖的package包/类
/**
* Tests searching documents with searchable attributes
* @throws org.kuali.rice.kew.api.exception.WorkflowException
*/
@Test public void testSearchAttributesAcrossDocumentTypeVersions() throws Exception {
// first test searching for an initial version of the doc which does not have a searchable attribute
loadXmlFile("testdoc0.xml");
String documentTypeName = "SearchDoc";
WorkflowDocument doc = WorkflowDocumentFactory.createDocument(getPrincipalIdForName("arh14"), documentTypeName);
DocumentType docType = ((DocumentTypeService)KEWServiceLocator.getService(KEWServiceLocator.DOCUMENT_TYPE_SERVICE)).findByName(documentTypeName);
doc.route("routing");
DocumentSearchService docSearchService = (DocumentSearchService) KEWServiceLocator.getService(KEWServiceLocator.DOCUMENT_SEARCH_SERVICE);
DocumentSearchCriteria.Builder criteria = DocumentSearchCriteria.Builder.create();
criteria.setDocumentTypeName(documentTypeName);
criteria.setDateCreatedFrom(new DateTime(2004, 1, 1, 0, 0));
Person user = KimApiServiceLocator.getPersonService().getPersonByPrincipalName("arh14");
DocumentSearchResults results = docSearchService.lookupDocuments(user.getPrincipalId(), criteria.build());
assertEquals(1, results.getSearchResults().size());
// now upload the new version with a searchable attribute
loadXmlFile("testdoc1.xml");
docType = ((DocumentTypeService)KEWServiceLocator.getService(KEWServiceLocator.DOCUMENT_TYPE_SERVICE)).findByName(documentTypeName);
// route a new doc
doc = WorkflowDocumentFactory.createDocument(getPrincipalIdForName("arh14"), documentTypeName);
doc.route("routing");
// with no attribute criteria, both docs should be found
criteria = DocumentSearchCriteria.Builder.create();
criteria.setDocumentTypeName(documentTypeName);
criteria.setDateCreatedFrom(new DateTime(2004, 1, 1, 0, 0));
results = docSearchService.lookupDocuments(user.getPrincipalId(), criteria.build());
assertEquals(2, results.getSearchResults().size());
// search with specific SearchableAttributeOld value
criteria = DocumentSearchCriteria.Builder.create();
criteria.setDocumentTypeName(documentTypeName);
criteria.setDateCreatedFrom(new DateTime(2004, 1, 1, 0, 0));
addSearchableAttribute(criteria, "MockSearchableAttributeKey", "MockSearchableAttributeValue");
results = docSearchService.lookupDocuments(user.getPrincipalId(), criteria.build());
assertEquals(1, results.getSearchResults().size());
// search with any SearchableAttributeOld value
criteria = DocumentSearchCriteria.Builder.create();
criteria.setDocumentTypeName(documentTypeName);
criteria.setDateCreatedFrom(new DateTime(2004, 1, 1, 0, 0));
results = docSearchService.lookupDocuments(user.getPrincipalId(), criteria.build());
assertEquals(2, results.getSearchResults().size());
}