Package es.ipsa.atril.sec.authentication

Examples of es.ipsa.atril.sec.authentication.AtrilSession


    return getStringNull("customer_acount","");
  }

  public static String forEmail(String sEmailAddr) throws NullPointerException,ElementNotFoundException {
    if (sEmailAddr==null) throw new NullPointerException("Email address may not be null");
    AtrilSession oSes = DAO.getAdminSession("User.forEmail");   
    Dms oDms = oSes.getDms();
    SortableList<Document> oLst = oDms.query("User$email='"+sEmailAddr.toLowerCase().trim()+"'");
    if (oLst.isEmpty()) {
      oSes.disconnect();
      oSes.close();
      throw new ElementNotFoundException("No user found with email "+sEmailAddr.toLowerCase().trim());
    } else {
      String sUsrId = oLst.get(0).id();     
      oSes.disconnect();
      oSes.close();
      return sUsrId;     
    }
  }
View Full Code Here


    }
  }

  public static String forUuid(String sUuid) throws NullPointerException,ElementNotFoundException {
    if (sUuid==null) throw new NullPointerException("UUID may not be null");
    AtrilSession oSes = DAO.getAdminSession("User.forUuid");   
    Dms oDms = oSes.getDms();
    SortableList<Document> oLst = oDms.query("User$user_uuid='"+sUuid+"'");
    if (oLst.isEmpty()) {
      oSes.disconnect();
      oSes.close();
      throw new ElementNotFoundException("No user found with UUID "+sUuid);
    } else {
      String sUsrId = oLst.get(0).id();     
      oSes.disconnect();
      oSes.close();
      return sUsrId;     
    }
  }
View Full Code Here

    oSrv = oCapSrv;
  }
 
  public void run() {
    Log.out.debug("Begin AttachDeposit.run()");   
    AtrilSession oSes = null;
    try {
      oSes = DAO.getAdminSession("DepositToZespedBridge");
      oSes.autoCommit(false);
      switch (oSrv) {
        case BILLNOTES:
          addSidesToTicket(oSes);
          break;
        case INVOICES:
          addDocumentsToInvoices(oSes);
          break;
      }
      oSes.commit();
      oSes.disconnect();
      oSes.close();
      oSes = null;
    } catch (Exception xcpt) {
      Log.out.error("DepositToZespedBridge.run() "+xcpt.getClass().getName()+" "+xcpt.getMessage(), xcpt);
    } finally {
      if (oSes!=null) {
        if (oSes.isConnected()) oSes.disconnect();
        if (oSes.isOpen()) oSes.close();
      }
    }
    Log.out.debug("End AttachDeposit.run()");   
  }
View Full Code Here

  }

  public Role getRole(CustomerAccount oAcc) throws NullPointerException {
    if (null==oAcc) throw new NullPointerException("User.getRole() CustomerAccount cannot be null");
    Log.out.debug("Begin User.getRole("+oAcc.getBusinessName()+")");
    AtrilSession oSes = DAO.getAdminSession("getRole");
    Role eRetVal = null;
    try {
      for (User oUsr : oAcc.getAdmins(oSes))
        if (id().equals(oUsr.id()))
          eRetVal = Role.admin;
      if (null==eRetVal)
        for (User oUsr : oAcc.getUsers(oSes))
          if (id().equals(oUsr.id()))
            eRetVal = Role.user;
      if (null==eRetVal)
        for (User oUsr : oAcc.getGuests(oSes))
          if (id().equals(oUsr.id()))
            eRetVal = Role.guest;
    } finally {
      if (oSes!=null) {
        if (oSes.isConnected()) oSes.disconnect();
        if (oSes.isOpen()) oSes.close();       
      }     
    }
    Log.out.debug("End User.getRole() : "+eRetVal);
    return eRetVal;
  }
