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


Java KEWServiceLocator.getDocumentTypeService方法代码示例

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


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

示例1: getDocumentTypeService

import org.kuali.rice.kew.service.KEWServiceLocator; //导入方法依赖的package包/类
/**
 * @return the documentTypeService
 */
public DocumentTypeService getDocumentTypeService() {
	if ( documentTypeService == null ) {
		documentTypeService = KEWServiceLocator.getDocumentTypeService();
	}
	return documentTypeService;
}
 
开发者ID:kuali,项目名称:kc-rice,代码行数:10,代码来源:DocumentConfigurationViewAction.java

示例2: getDocTypeFullNameWhereSql

import org.kuali.rice.kew.service.KEWServiceLocator; //导入方法依赖的package包/类
public String getDocTypeFullNameWhereSql(DocumentSearchCriteria criteria, String whereClausePredicatePrefix) {
    List<String> documentTypeNamesToSearch = new ArrayList<String>();
    String primaryDocumentTypeName = criteria.getDocumentTypeName();
    if (StringUtils.isNotBlank(primaryDocumentTypeName)) {
        documentTypeNamesToSearch.add(primaryDocumentTypeName);
    }
    documentTypeNamesToSearch.addAll(criteria.getAdditionalDocumentTypeNames());
    StringBuilder returnSql = new StringBuilder("");
    if (CollectionUtils.isNotEmpty(documentTypeNamesToSearch)) {
        int index = 0;
        for (String documentTypeName : documentTypeNamesToSearch) {
            if (StringUtils.isNotBlank(documentTypeName)) {
                String clause = index++ == 0 ? "" : " or ";
                DocumentTypeService docSrv = KEWServiceLocator.getDocumentTypeService();
                DocumentType docType = docSrv.findByNameCaseInsensitive(documentTypeName.trim());
                if (docType != null) {
                    if (documentTypeName.contains("*") || documentTypeName.contains("%")) {
                        addDocumentTypeLikeNameToSearchOn(returnSql, documentTypeName.trim(), clause);
                    } else {
                        addDocumentTypeNameToSearchOn(returnSql, documentTypeName.trim(), clause);
                    }
                    if (docType.getChildrenDocTypes() != null) {
                        addChildDocumentTypes(returnSql, docType.getChildrenDocTypes());
                    }
                } else{
                    addDocumentTypeLikeNameToSearchOn(returnSql, documentTypeName.trim(), clause);
                }
            }
        }
    }
    if (returnSql.length() > 0) {
        returnSql.insert(0, "(");
        returnSql.insert(0, whereClausePredicatePrefix);
        returnSql.append(")");
    }
    return returnSql.toString();
}
 
开发者ID:kuali,项目名称:kc-rice,代码行数:38,代码来源:DocumentSearchGeneratorImpl.java

示例3: verifyDocumentTypeLinking

import org.kuali.rice.kew.service.KEWServiceLocator; //导入方法依赖的package包/类
protected void verifyDocumentTypeLinking() throws Exception {
  	DocumentTypeService service = KEWServiceLocator.getDocumentTypeService();
  	List rootDocs = service.findAllCurrentRootDocuments();
  	int numRoots = rootDocs.size();
  	List documentTypes = service.findAllCurrent();
  	List<DocumentType> leafs = new ArrayList<DocumentType>();
  	for (Iterator iterator = documentTypes.iterator(); iterator.hasNext();) {
	DocumentType documentType = (DocumentType) iterator.next();
	// check that all document types with parents are current
	if (KRADUtils.isNotNull(documentType.getParentDocType())) {
	    assertEquals("Parent of document type '" + documentType.getName() + "' should be Current", Boolean.TRUE, documentType.getParentDocType().getCurrentInd());
	}
	List children = service.getChildDocumentTypes(documentType.getDocumentTypeId());
	if (children.isEmpty()) {
		leafs.add(documentType);
	} else {
           // check that all child document types are current
	    for (Iterator iterator2 = children.iterator(); iterator2.hasNext();) {
                  DocumentType childDocType = (DocumentType) iterator2.next();
                  assertEquals("Any child document type should be Current", Boolean.TRUE, childDocType.getCurrentInd());
              }
	}
}
  	Set<String> rootDocIds = new HashSet<String>();
  	// verify the hierarchy
  	for (DocumentType leaf : leafs) {
	verifyHierarchy(leaf, rootDocIds);
}
  	// we should have the same number of roots as we did from the original roots query
  	assertEquals("Should have the same number of roots", numRoots, rootDocIds.size());
  }
 
