/**
   * OIG exclusion screening.
   *
   * @param item the work item to abort
   * @param manager the work item manager
   */
  public void executeWorkItem(WorkItem item, WorkItemManager manager) {
    log.log(Level.INFO, "Checking provider exclusion.");
    EnrollmentProcess processModel = (EnrollmentProcess) item.getParameter("model");

    ProviderInformationType provider = XMLUtility.nsGetProvider(processModel);
    ScreeningResultsType screeningResults = XMLUtility.nsGetScreeningResults(processModel);
    ScreeningResultType screeningResultType = new ScreeningResultType();
    screeningResults.getScreeningResult().add(screeningResultType);

    ExternalSourcesScreeningResultType results = null;
    try {
      OIGExclusionSearchClient client = new OIGExclusionSearchClient();
      results = client.verify(XMLUtility.nsGetProvider(processModel));

      VerificationStatusType verificationStatus = XMLUtility.nsGetVerificationStatus(processModel);
      if (!results.getSearchResults().getSearchResultItem().isEmpty()) {
        OIGExclusionServiceMatcher matcher = new OIGExclusionServiceMatcher();
        MatchStatus status = matcher.match(provider, null, results);
        if (status == MatchStatus.EXACT_MATCH) {
          verificationStatus.setNonExclusion("N");
        } else {
          verificationStatus.setNonExclusion("Y");
        }
      } else {
        verificationStatus.setNonExclusion("Y");
      }
    } catch (TransformerException e) {
      log.log(Level.ERROR, e);
      results = new ExternalSourcesScreeningResultType();
      results.setStatus(XMLUtility.newStatus("ERROR"));
    } catch (JAXBException e) {
      log.log(Level.ERROR, e);
      results = new ExternalSourcesScreeningResultType();
      results.setStatus(XMLUtility.newStatus("ERROR"));
    } catch (IOException e) {
      log.log(Level.ERROR, e);
      results = new ExternalSourcesScreeningResultType();
      results.setStatus(XMLUtility.newStatus("ERROR"));
    }

    screeningResultType.setExclusionVerificationResult(results.getSearchResults());
    screeningResultType.setScreeningType("EXCLUDED PROVIDERS");
    screeningResultType.setStatus(XMLUtility.newStatus("SUCCESS"));

    item.getResults().put("model", processModel);
    manager.completeWorkItem(item.getId(), item.getResults());
  }
Пример #2
0
 @Override
 public void executeWorkItem(WorkItem workItem, WorkItemManager manager) {
   String url = HandlerUtils.getFirstTypedParameter(workItem.getParameters(), String.class);
   try {
     if (url == null) throw new Exception("No URL given");
     DocumentInformation docInfo = docManager.getDocumentInformation(workItem);
     if (docInfo == null) throw new Exception("No document associated with this workflow");
     Theo theo = docInfo.getTheo();
     int theoOutput = theo.openWindow(docInfo, workItem.getProcessInstanceId(), "", url, 700, 600);
     workItem.getResults().put("wndIDOutput", theoOutput);
   } catch (Exception e) {
     log.error(e.getMessage());
     e.printStackTrace();
   } finally {
     manager.completeWorkItem(workItem.getId(), workItem.getResults());
   }
 }
Пример #3
0
  @Override
  public void executeWorkItem(WorkItem workItem, WorkItemManager manager) {
    to = (String) workItem.getParameter("To");
    from = (String) workItem.getParameter("From");
    subject = (String) workItem.getParameter("Subject");
    body = (String) workItem.getParameter("Body");

    System.out.println("====================================");
    System.out.println("Executing Email task: " + workItem);
    System.out.println("From: " + from);
    System.out.println("To: " + to);
    System.out.println("Subject: " + subject);
    System.out.println("Body: " + body);
    System.out.println("====================================");

    // Assuming you are sending email from localhost
    String host = "localhost";

    // Get system properties
    Properties properties = System.getProperties();

    // Setup mail server
    properties.setProperty("mail.smtp.host", host);

    // Get the default Session object.
    Session session = Session.getDefaultInstance(properties);

    try {
      // Create a default MimeMessage object.
      MimeMessage message = new MimeMessage(session);

      // Set From: header field of the header.
      message.setFrom(new InternetAddress(from));

      // Set To: header field of the header.
      message.addRecipient(Message.RecipientType.TO, new InternetAddress(to));

      // Set Subject: header field
      message.setSubject(subject);

      // Now set the actual message
      message.setText(body);

      // Send message
      Transport.send(message);
      System.out.println("Sent message successfully....");
    } catch (MessagingException mex) {
      mex.printStackTrace();
    }
    manager.completeWorkItem(workItem.getId(), workItem.getResults());
  }