View Full Code Here

   
  @Override
  public User convert(String sDocId, Class<? extends User> userClass,
               Collection<ValidationError> conversionErrors) {
    try {     
      AtrilSession oSes = DAO.getAdminSession("User");
      User oUsr = new User(oSes, sDocId);
      oSes.disconnect();
      oSes.close();
      oSes = null;
      return oUsr;
    } catch (Exception exc) {
      Log.out.error(exc.getClass().getName()+" User.convert("+sDocId+") "+exc.getMessage());
      conversionErrors.add(new SimpleError(exc.getMessage()));
View Full Code Here

    if (DAO.getRepositoryVersion()==null) {
      createAllModules();
    }

    AtrilSession oSess = DAO.getAdminSession(getClass().getName()+".createDataModel");

    Dms oDms = oSess.getDms();
    InternationalizationManager oInm = oDms.getInternationalizationManager();
    Locale oES = new Locale("es", "ES");
   
    createTypeHierarchy(oDms, oDms.getRootType(), new String[]{"Configurations","Endorsements","Endorsement"});
    createTypeHierarchy(oDms, oDms.getRootType(), new String[]{"Deposits","Deposit","Document","Side"});
    createTypeHierarchy(oDms, oDms.getRootType(), new String[]{"CaptureTypes","CaptureType","Fields","Field"});
    createTypeHierarchy(oDms, oDms.getDocumentType("CaptureType"), new String[]{"Scanner"});
    createTypeHierarchy(oDms, oDms.getRootType(), new String[]{"DeviceInformationType"});
    createTypeHierarchy(oDms, oDms.getRootType(), new String[]{"Zesped","CustomerAccount","TaxPayers","TaxPayer","Invoices","Invoice","InvoiceThumbnail"});
    createTypeHierarchy(oDms, oDms.getRootType(), new String[]{"Zesped","CaptureServiceFlavor"});
    createTypeHierarchy(oDms, oDms.getRootType(), new String[]{"Zesped","Countries","Country","States","State","Cities","City"});
    createTypeHierarchy(oDms, oDms.getRootType(), new String[]{"Zesped","VatPercents","VatPercent"});
    createTypeHierarchy(oDms, oDms.getDocumentType("Zesped"), new String[]{"Users","User","AllowedTaxPayers","AllowedTaxPayer"});
    createTypeHierarchy(oDms, oDms.getDocumentType("User"), new String[]{"DeniedTaxPayers","DeniedTaxPayer"});
    createTypeHierarchy(oDms, oDms.getDocumentType("Zesped"), new String[]{"Messages","Message"});
    createTypeHierarchy(oDms, oDms.getDocumentType("Zesped"), new String[]{"Products","Product"});
    createTypeHierarchy(oDms, oDms.getDocumentType("Zesped"), new String[]{"AccountingAccountsDefaults","AccountingAccountDefault"});
    createTypeHierarchy(oDms, oDms.getDocumentType("CustomerAccount"), new String[]{"Orders","Order","OrderLine"});
    createTypeHierarchy(oDms, oDms.getDocumentType("CustomerAccount"), new String[]{"Clients","Client"});
    createTypeHierarchy(oDms, oDms.getDocumentType("CustomerAccount"), new String[]{"CustomerAccountCredits"});
    createTypeHierarchy(oDms, oDms.getDocumentType("TaxPayer"), new String[]{"BillNotes","BillNote","Ticket","TicketThumbnail"});
    createTypeHierarchy(oDms, oDms.getDocumentType("TaxPayer"), new String[]{"Employees","Employee"});
    createTypeHierarchy(oDms, oDms.getDocumentType("TaxPayer"), new String[]{"AccountingAccounts","AccountingAccount"});
    createTypeHierarchy(oDms, oDms.getDocumentType("TaxPayer"), new String[]{"IncomingDeposits"});
   
    addTypeAttributes(oSess, oDms.getDocumentType("AccountingAccount"), new AccountingAccount().attributes());
    addTypeAttributes(oSess, oDms.getDocumentType("AccountingAccountDefault"), new AccountingAccountDefault().attributes());
    addTypeAttributes(oSess, oDms.getDocumentType("AllowedTaxPayer"), new AllowedTaxPayer().attributes());
    addTypeAttributes(oSess, oDms.getDocumentType("CaptureServiceFlavor"), new CaptureServiceFlavor().attributes());
    addTypeAttributes(oSess, oDms.getDocumentType("CaptureTypes"), new CaptureTypes().attributes());
    addTypeAttributes(oSess, oDms.getDocumentType("CaptureType"), new CaptureType().attributes());
    addTypeAttributes(oSess, oDms.getDocumentType("BillNote"), new BillNote().attributes());
    addTypeAttributes(oSess, oDms.getDocumentType("City"), new City().attributes());
    addTypeAttributes(oSess, oDms.getDocumentType("Client"), new Client().attributes());
    addTypeAttributes(oSess, oDms.getDocumentType("Country"), new Country().attributes());
    addTypeAttributes(oSess, oDms.getDocumentType("CustomerAccount"), new CustomerAccount().attributes());
    addTypeAttributes(oSess, oDms.getDocumentType("CustomerAccountCredits"), new CustomerAccountCredits().attributes());
    addTypeAttributes(oSess, oDms.getDocumentType("DeniedTaxPayer"), new DeniedTaxPayer().attributes());
    addTypeAttributes(oSess, oDms.getDocumentType("Deposit"), new Deposit().attributes());
    addTypeAttributes(oSess, oDms.getDocumentType("Deposits"), new Deposits().attributes());
    addTypeAttributes(oSess, oDms.getDocumentType("DeviceInformationType"), new DeviceInformationType().attributes());
    addTypeAttributes(oSess, oDms.getDocumentType("Document"), new com.zesped.model.Document().attributes());
    addTypeAttributes(oSess, oDms.getDocumentType("Employee"), new Employee().attributes());
    addTypeAttributes(oSess, oDms.getDocumentType("Endorsement"), new Endorsement().attributes());
    addTypeAttributes(oSess, oDms.getDocumentType("Field"), new Field().attributes());
    addTypeAttributes(oSess, oDms.getDocumentType("Invoice"), new Invoice().attributes());
    addTypeAttributes(oSess, oDms.getDocumentType("InvoiceThumbnail"), new InvoiceThumbnail().attributes());
    addTypeAttributes(oSess, oDms.getDocumentType("Message"), new Message().attributes());
    addTypeAttributes(oSess, oDms.getDocumentType("Order"), new Order().attributes());
    addTypeAttributes(oSess, oDms.getDocumentType("OrderLine"), new OrderLine().attributes());
    addTypeAttributes(oSess, oDms.getDocumentType("Product"), new Product().attributes());
    addTypeAttributes(oSess, oDms.getDocumentType("Scanner"), new Scanner().attributes());
    addTypeAttributes(oSess, oDms.getDocumentType("Side"), new Side().attributes());
    addTypeAttributes(oSess, oDms.getDocumentType("State"), new State().attributes());
    addTypeAttributes(oSess, oDms.getDocumentType("TaxPayer"), new TaxPayer().attributes());
    addTypeAttributes(oSess, oDms.getDocumentType("Ticket"), new Ticket().attributes());
    addTypeAttributes(oSess, oDms.getDocumentType("TicketThumbnail"), new TicketThumbnail().attributes());
    addTypeAttributes(oSess, oDms.getDocumentType("User"), new User().attributes());
    addTypeAttributes(oSess, oDms.getDocumentType("VatPercent"), new VatPercent().attributes());
   
    oInm.setCaptionFormat(oDms.getDocumentType("Zesped"), Locale.ENGLISH, "{#TypeName}");
    oInm.setCaptionFormat(oDms.getDocumentType("Zesped"), oES, "{#TypeName}");

    oInm.setCaptionFormat(oDms.getDocumentType("CaptureServiceFlavor"), Locale.ENGLISH, "{id}");
    oInm.setCaptionFormat(oDms.getDocumentType("CaptureServiceFlavor"), oES, "{id}");
   
    oInm.setCaptionFormat(oDms.getDocumentType("TaxPayers"), Locale.ENGLISH, "{#TypeName}");
    oInm.setCaptionFormat(oDms.getDocumentType("TaxPayers"), oES, "{#TypeName}");
    oInm.setCaptionFormat(oDms.getDocumentType("Invoices"), Locale.ENGLISH, "{#TypeName}");
    oInm.setCaptionFormat(oDms.getDocumentType("Invoices"), oES, "{#TypeName}");

    oInm.setCaptionFormat(oDms.getDocumentType("Country"), Locale.ENGLISH, "{en}");
    oInm.setCaptionFormat(oDms.getDocumentType("Country"), oES, "{es}");

    oInm.setCaptionFormat(oDms.getDocumentType("State"), Locale.ENGLISH, "{name}");
    oInm.setCaptionFormat(oDms.getDocumentType("State"), oES, "{name}");

    oInm.setCaptionFormat(oDms.getDocumentType("City"), Locale.ENGLISH, "{name}");
    oInm.setCaptionFormat(oDms.getDocumentType("City"), oES, "{name}");
   
    oInm.setCaptionFormat(oDms.getDocumentType("Users"), Locale.ENGLISH, "{#TypeName}");
    oInm.setCaptionFormat(oDms.getDocumentType("Users"), oES, "{#TypeName}");

    oInm.setCaptionFormat(oDms.getDocumentType("VatPercent"), Locale.ENGLISH, "{percentage} {description}");
    oInm.setCaptionFormat(oDms.getDocumentType("VatPercent"), oES, "{percentage} {description}");
   
    oInm.setCaptionFormat(oDms.getDocumentType("AccountingAccountsDefaults"), Locale.ENGLISH, "{#TypeName}");
    oInm.setCaptionFormat(oDms.getDocumentType("AccountingAccountsDefaults"), oES, "{#TypeName}");

    oInm.setCaptionFormat(oDms.getDocumentType("AccountingAccountDefault"), Locale.ENGLISH, "{account_code} - {account_desc}");
    oInm.setCaptionFormat(oDms.getDocumentType("AccountingAccountDefault"), oES, "{account_code} - {account_desc}");

    oInm.setCaptionFormat(oDms.getDocumentType("Messages"), Locale.ENGLISH, "{#TypeName}");
    oInm.setCaptionFormat(oDms.getDocumentType("Messages"), oES, "{#TypeName}");
   
    oInm.setCaptionFormat(oDms.getDocumentType("Products"), Locale.ENGLISH, "{#TypeName}");
    oInm.setCaptionFormat(oDms.getDocumentType("Products"), oES, "{#TypeName}");
   
    oInm.setCaptionFormat(oDms.getDocumentType("Orders"), Locale.ENGLISH, "{#TypeName}");
    oInm.setCaptionFormat(oDms.getDocumentType("Orders"), oES, "{#TypeName}");

    oInm.setCaptionFormat(oDms.getDocumentType("Clients"), Locale.ENGLISH, "{#TypeName}");
    oInm.setCaptionFormat(oDms.getDocumentType("Clients"), oES, "{#TypeName}");

    oInm.setCaptionFormat(oDms.getDocumentType("BillNotes"), Locale.ENGLISH, "{#TypeName}");
    oInm.setCaptionFormat(oDms.getDocumentType("BillNotes"), oES, "{#TypeName}");

    oInm.setCaptionFormat(oDms.getDocumentType("Employees"), Locale.ENGLISH, "{#TypeName}");
    oInm.setCaptionFormat(oDms.getDocumentType("Employees"), oES, "{#TypeName}");

    oInm.setCaptionFormat(oDms.getDocumentType("Employee"), Locale.ENGLISH, "{employee_name} ({employee_id})");
    oInm.setCaptionFormat(oDms.getDocumentType("Employee"), oES, "{employee_name} ({employee_id})");
       
    oInm.setCaptionFormat(oDms.getDocumentType("AccountingAccounts"), Locale.ENGLISH, "{#TypeName}");
    oInm.setCaptionFormat(oDms.getDocumentType("AccountingAccounts"), oES, "{#TypeName}");

    oInm.setCaptionFormat(oDms.getDocumentType("AccountingAccount"), Locale.ENGLISH, "{account_code} - {account_desc}");
    oInm.setCaptionFormat(oDms.getDocumentType("AccountingAccount"), oES, "{account_code} - {account_desc}");
   
    oInm.setCaptionFormat(oDms.getDocumentType("CustomerAccount"), Locale.ENGLISH, "{business_name}");
    oInm.setCaptionFormat(oDms.getDocumentType("CustomerAccount"), oES, "{business_name}");

    oInm.setCaptionFormat(oDms.getDocumentType("CustomerAccountCredits"), Locale.ENGLISH, "Used {credits_used} Left {credits_left}");
    oInm.setCaptionFormat(oDms.getDocumentType("CustomerAccountCredits"), oES, "Usados {credits_used} Disponibles {credits_left}");
   
    oInm.setCaptionFormat(oDms.getDocumentType("Order"), Locale.ENGLISH, "{order_id} / {creation_date}");
    oInm.setCaptionFormat(oDms.getDocumentType("Order"), oES, "{order_id} / {creation_date}");

    oInm.setCaptionFormat(oDms.getDocumentType("OrderLine"), Locale.ENGLISH, "{line_num}: {product_name}");
    oInm.setCaptionFormat(oDms.getDocumentType("OrderLine"), oES, "{line_num}: {product_name}");
   
    oInm.setCaptionFormat(oDms.getDocumentType("TaxPayer"), Locale.ENGLISH, "{business_name} ({tax_id})");
    oInm.setCaptionFormat(oDms.getDocumentType("TaxPayer"), oES, "{business_name} ({tax_id})");
   
    oInm.setCaptionFormat(oDms.getDocumentType("Client"), Locale.ENGLISH, "{business_name} ({tax_id})");
    oInm.setCaptionFormat(oDms.getDocumentType("Client"), oES, "{business_name} ({tax_id})");
   
    oInm.setCaptionFormat(oDms.getDocumentType("Invoice"), Locale.ENGLISH, "{invoice_number}");
    oInm.setCaptionFormat(oDms.getDocumentType("Invoice"), oES, "{invoice_number}");
   
    oInm.setCaptionFormat(oDms.getDocumentType("BillNote"), Locale.ENGLISH, "{employee_name} {comments}");
    oInm.setCaptionFormat(oDms.getDocumentType("BillNote"), oES, "{employee_name} {comments}");

    oInm.setCaptionFormat(oDms.getDocumentType("Ticket"), Locale.ENGLISH, "{ticket_date} {comments}");
    oInm.setCaptionFormat(oDms.getDocumentType("Ticket"), oES, "{ticket_date} {comments}");
   
    oInm.setCaptionFormat(oDms.getDocumentType("User"), Locale.ENGLISH, "{email}");
    oInm.setCaptionFormat(oDms.getDocumentType("User"), oES, "{email}");
   
    oInm.setCaptionFormat(oDms.getDocumentType("Message"), Locale.ENGLISH, "{message_subject}");
    oInm.setCaptionFormat(oDms.getDocumentType("Message"), oES, "{message_subject}");

    oInm.setCaptionFormat(oDms.getDocumentType("Product"), Locale.ENGLISH, "{product_name}");
    oInm.setCaptionFormat(oDms.getDocumentType("Product"), oES, "{product_name} ({price} {currency})");

    oInm.setCaptionFormat(oDms.getDocumentType("CaptureType"), Locale.ENGLISH, "{name}");
    oInm.setCaptionFormat(oDms.getDocumentType("CaptureType"), oES, "{name}");

    oInm.setCaptionFormat(oDms.getDocumentType("DeviceInformationType"), Locale.ENGLISH, "{brand} {model}");
    oInm.setCaptionFormat(oDms.getDocumentType("DeviceInformationType"), oES, "{brand} {model}");
   
    DocumentType oDepT = oDms.getDocumentType("Deposit");
    DocumentType oSidT = oDms.getDocumentType("Side");
    DocumentType oInvT = oDms.getDocumentType("Invoice");
    DocumentType oTckT = oDms.getDocumentType("Ticket");
    DocumentType oIncT = oDms.getDocumentType("IncomingDeposits");
    try {
      oSidT.addParent(oInvT);
        oSidT.save();
    } catch (IllegalArgumentException yaespadre) { }
    try {
        oSidT.addParent(oTckT);
        oSidT.save();
    } catch (IllegalArgumentException yaespadre) { }
    try {
      oDepT.addParent(oIncT);
      oDepT.save();
    } catch (IllegalArgumentException yaespadre) { }

    oSess.commit();

    String sMountBase = "/usr/local/apache-tomcat-6.0.36/webapps/zesped/WEB-INF/volumes/"; // DAO.getVolumesMountBase();
    if (sMountBase.length()>0) {
      boolean bDefaultVolumeExists = false;
      VolumeManager oVolm = oDms.getVolumeManager();
      for (Volume v : oVolm.getVolumeList()) {
        bDefaultVolumeExists = v.name().equals("Default");
        if (bDefaultVolumeExists) break;
      }
      if (!bDefaultVolumeExists) {
        sMountBase = Gadgets.chomp(sMountBase, File.separator);
          FileSystem oFs = new FileSystem();
          try {
        oFs.mkdirs("file://"+sMountBase+"default");
      } catch (Exception e) {
        throw new FileNotFoundException("Could not create directory "+sMountBase+"default");
      }
          if (!new File(sMountBase).exists()) throw new FileNotFoundException("Could not create directory "+sMountBase+"default");
          Volume oVol = oVolm.createVolume("Default", sMountBase, "default", 20*1048576);
          oVol.setTotalSpace(100*1048576);
          oVol.setDescription("Default Zesped Volume");
          oVol.setMounted(true);
          oVol.setUsable(true);
          oVol.setMaxDirectories(1000);
          oVol.setMaxFiles(1000);
          oVol.save();
          oSess.commit();       
      }
    }
   
    oSess.disconnect();
    oSess.close();
   
  } // createDataModel
View Full Code Here

  // ---------------------------------------------------------------------------

  public void writeInfrastructureDocuments() {

      AtrilSession oSess = DAO.getAdminSession(getClass().getName()+".createDataModel");

      AuthorizationManager oAum = oSess.getAuthorizationManager();
     
    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) {
      createDocumentOfType(oIdx, oDms, "Users", oZespedDoc);
    }
    try {
      Products.top(oSess);
    } catch (ElementNotFoundException enfe) {
      Document oProds = createDocumentOfType(oIdx, oDms, "Products", oZespedDoc);
      oUsrsGrp.grantReadOnly(oProds);
    }
    try {
      Countries.top(oSess);
    } catch (ElementNotFoundException enfe) {
      Document oCountries = createDocumentOfType(oIdx, oDms, "Countries", oZespedDoc);
      oUsrsGrp.grantReadOnly(oCountries);
    }
    try {
      AccountingAccountsDefaults.top(oSess);
    } catch (ElementNotFoundException enfe) {
      Document oAAccsDefs = createDocumentOfType(oIdx, oDms, "AccountingAccountsDefaults", oZespedDoc);
      oUsrsGrp.grantReadOnly(oAAccsDefs);
    }
    try {
      VatPercents.top(oSess);
    } catch (ElementNotFoundException enfe) {
      Document oVatPcts = createDocumentOfType(oIdx, oDms, "VatPercents", oZespedDoc);
      oUsrsGrp.grantReadOnly(oVatPcts);
    }
     
      oSess.commit();
      oSess.disconnect();
      oSess.close();
  }