开发者ID:kuali,项目名称:kc-rice,代码行数:32,代码来源:DocumentTypeTest.java

示例4: testMaintainableSave_PreserveRouteNodes

import org.kuali.rice.kew.service.KEWServiceLocator; //导入方法依赖的package包/类
/**
 * This method tests to make sure that the {@link DocumentType#getApplyRetroactively()} method
 * does not throw a {@link NullPointerException}
 */
@Test public void testMaintainableSave_PreserveRouteNodes() throws Exception {
    loadXmlFile("DocTypeMaintainableConfig.xml");
    DocumentTypeService docTypeService = KEWServiceLocator.getDocumentTypeService();
    DocumentType documentType = docTypeService.findByName(TemporaryDocumentType.NAME);
    assertEquals("Wrong number of route nodes", 2, KEWServiceLocator.getRouteNodeService().getFlattenedNodes(documentType, false).size());
    documentType.setApplyRetroactively(null);
    saveDocumentTypeUsingMaintainable(documentType);
    documentType = docTypeService.findByName(TemporaryDocumentType.NAME);
    assertEquals("Document type should be current", Boolean.TRUE, documentType.getCurrentInd());
    List flattenedNodes = KEWServiceLocator.getRouteNodeService().getFlattenedNodes(documentType, false);
    assertEquals("Wrong number of route nodes", 2, flattenedNodes.size());
}
 
开发者ID:kuali,项目名称:kc-rice,代码行数:17,代码来源:DocumentTypeMaintainableTest.java

示例5: testApplyRetroactiveNull

import org.kuali.rice.kew.service.KEWServiceLocator; //导入方法依赖的package包/类
/**
 * This method tests to make sure that the {@link DocumentType#getApplyRetroactively()} method
 * does not throw a {@link NullPointerException}
 */
@Test public void testApplyRetroactiveNull() throws Exception {
    loadXmlFile("DocTypeMaintainableConfig.xml");
    DocumentTypeService docTypeService = KEWServiceLocator.getDocumentTypeService();
    DocumentType documentType = docTypeService.findByName(TemporaryDocumentType.NAME);
    documentType.setApplyRetroactively(null);
    saveDocumentTypeUsingMaintainable(documentType);
}
 
开发者ID:kuali,项目名称:kc-rice,代码行数:12,代码来源:DocumentTypeMaintainableTest.java

示例6: setUp

import org.kuali.rice.kew.service.KEWServiceLocator; //导入方法依赖的package包/类
@Before
public void setUp() throws Exception {
    super.setUp();
    ddService = KRADServiceLocatorWeb.getDataDictionaryService();
    dtService = KEWServiceLocator.getDocumentTypeService();
}
 
开发者ID:kuali,项目名称:kc-rice,代码行数:7,代码来源:DataDictionaryTest.java

示例7: getDocumentTypeService

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

示例8: saveBusinessObject

import org.kuali.rice.kew.service.KEWServiceLocator; //导入方法依赖的package包/类
/**
 * This is a complete override which does not call into
 * {@link KualiMaintainableImpl}. This method calls
 * {@link DocumentTypeService#versionAndSave(DocumentType)}.
 *
 */
