Package es.ipsa.atril.doc.user

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


  }

  public CustomerAccount(AtrilSession oSes, User oUsr) throws NullPointerException,ElementNotFoundException {
    super("CustomerAccount");
    if (null==oUsr) throw new NullPointerException("User cannot be null");
    Dms oDms = oSes.getDms();   
    List<Document> oLst =  oDms.query("CustomerAccount$account_id='" + oUsr.getCustomerAccountId() + "'");
    if (oLst.isEmpty())
      throw new ElementNotFoundException("CustomerAccount for user not found");
    else
      load(oSes, oLst.get(0).id());
  }
View Full Code Here


        sId = d.id();
        break;
      }
    }
    if (null==sId) {
      Dms oDms = oSes.getDms();
      Document oCredits = oDms.newDocument(oDms.getDocumentType("CustomerAccountCredits"), getDocument());
      oCredits.attribute("account_id").set(getString("account_id"));
      oCredits.attribute("credits_used").set(BigDecimal.ZERO);
      oCredits.attribute("credits_left").set(BigDecimal.ZERO);
      oCredits.save("");
      oAccCredits = new CustomerAccountCredits(oCredits);
View Full Code Here

  public static String forTaxId(String sTaxIdthrows ElementNotFoundException, NullPointerException, IllegalArgumentException {
    return forTaxId(sTaxId, "CustomerAccount");
  }

  public static CustomerAccount forUuid(AtrilSession oSes, String sUuidthrows ElementNotFoundException, NullPointerException, IllegalArgumentException {
    Dms oDms = oSes.getDms();
    SortableList<Document> oLst = oDms.query("CustomerAccount$account_id='"+sUuid+"'");
    if (oLst.isEmpty()) throw new ElementNotFoundException("Could not find any CustomerAccount with unique id "+sUuid);
    return new CustomerAccount(oDms.getDocument(oLst.get(0).id()));
  }
View Full Code Here

    if (!oLst.isEmpty()) throw new IllegalArgumentException(sBusinessName+" already exists");

    Log.out.debug("PROFILING: Search Business Name "+String.valueOf((lEnd=new Date().getTime())-lStart)+" ms");
    lStart = lEnd;
   
    Dms oDms = oSes.getDms();
    oNew.setDocument (oDms.newDocument(oDms.getDocumentType(oNew.getTypeName()), Zesped.top(oSes).getDocument()));
    oNew.put("account_id",Gadgets.generateUUID());
    oNew.put("active","1");
    oNew.put("business_name",sBusinessName);
    oNew.put("creation_date", dtNow);
    oNew.put("contact_person", oUsr.getFirstName()+" "+oUsr.getLastName());
    oNew.save(oSes);

    Log.out.debug("PROFILING: Save CustomerAccount "+String.valueOf((lEnd=new Date().getTime())-lStart)+" ms");
    lStart = lEnd;
   
    Log.out.debug("CustomerAccount.createGroups(AtrilSession)");

    oNew.createGroups(oSes);

    Log.out.debug("PROFILING: Create permissions groups "+String.valueOf((lEnd=new Date().getTime())-lStart)+" ms");
    lStart = lEnd;
   
    oNew.grantAdmin(oSes, oUsr);

    Log.out.debug("PROFILING: Grant admin permissions "+String.valueOf((lEnd=new Date().getTime())-lStart)+" ms");
    lStart = lEnd;
   
    AttributeMultiValue oAttr = oUsr.getDocument().attribute("customer_acount");
    oAttr.set(oNew.getUuid());
    oUsr.getDocument().save("");
    oIdx.indexDocument(oUsr.getDocument());

    Document oOrders = oDms.newDocument(oDms.getDocumentType("Orders"), oNew.getDocument());
    oOrders.save("");
    oIdx.indexDocument(oOrders);
   
    Document oClients = oDms.newDocument(oDms.getDocumentType("Clients"), oNew.getDocument());
    oClients.save("");
    oIdx.indexDocument(oClients);

    Document oPayers = oDms.newDocument(oDms.getDocumentType("TaxPayers"), oNew.getDocument());
    oPayers.save("");
    oIdx.indexDocument(oPayers);

    Document oCredits = oDms.newDocument(oDms.getDocumentType("CustomerAccountCredits"), oNew.getDocument());
    oCredits.attribute("account_id").set(oNew.getString("account_id"));
    oCredits.attribute("credits_used").set(0l);
    oCredits.attribute("credits_left").set(0l);
    oCredits.save("");
    oIdx.indexDocument(oCredits);
View Full Code Here

        String order_id = getParam("order_id","");
        if(order_id.length()>0){
            try {
                connect();
                AtrilSession oSes = getSession();
                Dms oDms = oSes.getDms();
                order = new Order(oDms,order_id);
                disconnect();
                return new ForwardResolution("/WEB-INF/jsp/engagecreditok.jsp");
            } catch (StorageException ex) {
                Log.out.error("EngageCredit.form() "+ex.getClass().getName()+" "+ex.getMessage(), ex);
            }
        }else{          
            try {
                connect();
                AtrilSession oSes = getSession();
                Dms oDms = oSes.getDms();
                CustomerAccount cacc = new CustomerAccount(oDms, getSessionAttribute("customer_account_docid"));
                setName(cacc.getString("name_billing"));
                setCif(cacc.getString("cif_billing"));
                setPhone(cacc.getString("phone_billing"));
                setMail(cacc.getString("mail_billing"));
View Full Code Here

        try {
            String order_id = getContext().getRequest().getParameter("order_id");
           
            connect();
            AtrilSession oSes = getSession();
            Dms oDms = oSes.getDms();
            order = new Order(oDms,order_id);
            order.put("status_number",Tpv.PENDIENTE_CONFIRMACION);
            Date dtNow = new Date();
            order.put("pay_date", dtNow);
      order.newTransaction();
View Full Code Here

    public Resolution guardar(String path) {
        try {

            connect();
            AtrilSession oSes = getSession();
            Dms oDms = oSes.getDms();
            CustomerAccount cacc = new CustomerAccount(oDms, getSessionAttribute("customer_account_docid"));
      oSes.commit();
     
            cacc.put("name_billing",getName());
            cacc.put("cif_billing",getCif());
View Full Code Here

    public String getCreditsleft() {
        try {
            connect();
            AtrilSession oSes = getSession();
            if(oSes!=null){
            Dms oDms = oSes.getDms();
            CustomerAccount cacc = new CustomerAccount(oDms, getSessionAttribute("customer_account_docid"));
            disconnect();
            return cacc.getCreditsLeft().toString().substring(0, cacc.getCreditsLeft().toString().indexOf("."));
            }
        } catch (StorageException ex) {
View Full Code Here

    public String getCreditsused() {
        try {
            connect();
            AtrilSession oSes = getSession();
            if(oSes!=null){
            Dms oDms = oSes.getDms();
            CustomerAccount cacc = new CustomerAccount(oDms, getSessionAttribute("customer_account_docid"));
            disconnect();
            return cacc.getCreditsUsed().toString().substring(0, cacc.getCreditsUsed().toString().indexOf("."));
            }
        } catch (StorageException ex) {
View Full Code Here

    if (sDocs!=null) {
      if (sDocs.length()>0) {
        String[] aDocs = sDocs.split(",");
        try {
          connect();
          Dms oDms = getSession().getDms();
          for (int d=0; d<aDocs.length; d++) {
            try {
              Invoice oInv = new Invoice(oDms, aDocs[d]);
              oInv.approve(getSession(), getSessionAttribute("user_uuid"));
              addDataLine("docid", aDocs[d]);
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.