View Full Code Here

    JDCConnection oCon = DAO.getConnection("ModelManager");
    createCache(oCon);
    oCon.close("ModelManager");

  AtrilSession oSes = DAO.getAdminSession("ModelManager");

  createDeposits(oSes)
  oSes.commit();
 
  createCaptureTypes(oSes);
  oSes.commit();
 
  oMan.writeServiceFlavors(oSes);
  oSes.commit();

  oMan.writeProducts(oSes);
  oSes.commit();
 
  oMan.writeVatPercents(oSes);
  oSes.commit();
 
  oMan.writeAccountingAccounts(oSes);
  oSes.commit();

  oMan.writeCountries(oSes);
  oSes.commit();

  oMan.writeStates(oSes, "es");
  oSes.commit();

  /*
  oMan.writeCities(oSes, "es");
  oSes.commit();
  */
 
    oSes.disconnect();
    oSes.close();
    oDao.destroy();
  System.out.println("Done!");
  }
View Full Code Here

      return false;
    }
  }
 
  public static void disposeSession(String sId) {
    AtrilSession oSes = getSession(sId);
    if (oSes!=null) {
      if (oSessions.containsKey(sId)) oSessions.remove(sId);
      if (oSes.isConnected()) oSes.close();
      if (oSes.isOpen()) oSes.close();
    }
  }
View Full Code Here

  }

  // --------------------------------------------------------------------------

  public static void log(Class oCls, String sCategory, AtrilEvent.Level eLevel, String sDetails) throws AuthenticationException, SecuritySystemException,PersistenceManagerException {
    AtrilSession oSes = getAdminSession("log");
    oSes.getEventLogger().registerEvent(new AtrilEvent.Builder(oCls.getName(), sCategory, eLevel).setDetails(sDetails).build());
    oSes.commit();
    oSes.disconnect();
    oSes.close();
  }
View Full Code Here

TOP

Related Classes of es.ipsa.atril.sec.authentication.AtrilSession

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.