@Override
public void saveBusinessObject() {
    DocumentTypeService docTypeService = KEWServiceLocator.getDocumentTypeService();
    DocumentType newDocumentType = (DocumentType) getBusinessObject();
    String documentTypeName = newDocumentType.getName();
    DocumentType docTypeFromDatabase = docTypeService.findByName(documentTypeName);
    if (docTypeFromDatabase == null) {
        docTypeService.versionAndSave(newDocumentType);
    }
    else {
        Boolean applyRetroactively = newDocumentType.getApplyRetroactively();
    	DocumentType newDocumentTypeFromDatabase;
        DocumentTypeXmlParser parser = new DocumentTypeXmlParser();
        try {
            newDocumentTypeFromDatabase = parser.generateNewDocumentTypeFromExisting(documentTypeName);
        } catch (Exception e) {
            throw new WorkflowRuntimeException("Error while attempting to generate new document type from existing " +
            		"database document type with name '" + documentTypeName + "'", e);
        }
        newDocumentTypeFromDatabase.populateDataDictionaryEditableFields(constructUserInterfaceEditablePropertyNamesList(), newDocumentType);
        docTypeService.versionAndSave(newDocumentTypeFromDatabase);
        if (KRADUtils.isNotNull(applyRetroactively) && applyRetroactively.booleanValue()) {
            // save all previous instances of document type with the same name
            // fields: label, description, unresolvedHelpDefinitionUrl
            List<DocumentType> previousDocTypeInstances = docTypeService.findPreviousInstances(documentTypeName);
            for (DocumentType prevDocType : previousDocTypeInstances) {
                // set up fields
                prevDocType.setLabel(newDocumentType.getLabel());
                prevDocType.setDescription(newDocumentType.getDescription());
                prevDocType.setUnresolvedHelpDefinitionUrl(newDocumentType.getUnresolvedHelpDefinitionUrl());
                prevDocType.setUnresolvedDocSearchHelpUrl(newDocumentType.getUnresolvedDocSearchHelpUrl());
                docTypeService.save(prevDocType);
            }
            // save all former/current action items matching document type name
            // fields: docLabel
            ActionListService actionListService = KEWServiceLocator.getActionListService(); 
            Collection<ActionItem> items = actionListService.findByDocumentTypeName(documentTypeName);
            for (ActionItem actionItem : items) {
                actionItem.setDocLabel(newDocumentType.getLabel());
                actionListService.saveActionItem(actionItem);
            }
            // save all former/current outbox action items matching document type name
            // fields: docLabel
            Collection<OutboxItem> outboxItems = actionListService.getOutboxItemsByDocumentType(documentTypeName);
            for (OutboxItem outboxItem : outboxItems) {
                outboxItem.setDocLabel(newDocumentType.getLabel());
                actionListService.saveOutboxItem(outboxItem);
            }
        }
    }
}
 
开发者ID:kuali,项目名称:kc-rice,代码行数:58,代码来源:DocumentTypeMaintainable.java

示例9: testApplyRetroactiveSave

import org.kuali.rice.kew.service.KEWServiceLocator; //导入方法依赖的package包/类
/**
 * This method tests the functionality of the 'apply retroactively' option on a document type
 * which should save certain fields to all former versions of a document type, action items, and
 * outbox items.
 */
