private void ButtonAceptActionPerformed( java.awt.event.ActionEvent evt) // GEN-FIRST:event_ButtonAceptActionPerformed { // GEN-HEADEREND:event_ButtonAceptActionPerformed try { Attribute Attr; if (ModeGrp) { Attr = Perm.getAttr(PDACL.fGROUPNAME); } else { Attr = Perm.getAttr(PDACL.fUSERNAME); } Attr.setValue(UserComboBox.getSelectedItem()); Attr = Perm.getAttr(PDACL.fPERMISION); Attr.setValue(PermisionComboBox.getSelectedIndex() + 1); Cancel = false; this.dispose(); } catch (PDException ex) { MainWin.Message(MainWin.DrvTT(ex.getLocalizedMessage())); } } // GEN-LAST:event_ButtonAceptActionPerformed
/** @param pPerm */ public void setRecord(Record pPerm) { Perm = pPerm; Attribute Attr; if (ModeGrp) Attr = Perm.getAttr(PDACL.fGROUPNAME); else Attr = Perm.getAttr(PDACL.fUSERNAME); UserNameLabel.setText(MainWin.DrvTT(Attr.getUserName())); if (Attr.getValue() != null) UserComboBox.setSelectedItem((String) Attr.getValue()); else UserComboBox.setSelectedItem(""); UserComboBox.setToolTipText(MainWin.DrvTT(Attr.getDescription())); Attr = Perm.getAttr(PDACL.fPERMISION); PermisionLabel.setText(MainWin.DrvTT(Attr.getUserName())); if (Attr.getValue() != null) { int Level = (Integer) Attr.getValue(); if (Level == PDACL.pCATALOG) PermisionComboBox.setSelectedItem("CATALOG"); else if (Level == PDACL.pVERSION) PermisionComboBox.setSelectedItem("VERSION"); else if (Level == PDACL.pUPDATE) PermisionComboBox.setSelectedItem("UPDATE"); else if (Level == PDACL.pDELETE) PermisionComboBox.setSelectedItem("DELETE"); else PermisionComboBox.setSelectedItem("READ"); } else PermisionComboBox.setSelectedItem("READ"); PermisionComboBox.setToolTipText(MainWin.DrvTT(Attr.getDescription())); }
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); }