| 1 |
|
|
| 2 |
|
|
| 3 |
|
|
| 4 |
|
|
| 5 |
|
|
| 6 |
|
|
| 7 |
|
|
| 8 |
|
|
| 9 |
|
|
| 10 |
|
|
| 11 |
|
|
| 12 |
|
|
| 13 |
|
|
| 14 |
|
|
| 15 |
|
|
| 16 |
|
|
| 17 |
|
package org.kuali.rice.kew.engine.node; |
| 18 |
|
|
| 19 |
|
import org.apache.commons.lang.StringUtils; |
| 20 |
|
import org.apache.log4j.Logger; |
| 21 |
|
import org.jdom.Element; |
| 22 |
|
import org.kuali.rice.core.util.XmlHelper; |
| 23 |
|
import org.kuali.rice.kew.engine.RouteContext; |
| 24 |
|
import org.kuali.rice.kew.engine.RouteHelper; |
| 25 |
|
import org.kuali.rice.kew.exception.WorkflowRuntimeException; |
| 26 |
|
import org.kuali.rice.kew.exception.WorkflowServiceErrorException; |
| 27 |
|
import org.kuali.rice.kew.routeheader.DocumentContent; |
| 28 |
|
import org.kuali.rice.kew.routeheader.StandardDocumentContent; |
| 29 |
|
import org.kuali.rice.kew.service.KEWServiceLocator; |
| 30 |
|
import org.kuali.rice.kew.util.KEWConstants; |
| 31 |
|
import org.kuali.rice.kim.bo.Person; |
| 32 |
|
import org.kuali.rice.kim.service.KIMServiceLocator; |
| 33 |
|
|
| 34 |
|
import java.util.ArrayList; |
| 35 |
|
import java.util.Collection; |
| 36 |
|
import java.util.Iterator; |
| 37 |
|
|
| 38 |
|
|
| 39 |
|
|
| 40 |
|
|
| 41 |
|
|
| 42 |
|
@deprecated@link |
| 43 |
|
|
| 44 |
|
@author |
| 45 |
|
|
|
|
|
| 0% |
Uncovered Elements: 42 (42) |
Complexity: 11 |
Complexity Density: 0.41 |
|
| 46 |
|
public class FYIByUniversityId extends RequestActivationNode { |
| 47 |
|
private static final Logger LOG = Logger.getLogger(FYIByUniversityId.class); |
| 48 |
|
|
|
|
|
| 0% |
Uncovered Elements: 33 (33) |
Complexity: 8 |
Complexity Density: 0.38 |
|
| 49 |
0
|
public SimpleResult process(RouteContext context, RouteHelper helper)... |
| 50 |
|
throws Exception { |
| 51 |
|
|
| 52 |
0
|
LOG.debug("processing FYIByUniversityId node"); |
| 53 |
0
|
Element rootElement = getRootElement(new StandardDocumentContent(context.getDocument().getDocContent())); |
| 54 |
0
|
Collection<Element> fieldElements = XmlHelper.findElements(rootElement, "field"); |
| 55 |
0
|
Iterator<Element> elementIter = fieldElements.iterator(); |
| 56 |
0
|
while (elementIter.hasNext()) { |
| 57 |
0
|
Element field = (Element) elementIter.next(); |
| 58 |
0
|
Element version = field.getParentElement(); |
| 59 |
0
|
if (version.getAttribute("current").getValue().equals("true")) { |
| 60 |
0
|
LOG.debug("Looking for studentUid field: " + field.getAttributeValue("name")); |
| 61 |
0
|
if (field.getAttribute("name")!= null && field.getAttributeValue("name").equals("studentUid")) { |
| 62 |
0
|
String employeeId = field.getChildText("value"); |
| 63 |
0
|
LOG.debug("Should send an FYI to employee ID: " + employeeId); |
| 64 |
0
|
if (!StringUtils.isBlank(employeeId)) { |
| 65 |
0
|
Person person = KIMServiceLocator.getPersonService().getPerson(employeeId); |
| 66 |
|
|
| 67 |
0
|
if (person == null) { |
| 68 |
0
|
throw new WorkflowRuntimeException("Failed to locate a Person with the given employee ID: " + employeeId); |
| 69 |
|
} |
| 70 |
0
|
if (!context.isSimulation()) { |
| 71 |
0
|
KEWServiceLocator.getWorkflowDocumentService().adHocRouteDocumentToPrincipal(person.getPrincipalId(), context.getDocument(), KEWConstants.ACTION_REQUEST_FYI_REQ, null, "Notification Request", person.getPrincipalId(), "Notification Request", true, null); |
| 72 |
|
} |
| 73 |
|
|
| 74 |
0
|
LOG.debug("Sent FYI using the adHocRouteDocumentToPrincipal function to UniversityID: " + person.getEmployeeId()); |
| 75 |
0
|
break; |
| 76 |
|
} |
| 77 |
|
} |
| 78 |
|
} |
| 79 |
|
} |
| 80 |
0
|
return super.process(context, helper); |
| 81 |
|
} |
| 82 |
|
|
| 83 |
|
|
|
|
|
| 0% |
Uncovered Elements: 5 (5) |
Complexity: 2 |
Complexity Density: 0.4 |
|
| 84 |
0
|
private static Element getRootElement(DocumentContent docContent) {... |
| 85 |
0
|
Element rootElement = null; |
| 86 |
0
|
try { |
| 87 |
0
|
rootElement = XmlHelper.buildJDocument(docContent.getDocument()).getRootElement(); |
| 88 |
|
} catch (Exception e) { |
| 89 |
0
|
throw new WorkflowServiceErrorException("Invalid XML submitted", new ArrayList<Object>()); |
| 90 |
|
} |
| 91 |
0
|
return rootElement; |
| 92 |
|
} |
| 93 |
|
|
| 94 |
|
|
|
|
|
| 0% |
Uncovered Elements: 1 (1) |
Complexity: 1 |
Complexity Density: 1 |
|
| 95 |
0
|
protected Object getService(String serviceName) {... |
| 96 |
0
|
return KEWServiceLocator.getService(serviceName); |
| 97 |
|
} |
| 98 |
|
|
| 99 |
|
|
| 100 |
|
} |
| 101 |
|
|
| 102 |
|
|