本文整理汇总了Java中org.kuali.rice.kew.routeheader.StandardDocumentContent类的典型用法代码示例。如果您正苦于以下问题:Java StandardDocumentContent类的具体用法?Java StandardDocumentContent怎么用?Java StandardDocumentContent使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
StandardDocumentContent类属于org.kuali.rice.kew.routeheader包,在下文中一共展示了StandardDocumentContent类的9个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: testGenerateContent
import org.kuali.rice.kew.routeheader.StandardDocumentContent; //导入依赖的package包/类
@Test public void testGenerateContent() throws Exception {
DocumentContent dc = new StandardDocumentContent(TEST_CONTENT);
GenericAttributeContent gac = new GenericAttributeContent("boringAttribute");
List<Map<String, String>> attrs = gac.parseContent(dc.getAttributeContent());
assertEquals(1, attrs.size());
Map<String, String> properties = attrs.get(0);
assertEquals(2, properties.size());
assertEquals("green", properties.get("color"));
assertEquals("circle", properties.get("shape"));
String content = gac.generateContent(properties);
assertEquals(content.replaceAll("\\s+", ""), ATTRIB1_CONTENT.replaceAll("\\s+", ""));
gac = new GenericAttributeContent("coolAttribute");
attrs = gac.parseContent(dc.getAttributeContent());
assertEquals(1, attrs.size());
properties = attrs.get(0);
assertEquals(2, properties.size());
assertEquals("hasselhof", properties.get("driver"));
assertEquals("KIT", properties.get("car"));
content = gac.generateContent(properties);
Assert.assertTrue(ATTRIB2_STRANGE_CONTENT.replaceAll("\\s+", "").equals(content.replaceAll("\\s+", "")) || ATTRIB2_CONTENT.replaceAll("\\s+", "").equals(content.replaceAll("\\s+", "")));
}
示例2: testResolve_simpleMap_noBaseXPath
import org.kuali.rice.kew.routeheader.StandardDocumentContent; //导入依赖的package包/类
@Test
public void testResolve_simpleMap_noBaseXPath() throws Exception {
/** Build a set of configs to check, we have 2 currently
* 1 - using 'attributes' xml element
* 2 - using 'qualifier' xml element ("legacy")
* We need to validate BOTH configurations are supported and interpreted correctly.
* https://jira.kuali.org/browse/KULRICE-7044
* */
Set<String> configStrings = new HashSet<String>();
configStrings.add(SIMPLE_CONFIG_2);
configStrings.add(StringUtils.replace(SIMPLE_CONFIG_2, "attributes", "qualifier"));
for (String currentTestConfig : configStrings){
XPathQualifierResolver resolver = new XPathQualifierResolver();
ExtensionDefinition.Builder extensionDefinition = ExtensionDefinition.Builder.create("fakeName", "fakeType", "fakeResourceDescriptor");
extensionDefinition.setConfiguration(Collections.singletonMap(KewApiConstants.ATTRIBUTE_XML_CONFIG_DATA, currentTestConfig));
resolver.setExtensionDefinition(extensionDefinition.build());
RouteContext context = new RouteContext();
DocumentContent docContent = new StandardDocumentContent(SIMPLE_DOC_XML_1);
context.setDocumentContent(docContent);
List<Map<String, String>> maps = resolver.resolve(context);
verifyAccountmaps(maps);
}
}
示例3: testGenerateContent
import org.kuali.rice.kew.routeheader.StandardDocumentContent; //导入依赖的package包/类
@Test public void testGenerateContent() throws Exception {
DocumentContent dc = new StandardDocumentContent(TEST_CONTENT);
GenericAttributeContent gac = new GenericAttributeContent("boringAttribute");
List<Map<String, String>> attrs = gac.parseContent(dc.getAttributeContent());
assertEquals(1, attrs.size());
Map<String, String> properties = attrs.get(0);
assertEquals(2, properties.size());
assertEquals("green", properties.get("color"));
assertEquals("circle", properties.get("shape"));
String content = gac.generateContent(properties);
assertEquals(content.replaceAll("\\s+", ""), ATTRIB1_CONTENT.replaceAll("\\s+", ""));
gac = new GenericAttributeContent("coolAttribute");
attrs = gac.parseContent(dc.getAttributeContent());
assertEquals(1, attrs.size());
properties = attrs.get(0);
assertEquals(2, properties.size());
assertEquals("hasselhof", properties.get("driver"));
assertEquals("KIT", properties.get("car"));
content = gac.generateContent(properties);
assertEquals(content.replaceAll("\\s+", ""), ATTRIB2_CONTENT.replaceAll("\\s+", ""));
}
示例4: setDocument
import org.kuali.rice.kew.routeheader.StandardDocumentContent; //导入依赖的package包/类
public void setDocument(DocumentRouteHeaderValue routeHeader) {
this.routeHeader = routeHeader;
try {
setDocumentContent(new StandardDocumentContent(routeHeader.getDocContent(), this));
} catch (Exception e) {
throw new WorkflowRuntimeException(e);
}
}
示例5: process
import org.kuali.rice.kew.routeheader.StandardDocumentContent; //导入依赖的package包/类
public SimpleResult process(RouteContext context, RouteHelper helper)
throws Exception {
LOG.debug("processing FYIByNetworkId simple node");
String documentId = context.getDocument().getDocumentId();
Element rootElement = getRootElement(new StandardDocumentContent(context.getDocument().getDocContent()));
Collection<Element> fieldElements = XmlHelper.findElements(rootElement, "field");
Iterator<Element> elementIter = fieldElements.iterator();
while (elementIter.hasNext()) {
Element field = (Element) elementIter.next();
Element version = field.getParentElement();
if (version.getAttribute("current").getValue().equals("true")) {
LOG.debug("Looking for networkId field: " + field.getAttributeValue("name"));
if (field.getAttribute("name")!= null && field.getAttributeValue("name").equals("networkId")) {
LOG.debug("Should send an FYI to netID: " + field.getChildText("value"));
if (field.getChildText("value") != null) {
Person user = KimApiServiceLocator.getPersonService().getPersonByPrincipalName(field.getChildText("value"));
//WorkflowDocument wfDoc = new WorkflowDocument(new NetworkIdVO(field.getChildText("value")), documentId);
if (!context.isSimulation()) {
KEWServiceLocator.getWorkflowDocumentService().adHocRouteDocumentToPrincipal(user.getPrincipalId(), context.getDocument(), KewApiConstants.ACTION_REQUEST_FYI_REQ, null, null, "Notification Request", user.getPrincipalId(), "Notification Request", true, null);
}
//wfDoc.adHocRouteDocumentToPrincipal(KewApiConstants.ACTION_REQUEST_FYI_REQ, "Notification Request", new NetworkIdVO(field.getChildText("value")), "Notification Request", true);
LOG.debug("Sent FYI using the adHocRouteDocumentToPrincipal function to NetworkID: " + user.getPrincipalName());
break;
}
}
}
}
return super.process(context, helper);
}
示例6: process
import org.kuali.rice.kew.routeheader.StandardDocumentContent; //导入依赖的package包/类
public SimpleResult process(RouteContext context, RouteHelper helper)
throws Exception {
LOG.debug("processing FYIByUniversityId node");
Element rootElement = getRootElement(new StandardDocumentContent(context.getDocument().getDocContent()));
Collection<Element> fieldElements = XmlHelper.findElements(rootElement, "field");
Iterator<Element> elementIter = fieldElements.iterator();
while (elementIter.hasNext()) {
Element field = (Element) elementIter.next();
Element version = field.getParentElement();
if (version.getAttribute("current").getValue().equals("true")) {
LOG.debug("Looking for studentUid field: " + field.getAttributeValue("name"));
if (field.getAttribute("name")!= null && field.getAttributeValue("name").equals("studentUid")) {
String employeeId = field.getChildText("value");
LOG.debug("Should send an FYI to employee ID: " + employeeId);
if (!StringUtils.isBlank(employeeId)) {
Person person = KimApiServiceLocator.getPersonService().getPerson(employeeId);
if (person == null) {
throw new WorkflowRuntimeException("Failed to locate a Person with the given employee ID: " + employeeId);
}
if (!context.isSimulation()) {
KEWServiceLocator.getWorkflowDocumentService().adHocRouteDocumentToPrincipal(person.getPrincipalId(), context.getDocument(), KewApiConstants.ACTION_REQUEST_FYI_REQ, null, null, "Notification Request", person.getPrincipalId(), "Notification Request", true, null);
}
//wfDoc.adHocRouteDocumentToPrincipal(KewApiConstants.ACTION_REQUEST_FYI_REQ, "Notification Request", new EmplIdVO(field.getChildText("value")), "Notification Request", true);
LOG.debug("Sent FYI using the adHocRouteDocumentToPrincipal function to UniversityID: " + person.getEmployeeId());
break;
}
}
}
}
return super.process(context, helper);
}
示例7: testResolve_simpleMap
import org.kuali.rice.kew.routeheader.StandardDocumentContent; //导入依赖的package包/类
@Test
public void testResolve_simpleMap() throws Exception {
/** Build a set of configs to check, we have 2 currently
* 1 - using 'attributes' xml element
* 2 - using 'qualifier' xml element ("legacy")
* We need to validate BOTH configurations are supported and interpreted correctly.
* https://jira.kuali.org/browse/KULRICE-7044
* */
Set<String> configStrings = new HashSet<String>();
configStrings.add(SIMPLE_CONFIG_1);
configStrings.add(StringUtils.replace(SIMPLE_CONFIG_1, "attributes", "qualifier"));
for (String currentTestConfig : configStrings){
XPathQualifierResolver resolver = new XPathQualifierResolver();
ExtensionDefinition.Builder extensionDefinition = ExtensionDefinition.Builder.create("fakeName", "fakeType", "fakeResourceDescriptor");
extensionDefinition.setConfiguration(Collections.singletonMap(KewApiConstants.ATTRIBUTE_XML_CONFIG_DATA, currentTestConfig));
resolver.setExtensionDefinition(extensionDefinition.build());
RouteContext context = new RouteContext();
DocumentContent docContent = new StandardDocumentContent(SIMPLE_DOC_XML_1);
context.setDocumentContent(docContent);
List<Map<String, String>> maps = resolver.resolve(context);
verifyAccountmaps(maps);
}
}
示例8: testResolve_compoundMap1
import org.kuali.rice.kew.routeheader.StandardDocumentContent; //导入依赖的package包/类
@Test
public void testResolve_compoundMap1() throws Exception {
/** Build a set of configs to check, we have 2 currently
* 1 - using 'attributes' xml element
* 2 - using 'qualifier' xml element ("legacy")
* We need to validate BOTH configurations are supported and interpreted correctly.
* https://jira.kuali.org/browse/KULRICE-7044
* */
Set<String> configStrings = new HashSet<String>();
configStrings.add(COMPOUND_CONFIG_1);
configStrings.add(StringUtils.replace(COMPOUND_CONFIG_1, "attributes", "qualifier"));
for (String currentTestConfig : configStrings){
XPathQualifierResolver resolver = new XPathQualifierResolver();
ExtensionDefinition.Builder extensionDefinition = ExtensionDefinition.Builder.create("fakeName", "fakeType", "fakeResourceDescriptor");
extensionDefinition.setConfiguration(Collections.singletonMap(KewApiConstants.ATTRIBUTE_XML_CONFIG_DATA, currentTestConfig));
resolver.setExtensionDefinition(extensionDefinition.build());
RouteContext context = new RouteContext();
DocumentContent docContent = new StandardDocumentContent(COMPOUND_DOC_XML_1);
context.setDocumentContent(docContent);
List<Map<String, String>> maps = resolver.resolve(context);
assertEquals("Incorrect number of attribute sets", 2, maps.size());
String chartKey = "chart";
String orgKey = "org";
Map<String, String> map1 = maps.get(0);
assertEquals(2, map1.size());
assertEquals("BL", map1.get(chartKey));
assertEquals("BUS", map1.get(orgKey));
Map<String, String> map2 = maps.get(1);
assertEquals(2, map2.size());
assertEquals("IN", map2.get(chartKey));
assertEquals("MED", map2.get(orgKey));
}
}
示例9: testGenerateContent
import org.kuali.rice.kew.routeheader.StandardDocumentContent; //导入依赖的package包/类
@Test public void testGenerateContent() throws Exception {
DocumentContent dc = new StandardDocumentContent(TEST_CONTENT);
GenericAttributeContent gac = new GenericAttributeContent("boringAttribute");
List<Map<String, String>> attrs = gac.parseContent(dc.getAttributeContent());
assertEquals(1, attrs.size());
Map<String, String> properties = attrs.get(0);
assertEquals(2, properties.size());
assertEquals("green", properties.get("color"));
assertEquals("circle", properties.get("shape"));
String content = gac.generateContent(properties);
assertEquals(content.replaceAll("\\s+", ""), ATTRIB1_CONTENT.replaceAll("\\s+", ""));
gac = new GenericAttributeContent("coolAttribute");
attrs = gac.parseContent(dc.getAttributeContent());
assertEquals(1, attrs.size());
properties = attrs.get(0);
assertEquals(2, properties.size());
assertEquals("hasselhof", properties.get("driver"));
assertEquals("KIT", properties.get("car"));
content = gac.generateContent(properties);
// order is not guaranteed
List<String> validValues = Arrays.asList(ATTRIB2_CONTENT.replaceAll("\\s+", ""), ATTRIB2_CONTENT_REVERSED.replaceAll(
"\\s+", ""));
content = content.replaceAll("\\s+", "");
assertTrue(validValues.contains(content));
}