Beispiel #1
0
  /**
   * Gets the Person
   *
   * @return Returns the Person
   */
  @Override
  public Person getLedgerPerson() {
    if ((ledgerPerson == null || !StringUtils.equals(ledgerPerson.getEmployeeId(), emplid))
        && StringUtils.isNotBlank(emplid)) {
      ledgerPerson = SpringContext.getBean(PersonService.class).getPersonByEmployeeId(emplid);
    }

    return ledgerPerson;
  }
  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);
  }