@Test public void testApplyRetroactiveSave() throws Exception {
    DocumentTypeService docTypeService = KEWServiceLocator.getDocumentTypeService();
    // load the file multiple times to create multiple previous versions in the doc type table
    loadXmlFile("DocTypeMaintainableConfig.xml");
    loadXmlFile("DocTypeMaintainableConfig_Rule.xml"); // ingests just the rule
    loadXmlFile("DocTypeMaintainableConfig.xml");
    loadXmlFile("DocTypeMaintainableConfig.xml");
    assertEquals("Incorrect number of total document type instances for name " + TemporaryDocumentType.NAME, 2, docTypeService.findPreviousInstances(TemporaryDocumentType.NAME).size());

    // create a document and route it so we have at least one action item and one outbox item
    WorkflowDocument document = WorkflowDocumentFactory.createDocument(getPrincipalIdForName("ewestfal"), TemporaryDocumentType.NAME);
    document.route("Test Doc");
    String documentHeaderId = document.getDocumentId();
    assertTrue("Document should be ENROUTE", document.isEnroute());
    // verify routing worked properly
    // for the first user we should approve and verify that an outbox item has been created
    String userPrincipalName = TemporaryDocumentType.FIRST_NODE_APPROVER_1;
    turnOnOutboxForUser(getPrincipalIdForName(userPrincipalName));
    document = WorkflowDocumentFactory.loadDocument(getPrincipalIdForName(userPrincipalName), documentHeaderId);
    TestUtilities.assertAtNode("Document should be at the first 'requests' node", document, TemporaryDocumentType.FIRST_NODE_NAME);
    assertTrue("User " + userPrincipalName + " should have approval requested.", document.isApprovalRequested());
    document.approve("Test Approval");
    assertEquals("There should be an outbox item", 1, KEWServiceLocator.getActionListService().getOutbox(getPrincipalIdForName(userPrincipalName), new ActionListFilter()).size());
    TestUtilities.assertNotInActionList(getPrincipalIdForName(userPrincipalName), documentHeaderId);
    // for the second user we should not approve but verify an action item exists in the user's action list
    userPrincipalName = TemporaryDocumentType.FIRST_NODE_APPROVER_2;
    document = WorkflowDocumentFactory.loadDocument(getPrincipalIdForName(userPrincipalName), documentHeaderId);
    assertTrue("User " + userPrincipalName + " should have approval requested.", document.isApprovalRequested());
    TestUtilities.assertInActionList(getPrincipalIdForName(userPrincipalName), documentHeaderId);

    // load the document type and change the fields that can be retroactively applied
    DocumentType documentType = docTypeService.findByName(TemporaryDocumentType.NAME);
    documentType.setApplyRetroactively(Boolean.TRUE);
    String new_description = "Maintainable Test Document Type Description";
    documentType.setDescription(new_description);
    String new_label = "Maintainable Test Document Label";
    documentType.setLabel(new_label);
    String new_help_def_url = "http://test.kuali.org/helpdefinition";
    documentType.setUnresolvedHelpDefinitionUrl(new_help_def_url);

    saveDocumentTypeUsingMaintainable(documentType);
    // verify all previous version instances of the doc type have the updated fields
    for (DocumentType docTypeInstance : docTypeService.findPreviousInstances(TemporaryDocumentType.NAME)) {
        assertEquals("Label should have been applied retroactively to former document type versions", new_label, docTypeInstance.getLabel());
        assertEquals("Description should have been applied retroactively to former document type versions", new_description, docTypeInstance.getDescription());
        assertEquals("Unresolved Help Definition URL should have been applied retroactively to former document type versions", new_help_def_url, docTypeInstance.getUnresolvedHelpDefinitionUrl());
    }

    // verify that the outbox item was updated properly
    userPrincipalName = TemporaryDocumentType.FIRST_NODE_APPROVER_1;
    Collection<OutboxItem> outboxItems = KEWServiceLocator.getActionListService().getOutbox(getPrincipalIdForName(userPrincipalName), new ActionListFilter());
    assertEquals("There should be one outbox item", 1, outboxItems.size());
    OutboxItem outboxItem = outboxItems.iterator().next();
    assertEquals("The label on the outbox item should have been changed", new_label, outboxItem.getDocLabel());

    // verify that the action item was updated properly
    userPrincipalName = TemporaryDocumentType.FIRST_NODE_APPROVER_2;
    Collection<ActionItem> actionList = KEWServiceLocator.getActionListService().findByPrincipalId(getPrincipalIdForName(userPrincipalName));
    assertEquals("There should be one action item", 1, actionList.size());
    ActionItem actionItem = actionList.iterator().next();
    assertEquals("The label on the action item should have been changed", new_label, actionItem.getDocLabel());
}
 
开发者ID:kuali,项目名称:kc-rice,代码行数:68,代码来源:DocumentTypeMaintainableTest.java


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