Package es.ipsa.atril.doc.user

Examples of es.ipsa.atril.doc.user.Dms


        aAmountRange = new BigDecimal[]{null,new BigDecimal(sAmountTo)};
      
      try {
        connect(sNickN, sPassw);
        AtrilSession oSes = getSession();
        Dms oDms = oSes.getDms();
        if (sDocId.length()>0) {
          aLst = new QueryResultSet<Invoice>();
          aLst.add(new Invoice(oDms, sDocId));
        } else {
          TaxPayer oTxpr = new TaxPayer(oDms, sTaxPayer);
View Full Code Here


  }

  public static void delete(AtrilSession oSes, String sDocId)
    throws DmsException, ElementNotFoundException, ClassNotFoundException, InstantiationException,
    IllegalAccessException, ClassCastException, IllegalStateException {
    Dms oDms = oSes.getDms();
    new Client(oDms, sDocId).delete(oSes, oDms);
 
View Full Code Here

      AtrilSession oSes = null;
      StreamPipe oPipe;
      try {
        oSes = DAO.getAdminSession("ThumbnailCreator");
        oSes.autoCommit(true);
        Dms oDms = oSes.getDms();
        Document oDoc = oDms.getDocument(sParent);
        Item oItm = oDms.getDocument(sItem).item();
        String sFileName = oItm.name().toLowerCase();
        oPipe = new StreamPipe();
        ByteArrayOutputStream oByOut = new ByteArrayOutputStream();
        if (sFileName.endsWith(".pdf")) {
          Log.out.debug("Item.getInputStreamTranscodedToMime(image/jpeg)");
          oPipe.between(oItm.getInputStreamTranscodedToMime("image/jpeg"), oByOut);
        } else {
            Log.out.debug("Item.getInputStream()");
            oPipe.between(oItm.getInputStream(), oByOut);         
        }
        byte[] aBytes = oByOut.toByteArray();
        oByOut.close();
        oByOut = null;
        Log.out.debug("new Picture()");
        Picture oPic = new Picture();
        Log.out.debug("Before Picture.dimensions()");
        int[] aWidthHeight = oPic.dimensions(aBytes, "jpeg");
        Log.out.debug("After Picture.dimensions()");
        if (null==aWidthHeight)
          throw new NullPointerException("Unable to get dimensions for image "+oItm.name());
        Log.out.debug("Image width="+String.valueOf(aWidthHeight[0])+" height="+String.valueOf(aWidthHeight[1]));
        int iWidth, iHeight;
        if (aWidthHeight[0]<=MaxWidth && aWidthHeight[0]<=MaxHeight) {
          iWidth = aWidthHeight[0];
          iHeight = aWidthHeight[1];
        } else {
          float fWidthRatio = ((float) aWidthHeight[0]) / MaxWidth;
          float fHeightRatio = ((float) aWidthHeight[1]) / MaxHeight;
          if (fWidthRatio>fHeightRatio) {
            iWidth = (int) MaxWidth;
            iHeight = (int) (MaxWidth*aWidthHeight[1])/aWidthHeight[0];
          } else {
            iWidth = (int) (aWidthHeight[0]*MaxHeight)/aWidthHeight[1];
            iHeight = (int) MaxHeight;
          }
        }
        Log.out.debug("Resampled width="+String.valueOf(iWidth)+" height="+String.valueOf(iHeight));
        String sCodec = null;
        if (sFileName.endsWith(".jpg") || sFileName.endsWith(".jpeg") || sFileName.endsWith(".pdf"))
          sCodec = "jpeg";
        else if (sFileName.endsWith(".gif"))
          sCodec = "gif";
        else if (sFileName.endsWith(".tif") || sFileName.endsWith(".tiff"))
          sCodec = "tiff";
        else {
          Log.out.error("ThumbnailCreator.run()  Could not find suitable codec for file "+oItm.name());
          throw new InstantiationException("Could not find suitable codec for file "+oItm.name());
        }
        Log.out.debug("Picture.createThumbBitmap("+sCodec+","+String.valueOf(iWidth)+","+String.valueOf(iHeight)+",80)");
        byte[] byThumb = oPic.createThumbBitmap(aBytes, sCodec, iWidth, iHeight, 80);
       
        Document oThl = oDms.newDocument(oDms.getDocumentType(oDoc.type().name()+"Thumbnail"), oDoc);
        AttributeMultiValue oAtr = oThl.attribute("width");
      oAtr.set((long) iWidth);
      oAtr = oThl.attribute("height");
      oAtr.set((long) iHeight);
      oThl.save("");
View Full Code Here

    return null;
  }

  public ArrayList<BillNote> list(AtrilSession oSes) throws ElementNotFoundException, NotEnoughRightsException, DmsException {
    ArrayList<BillNote> aNotes = new ArrayList<BillNote>();
    Dms oDms = oSes.getDms();
    for (Document d : getDocument().children())
      aNotes.add(new BillNote(oDms.getDocument(d.id())));
    return aNotes;
  }
View Full Code Here

  private static ConceptDateComparator oCdtCmp = new BillNotes().new ConceptDateComparator();
 
  private Collection<Concept> concepts(AtrilSession oSes, boolean bOnlyOpen, String sEmployeeUuid) {
    String sTaxPayerId = getDocument().parents().get(0).id();
    Dms oDms = oSes.getDms();
    SortableList<Document> oLst = (SortableList<Document>) oDms.query("BillNote & (($taxpayer='" + sTaxPayerId + "')"+(bOnlyOpen ? " & ($is_open='1')" : "")+")");
    TreeSet<String> oSet = new TreeSet<String>();
    ArrayList<Concept> oCps = new ArrayList<Concept>();
    for (Document d : oLst) {
      Document b = oDms.getDocument(d.id());
      AttributeMultiValue a = b.attribute("concept");
      AttributeMultiValue t = b.attribute("creation_date");
      AttributeMultiValue e = b.attribute("employee_uuid");
      if (a!=null) {
        Concept c;
View Full Code Here

    try {
      if (getRecipientTaxPayer().length()==0) {
        errors.add("items", new LocalizableError("com.zesped.action.InvoceUpload.clientIsRequired"));
      } else if (getBillerTaxPayer().length()>0) {
        connect(getSessionAttribute("nickname"), getSessionAttribute("password"));
        Dms oDms = getSession().getDms();
        Document r,b;
        try {
          r = oDms.getDocument(getRecipientTaxPayer());
          try {
          b = oDms.getDocument(getBillerTaxPayer());
          if (r.type().name().equals(b.type().name()))
            errors.add("items", new LocalizableError("com.zesped.action.InvoceUpload.incompatibleClientAndSupplier"));
          } catch (NumberFormatException nfe) {
          Log.out.error("NumberFormatException getting biller "+getBillerTaxPayer(), nfe);
          errors.add("items", new LocalizableError("com.zesped.action.InvoceUpload.incompatibleClientAndSupplier"));
View Full Code Here

    if (nItems>0) {
      Log.out.debug("InvoiceUpload "+String.valueOf(nItems)+" items found");
      try {
        connect(getSessionAttribute("nickname"), getSessionAttribute("password"));

        Dms oDms = getSession().getDms();
        Document rcpt = oDms.getDocument(getRecipientTaxPayer());
        String sTaxPayerId = rcpt.type().name().equals("TaxPayer") ? getRecipientTaxPayer() : getSessionAttribute("taxpayer_docid");
        TaxPayer txpy = new TaxPayer(getSession().getDms(), sTaxPayerId);

        Invoices invs = txpy.invoices(getSession());
       
View Full Code Here

     
    Zesped.createGroups(oSess);
   
      oSess.commit();
     
    Dms oDms = oSess.getDms();
    DocumentIndexer oIdx = oSess.getDocumentIndexer();
    Document oZespedDoc = null;

    UsersGroup oUsrsGrp = new UsersGroup(oAum, Zesped.getUsersGroup(oAum));
    UsersGroup oOpersGrp = new UsersGroup(oAum, Zesped.getOperatorsGroup(oAum));
   
    SortableList<Document> oLst = oDms.query("DeviceInformationType$brand='TWAIN'");
    if (oLst.isEmpty()) {
      Document oDit = oDms.newDocument(oDms.getDocumentType("DeviceInformationType"), oDms.getRootDocument());
      oDit.attribute("model").set("TWAIN");
      oDit.attribute("brand").set("TWAIN");
      oDit.save("");
      oSess.commit();
      oUsrsGrp.grantReadOnly(oDit);
      oOpersGrp.grantReadOnly(oDit);
      oSess.commit();
    }

    oLst = oDms.query("Endorsement$endorsement_id='01'");
    if (oLst.isEmpty()) {
      Configurations oCnf = null;
      try {
        oCnf = Configurations.top(oSess);
      } catch (ElementNotFoundException enfe) {
        Document oDnf = oDms.newDocument(oDms.getDocumentType("Configurations"), oDms.getRootDocument());
        oDnf.save("");
        oSess.commit();
        oCnf = new Configurations(oDnf);
        oUsrsGrp.grantReadOnly(oDnf);
        oOpersGrp.grantReadOnly(oDnf);
      }
      Document oEns = oDms.newDocument(oDms.getDocumentType("Endorsements"), oCnf.getDocument());
      oEns.save("");
      oSess.commit();
      Document oEnd = oDms.newDocument(oDms.getDocumentType("Endorsement"), oEns);
      oEnd.attribute("endorsement_id").set("01");
      oEnd.attribute("endorsement_mask").set("JJJUUUSSS%03d");
      oEnd.attribute("endorsement_text").set("Ipsa [date_dd/MM/yyyy] [Endorsement.endorsement_mask]");
      oEnd.save("");
      oSess.commit();
    }
   
    try {
      oZespedDoc = Zesped.top(oSess).getDocument();
    } catch (ElementNotFoundException enfe) {
      oZespedDoc = createDocumentOfType(oIdx, oDms, "Zesped", oDms.getRootDocument());   
      oOpersGrp.grantAll(oZespedDoc);
    }
    try {
      Users.top(oSess);
    } catch (ElementNotFoundException enfe) {
View Full Code Here

    final String[] aCaptureModes = new String[]{"UnsignedSinglePage","SignedSinglePage","ServerSignedSinglePage","UnsignedMultiPage","SignedMultiPage","ServerSignedMultiPage"};
    final String[] aScanModes = new String[]{"FullDuplexGUI","FullDuplexNoGUI","HalfDuplexGUI","HalfDuplexNoGUI"};
    final int nCaptureModes = aCaptureModes.length;
    final int nScanModes = aScanModes.length;

    Dms oDms = oSes.getDms();
   
    AuthorizationManager oAum = oSes.getAuthorizationManager();
      UsersGroup oUsrsGrp = new UsersGroup(oAum, Zesped.getUsersGroup(oAum));
    UsersGroup oOpersGrp = new UsersGroup(oAum, Zesped.getOperatorsGroup(oAum));
   
    CaptureType oCpt = new CaptureType();   
    CaptureTypes oCts = null;
   
    try {
      oCts = CaptureTypes.top(oSes);
    } catch(ElementNotFoundException enfe)   {
      Document dCts = oDms.newDocument(oDms.getDocumentType("CaptureTypes"), oDms.getRootDocument());
      dCts.save("");
      oUsrsGrp.grantReadOnly(dCts);
      oOpersGrp.grantReadOnly(dCts);
      oSes.commit();
      VolumeManager oVolm = oDms.getVolumeManager();
      Volume oVol = DAO.defaultVolume(oVolm);
      oVol.addDocument(dCts);
      oVol.save();
      oSes.commit();
      oCts = new CaptureTypes(dCts);
View Full Code Here

    PreparedStatement oStm = null;
    try {
      oCon = DAO.getConnection("DepositToZespedBridge");
      oCon.setAutoCommit(false);
      oStm = oCon.prepareStatement("UPDATE Documento SET fkIdDocPadre=? WHERE IdDoc=?");
      Dms oDms = oSes.getDms();
      Document oDepo = oDms.getDocument(String.valueOf(lDepositId));
      Document oDdoc = oDepo.children().get(0);
      Document oBble = oDms.getDocument(String.valueOf(lBillableId))

      Log.out.debug("getting sides for document "+oDdoc.id());
           
      for (Document oSide : oDdoc.children()) {
        oStm.setLong(1, Long.parseLong(oBble.id()));
View Full Code Here

TOP

Related Classes of es.ipsa.atril.doc.user.Dms

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.