Ejemplo n.º 1
0
  public void save() throws Exception {
    ConsentOrderService consentOrderService = ConsentOrderService.getConsentOrderService();
    this.reOrderActnSet();
    int idx;
    consntOrder.getConsntOrdExhbts().clear();
    Iterator it = actnList.iterator();

    while (it.hasNext()) {

      ConsntOrdExhbt exhb = (ConsntOrdExhbt) it.next();
      idx = actnList.indexOf(exhb);
      exhb.setSeqNo(idx + 1);
      if (0 == exhb.getId().getRegDocEt().getUsrId()) {
        exhb.getId().getRegDocEt().setUsrId(usrBean.getUsrId());
      }
      consntOrder.getConsntOrdExhbts().add(exhb);
    }

    if (isUploadDocs()) {
      uploadFiles(); // first saving the documents and setting upload info
      setUploadFilesFlag(true);
    }
    for (ConsntOrdExhbt exhibit : getConsntOrder().getConsntOrdExhbts()) {
      if (exhibit.getId().getRegDocEt().isToBeUploaded()) {
        DocumentService.getDocumentService().saveNoCommit(exhibit.getId().getRegDocEt());
        exhibit.getId().getRegDocEt().setToBeUploaded(false);
      }
    }
    log.info("Saving  Exhibits to the Consent Order");
    consentOrderService.saveConsentOrder(consntOrder);
    this.setDocName("");
    this.setFileName("");
    this.setSelectedFileListSize(0);
    this.setPreviousSelFiles(0);
    this.setAddNewExhibits(false);
    if (!isUploadDocs()) {
      this.addMessage(FacesMessage.SEVERITY_INFO, " Exhibits Saved successfully.");
    }
  }
Ejemplo n.º 2
0
  private String addFileAsExhibit(ImageInfoDTO srchDoc, String path) throws Exception {
    ConsntOrdExhbt consntOrdExhbt = null;
    ConsntOrdExhbtId consntOrdExhbtId = null;
    RegDocEt docEt;
    long docId = 0;
    Date currDt = new Date();
    String newFileNm = "";
    File file = null;
    boolean replaceIFSfile = false; // flag will be updated by a method in ERegII
    if (path != null) {
      path = path.trim();
      file = new File(path);
    }

    consntOrdExhbt = new ConsntOrdExhbt();
    consntOrdExhbtId = new ConsntOrdExhbtId();
    if (isDetachFlag()) {
      UtilityService.getUtilityService().copyProperties(consntOrdExhbt, getSelectedExhibit());
    } else {
      consntOrdExhbt.setExhbtDt(currDt);
    }

    UtilityService utilSrvc = new UtilityService();
    if (!replaceIFSfile) {
      docEt = new RegDocEt();
      docId = utilSrvc.getKey("reg_doc_id");
      docEt.setRegDocId(docId);
    } else {
      // replacing the file in the existing regDocEt
      docEt = getSelectedExhibit().getId().getRegDocEt();
    }
    if (srchDoc != null) {
      docEt = DocumentService.getDocumentService().getRegDocEt(srchDoc.getRegDocId());
    } else { // local files
      docEt.setAppNm("ereg");

      if (!replaceIFSfile) {
        //                docEt.setCmplncItemId(getCmplncItemId());
        //                docEt.setDocTpCd(82L);
        newFileNm =
            docEt.getRegDocId() + "." + UtilityService.getUtilityService().getFileExtension(path);
      }
      if (!replaceIFSfile) { // to be placed appropriately
        docEt.setFileNm(newFileNm);
      }
    }

    if (file != null) {
      docEt.setUsrFileNm(path);
      docEt.setToBeUploaded(true);
      docEt.setContentId("EREG_" + docEt.getRegDocId()); // added on 0824
    }

    consntOrdExhbtId.setCmplncItemId(getCmplncItemId());
    consntOrdExhbtId.setRegDocEt(docEt);
    consntOrdExhbt.setId(consntOrdExhbtId);
    if (!isDetachFlag()) {
      consntOrdExhbt.setExhbtTpCd(
          new Long(Constants.SUPPORT_DOC)); // default is the supportive document
      consntOrdExhbt.setSeqNo(nextSequenceNumber());
    }
    if (isAddNewExhibits()) {
      consntOrdExhbt.setExhbtTpCd(
          getSelectedExhibit().getExhbtTpCd()); // default is the supportive document
      consntOrdExhbt.setExhbtDsc(getSelectedExhibit().getExhbtDsc());
      consntOrdExhbt.setExhbtNm(getSelectedExhibit().getExhbtNm());
    }
    if (srchDoc != null) {
      //            if (srchDoc.getDocCd() != null){ // docCd not available always and instead Image
      // Type is used.
      //                consntOrdExhbt.setExhbtDsc((String)tpCd.get(srchDoc.getDocCd()));
      //            }else{
      consntOrdExhbt.setExhbtDsc(srchDoc.getImageType() + "-" + srchDoc.getDocName());
      //            }
    }

    //        log.info("before "+consntOrder.getConsntOrdExhbts().size());
    if (isDetachFlag() && !replaceIFSfile) {
      deleteExhibit();
      setDetachFlag(false);
    }
    getConsntOrder().getConsntOrdExhbts().add(consntOrdExhbt);
    //        log.info("after "+consntOrder.getConsntOrdExhbts().size());

    return newFileNm;
  }