public void addExhibit() { editFlag = true; getReqMap().put("showEditPopup", true); setAddNewExhibits(true); ConsntOrdExhbt exhb = new ConsntOrdExhbt(); exhb.setExhbtTpCd(new Long(Constants.SUPPORT_DOC)); setSelectedExhibit(exhb); }
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; }