Exemplo n.º 1
0
 /**
  * @param Req
  * @return
  * @throws PDException
  */
 private boolean CheckIn(HttpServletRequest Req) throws PDException {
   String Acept = Req.getParameter("BOk");
   if (Acept == null || Acept.length() == 0) return (false);
   DriverGeneric PDSession = SParent.getSessOPD(Req);
   PDDocs F = new PDDocs(PDSession);
   F.setPDId(getActDocId(Req));
   String Ver = Req.getParameter(PDDocs.fVERSION);
   F.Checkin(Ver);
   return (true);
 }
Exemplo n.º 2
0
 /**
  * @param Req
  * @param out
  * @throws Exception
  */
 @Override
 protected void ProcessPage(HttpServletRequest Req, PrintWriter out) throws Exception {
   if (!Reading(Req)) {
     DriverGeneric PDSession = SParent.getSessOPD(Req);
     PDDocs F = new PDDocs(PDSession);
     F.LoadFull(getActDocId(Req));
     Record Rec = F.getRecSum();
     FMantDocAdv f = new FMantDocAdv(Req, FMantDocAdv.EDIMOD, Rec, getUrlServlet());
     out.println(f.ToHtml(Req.getSession()));
     return;
   } else {
     try {
       ModDoc(Req);
       GenListForm(Req, out, LAST_FORM, null, null);
       //    FListDocs fm=new FListDocs(Req, getActFolderId(Req));
       //    out.println(fm.ToHtml(Req.getSession()));
     } catch (PDException ex) {
       ShowMessage(Req, out, SParent.TT(Req, ex.getLocalizedMessage()));
     }
   }
 }
Exemplo n.º 3
0
 /**
  * @param Req
  * @param out
  * @throws Exception
  */
 @Override
 protected void ProcessPage(HttpServletRequest Req, PrintWriter out) throws Exception {
   if (!Reading(Req)) {
     FCheckIn f = new FCheckIn(Req, FCheckIn.ADDMOD, null, getUrlServlet());
     out.println(f.ToHtml(Req.getSession()));
     return;
   } else {
     try {
       CheckIn(Req);
       GenListForm(Req, out, LAST_FORM, null, null);
       //    FListDocs fm=new FListDocs(Req, getActFolderId(Req));
       //    out.println(fm.ToHtml(Req.getSession()));
     } catch (PDException ex) {
       ShowMessage(Req, out, SParent.TT(Req, ex.getLocalizedMessage()));
     }
   }
 }
Exemplo n.º 4
0
 private boolean ModDoc(HttpServletRequest Req)
     throws PDException, FileUploadException, IOException {
   PDDocs Doc;
   Record Rec;
   String FileName = null;
   InputStream FileData = null;
   HashMap ListFields = new HashMap();
   DiskFileItemFactory factory = new DiskFileItemFactory();
   factory.setSizeThreshold(1000000);
   ServletFileUpload upload = new ServletFileUpload(factory);
   boolean isMultipart = ServletFileUpload.isMultipartContent(Req);
   if (isMultipart) {
     List items = upload.parseRequest(Req);
     Iterator iter = items.iterator();
     while (iter.hasNext()) {
       FileItem item = (FileItem) iter.next();
       if (item.isFormField()) ListFields.put(item.getFieldName(), item.getString());
       else {
         FileName = item.getName();
         FileData = item.getInputStream();
       }
     }
     String Acept = (String) ListFields.get("BOk");
     if (Acept == null || Acept.length() == 0) return (false);
     DriverGeneric PDSession = SParent.getSessOPD(Req);
     String DType = (String) ListFields.get(PDDocs.fDOCTYPE);
     Doc = new PDDocs(PDSession);
     Doc.LoadFull(getActDocId(Req));
     Rec = Doc.getRecSum();
     Rec.initList();
     Attribute Attr = Rec.nextAttr();
     while (Attr != null) {
       if (!List.contains(Attr.getName())) {
         String Val = (String) ListFields.get(Attr.getName());
         if (Attr.getType() == Attribute.tBOOLEAN) {
           if (Val == null) Attr.setValue(false);
           else Attr.setValue(true);
         } else if (Val != null) {
           SParent.FillAttr(Req, Attr, Val, false);
         }
       }
       Attr = Rec.nextAttr();
     }
   } else {
     String Acept = Req.getParameter("BOk");
     if (Acept == null || Acept.length() == 0) return (false);
     DriverGeneric PDSession = SParent.getSessOPD(Req);
     Doc = new PDDocs(PDSession);
     Doc.LoadFull(getActDocId(Req));
     Rec = Doc.getRecSum();
     Rec.initList();
     Attribute Attr = Rec.nextAttr();
     while (Attr != null) {
       if (!List.contains(Attr.getName())) {
         String Val = Req.getParameter(Attr.getName());
         if (Attr.getType() == Attribute.tBOOLEAN) {
           if (Val == null) Attr.setValue(false);
           else Attr.setValue(true);
         } else if (Val != null) {
           SParent.FillAttr(Req, Attr, Val, false);
         }
       }
       Attr = Rec.nextAttr();
     }
   }
   Doc.assignValues(Rec);
   String RefFile = (String) ListFields.get(PDDocs.fNAME + "_");
   if (RefFile != null && RefFile.length() != 0) Doc.setFile(RefFile);
   else {
     if (FileName != null && FileName.length() > 0) {
       PDMimeType mt = new PDMimeType(SParent.getSessOPD(Req));
       Doc.setMimeType(mt.SolveName(FileName));
       Doc.setName(FileName);
       if (FileData != null) Doc.setStream(FileData);
     }
   }
   Doc.setParentId(getActFolderId(Req));
   Doc.update();
   return (true);
 }