本文整理汇总了Java中org.kuali.rice.kew.api.WorkflowDocument.updateDocumentContent方法的典型用法代码示例。如果您正苦于以下问题:Java WorkflowDocument.updateDocumentContent方法的具体用法?Java WorkflowDocument.updateDocumentContent怎么用?Java WorkflowDocument.updateDocumentContent使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类org.kuali.rice.kew.api.WorkflowDocument
的用法示例。
在下文中一共展示了WorkflowDocument.updateDocumentContent方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: testManualDocumentContentModification
import org.kuali.rice.kew.api.WorkflowDocument; //导入方法依赖的package包/类
/**
* Tests modification of the DocumentContentVO object directly.
*/
@Test public void testManualDocumentContentModification() throws Exception {
WorkflowDocument document = WorkflowDocumentFactory.createDocument(getPrincipalIdForName("ewestfal"), "TestDocumentType");
document.saveDocumentData();
// fetch it from WorkflowInfo
DocumentContent content = KewApiServiceLocator.getWorkflowDocumentService().getDocumentContent(document.getDocumentId());
assertTrue("Should contain default content, was " + content.getFullContent(), KewApiConstants.DEFAULT_DOCUMENT_CONTENT.equals(content.getFullContent()) ||
KewApiConstants.DEFAULT_DOCUMENT_CONTENT2.equals(content.getFullContent()));
String appContent = "<abcdefg>hijklm n o p</abcdefg>";
DocumentContentUpdate.Builder contentUpdate = DocumentContentUpdate.Builder.create(content);
contentUpdate.setApplicationContent(appContent);
document.updateDocumentContent(contentUpdate.build());
document.saveDocumentData();
// test that the content on the document is the same as the content we just set
XMLAssert.assertXMLEqual(appContent, document.getApplicationContent());
// fetch the document fresh and make sure the content is correct
document = WorkflowDocumentFactory.loadDocument(getPrincipalIdForName("ewestfal"), document.getDocumentId());
XMLAssert.assertXMLEqual(appContent, document.getApplicationContent());
}
示例2: testChainedBlanketApproval
import org.kuali.rice.kew.api.WorkflowDocument; //导入方法依赖的package包/类
/**
* Test the blanket approval of a document chained by the post processor
*
* @throws Exception
*/
@Ignore
@Test
public void testChainedBlanketApproval() throws Exception {
// Generate child document
WorkflowDocument childDocument = WorkflowDocumentFactory.createDocument(getPrincipalIdForName(TEST_USER_EWESTFAL), ChainedChildSetup.DOCUMENT_TYPE_NAME);
WorkflowAttributeDefinition.Builder childDocAttribute = WorkflowAttributeDefinition.Builder.create(ChainedParentSetup.CHILD_DOC_ATTRIBUTE);
PropertyDefinition docIdProperty = PropertyDefinition.create(
ChainedParentSetup.DOC_ID_PROPERTY, childDocument.getDocumentId());
childDocAttribute.addPropertyDefinition(docIdProperty);
// Generate a parent document, apply child attribute
WorkflowDocument parentDocument = WorkflowDocumentFactory.createDocument(getPrincipalIdForName(TEST_USER_EWESTFAL), ChainedParentSetup.DOCUMENT_TYPE_NAME);
//parentDocument.addAttributeDefinition(childDocAttribute.build());
//parentDocument.saveDocumentData();
// Issue with attribute definition save
String fullContent = parentDocument.getDocumentContent().getFullContent();
String newContent = "<documentContent><attributeContent><documentId>" + childDocument.getDocumentId() + "</documentId></attributeContent></documentContent>";
DocumentContentUpdate.Builder documentContentUpdateBuilder = DocumentContentUpdate.Builder.create();
documentContentUpdateBuilder.setAttributeContent(newContent);
parentDocument.updateDocumentContent(documentContentUpdateBuilder.build());
parentDocument.saveDocumentData();
parentDocument.blanketApprove("");
parentDocument = WorkflowDocumentFactory.loadDocument(getPrincipalIdForName(TEST_USER_EWESTFAL), parentDocument.getDocumentId());
assertTrue("Parent Document should be processed.", parentDocument.isProcessed());
childDocument = WorkflowDocumentFactory.loadDocument(getPrincipalIdForName(TEST_USER_EWESTFAL), childDocument.getDocumentId());
assertTrue("Child Document should be processed.", childDocument.isProcessed());
}