Esempio n. 1
0
  /** programId is ignored for now as oscar doesn't support it yet. */
  public List<Prevention> getPreventionsByProgramProviderDemographicDate(
      LoggedInInfo loggedInInfo,
      Integer programId,
      String providerNo,
      Integer demographicId,
      Calendar updatedAfterThisDateExclusive,
      int itemsToReturn) {
    List<Prevention> results =
        preventionDao.findByProviderDemographicLastUpdateDate(
            providerNo, demographicId, updatedAfterThisDateExclusive.getTime(), itemsToReturn);

    LogAction.addLogSynchronous(
        loggedInInfo,
        "PreventionManager.getUpdatedAfterDate",
        "programId="
            + programId
            + ", providerNo="
            + providerNo
            + ", demographicId="
            + demographicId
            + ", updatedAfterThisDateExclusive="
            + updatedAfterThisDateExclusive.getTime());

    return (results);
  }
Esempio n. 2
0
  public List<EFormData> findByDemographicId(LoggedInInfo loggedInInfo, Integer demographicId) {
    List<EFormData> results = eFormDataDao.findByDemographicId(demographicId);
    if (results.size() > 0) {
      String resultIds = EForm.getIdsAsStringList(results);
      LogAction.addLogSynchronous(
          loggedInInfo, "FormsManager.findByDemographicId", "ids returned=" + resultIds);
    }

    return (results);
  }
Esempio n. 3
0
  /**
   * get eform in group by group name
   *
   * @param groupName
   * @return list of EForms
   */
  public List<EForm> getEfromInGroupByGroupName(LoggedInInfo loggedInInfo, String groupName) {
    List<EForm> results = eformDao.getEfromInGroupByGroupName(groupName);
    if (results.size() > 0) {
      String resultIds = EForm.getIdsAsStringList(results);
      LogAction.addLogSynchronous(
          loggedInInfo, "FormsManager.getEfromInGroupByGroupName", "ids returned=" + resultIds);
    }

    return (results);
  }
Esempio n. 4
0
  public Prevention getPrevention(LoggedInInfo loggedInInfo, Integer id) {
    Prevention result = preventionDao.find(id);

    // --- log action ---
    if (result != null) {
      LogAction.addLogSynchronous(loggedInInfo, "PreventionManager.getPrevention", "id=" + id);
    }

    return (result);
  }
Esempio n. 5
0
  public List<PreventionExt> getPreventionExtByPrevention(
      LoggedInInfo loggedInInfo, Integer preventionId) {
    List<PreventionExt> results = preventionExtDao.findByPreventionId(preventionId);

    LogAction.addLogSynchronous(
        loggedInInfo,
        "PreventionManager.getPreventionExtByPrevention",
        "preventionId=" + preventionId);

    return (results);
  }
Esempio n. 6
0
  public List<Prevention> getPreventionsByDemographicNo(
      LoggedInInfo loggedInInfo, Integer demographicNo) {
    List<Prevention> results = preventionDao.findUniqueByDemographicId(demographicNo);

    LogAction.addLogSynchronous(
        loggedInInfo,
        "PreventionManager.getPreventionsByDemographicNo",
        "demographicNo=" + demographicNo);

    return (results);
  }
Esempio n. 7
0
  /**
   * Finds all eforms based on the status.
   *
   * @param status Status to be used when looking up forms.
   * @param sortOrder Order how records should be sorted. Providing no sort order delegates to the
   *     default sorting order of the persistence provider
   * @return Returns the list of all forms with the specified status.
   */
  public List<EForm> findByStatus(
      LoggedInInfo loggedInInfo, boolean status, EFormSortOrder sortOrder) {
    List<EForm> results = eformDao.findByStatus(status, sortOrder);

    if (results.size() > 0) {
      String resultIds = EForm.getIdsAsStringList(results);
      LogAction.addLogSynchronous(
          loggedInInfo, "FormsManager.findByStatus", "ids returned=" + resultIds);
    }

    return (results);
  }
Esempio n. 8
0
  public List<Prevention> getUpdatedAfterDate(
      LoggedInInfo loggedInInfo, Date updatedAfterThisDateExclusive, int itemsToReturn) {
    List<Prevention> results =
        preventionDao.findByUpdateDate(updatedAfterThisDateExclusive, itemsToReturn);

    LogAction.addLogSynchronous(
        loggedInInfo,
        "PreventionManager.getUpdatedAfterDate",
        "updatedAfterThisDateExclusive=" + updatedAfterThisDateExclusive);

    return (results);
  }
Esempio n. 9
0
  @Override
  public String parse(String serviceName, String fileName, int fileId, String ipAddr) {

    String providerNo = "-1";
    String filePath = fileName;
    if (!(fileName.endsWith(".pdf") || fileName.endsWith(".PDF"))) {
      logger.error("Document " + fileName + "does not have pdf extension");
      return null;
    } else {
      int fileNameIdx = fileName.lastIndexOf("/");
      fileName = fileName.substring(fileNameIdx + 1);
    }

    EDoc newDoc =
        new EDoc(
            "",
            "",
            fileName,
            "",
            providerNo,
            providerNo,
            "",
            'A',
            oscar.util.UtilDateUtilities.getToday("yyyy-MM-dd"),
            "",
            "",
            "demographic",
            "-1",
            false);

    newDoc.setDocPublic("0");

    InputStream fis = null;

    try {
      fis = new FileInputStream(filePath);
      newDoc.setContentType("application/pdf");

      // Find the number of pages
      PdfReader reader = new PdfReader(filePath);
      int numPages = reader.getNumberOfPages();
      reader.close();
      newDoc.setNumberOfPages(numPages);

      String doc_no = EDocUtil.addDocumentSQL(newDoc);

      LogAction.addLog(
          providerNo, LogConst.ADD, LogConst.CON_DOCUMENT, doc_no, ipAddr, "", "DocUpload");

      // Get provider to route document to
      String batchPDFProviderNo =
          OscarProperties.getInstance().getProperty("batch_pdf_provider_no");
      if ((batchPDFProviderNo != null) && !batchPDFProviderNo.isEmpty()) {

        ProviderInboxRoutingDao providerInboxRoutingDao =
            (ProviderInboxRoutingDao) SpringUtils.getBean("providerInboxRoutingDAO");
        providerInboxRoutingDao.addToProviderInbox(
            batchPDFProviderNo, Integer.parseInt(doc_no), "DOC");

        // Add to default queue for now, not sure how or if any other queues can be used anyway
        // (MAB)
        QueueDocumentLinkDao queueDocumentLinkDAO =
            (QueueDocumentLinkDao) SpringUtils.getBean("queueDocumentLinkDAO");
        Integer did = Integer.parseInt(doc_no.trim());
        queueDocumentLinkDAO.addToQueueDocumentLink(1, did);
      }
    } catch (FileNotFoundException e) {
      logger.info("An unexpected error has occurred:" + e.toString());
      return null;
    } catch (Exception e) {
      logger.info("An unexpected error has occurred:" + e.toString());
      return null;
    } finally {
      try {
        if (fis != null) {
          fis.close();
        }
      } catch (IOException e1) {
        logger.info("An unexpected error has occurred:" + e1.toString());
        return null;
      }
    }

    return "success";
  }