Package es.ipsa.atril.doc.user

Examples of es.ipsa.atril.doc.user.Dms.query()


              if (getString(aAttrs[a].name).indexOf("'")<0)
                oLst = oDms.query(getTypeName()+"$"+aAttrs[a].name+"='"+escape(getString(aAttrs[a].name))+"'");
              else
              oLst = null;
            else if (aAttrs[a].dataType.equals(DataType.NUMBER))
                oLst = oDms.query(getTypeName()+"$"+aAttrs[a].name+"="+get(aAttrs[a].name));
            else
              oLst = null;
            if (null!=oLst) {
              if (!oLst.isEmpty()) {
                String p = parentId();           
View Full Code Here


  public void archive(AtrilSession oSes) {
    Dms oDms = oSes.getDms();
    if (!isNull("thread_id")) {
      if (getString("thread_id").length()>0) {
        SortableList<Document> oThd = oDms.query("Message$thread_id='"+getString("thread_id")+"'");
        if (!oThd.isEmpty()) {
          for (Document m : oThd) {
            Document oMsg = oDms.getDocument(m.id());
            oMsg.attribute("is_archived").set("1");
            oMsg.save("archive");
View Full Code Here

    return aCtps;
 

  public static CaptureType seek(AtrilSession oSes, String sName) throws ElementNotFoundException {
    Dms oDms = oSes.getDms();
    SortableList<Document> oLst = oDms.query("CaptureType$name='"+sName+"'");
    if (oLst.isEmpty())
      throw new ElementNotFoundException("CaptureType "+sName+" not found");
    return new CaptureType(oDms.getDocument(oLst.get(0).id()));
  }
View Full Code Here

  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

    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()));
  }
 
  public static List<CustomerAccount> search(AtrilSession oSes, String sNameOrId) {
View Full Code Here

  }
   
  public ArrayList<BillNote> billNotes(AtrilSession oSes) {
    ArrayList<BillNote> aLst = new ArrayList<BillNote>();
    Dms oDms = oSes.getDms();
    List<Document> oLbn = oDms.query("BillNote$employee_uuid='"+getUuid()+"'");
    if (!oLbn.isEmpty()) {
        for (Document b : oLbn) {
          aLst.add(new BillNote(oDms, b.id()));
      }
    } 
View Full Code Here

  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 {
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 {
View Full Code Here

    try {
          connect(getSessionAttribute("nickname"), getSessionAttribute("password"));
          Dms oDms = getSession().getDms();
          AccountingAccount oAacc = new AccountingAccount(oDms, id);
          SortableList<Document> oTcks = oDms.query("Ticket$accounting_uuid='"+oAacc.getUuid()+"'");
      if (!oTcks.isEmpty()) {
        addError(new LocalizableError("com.zesped.action.CheckCanDeleteAccountingAccount.hasTickets"));       
      }
      disconnect();
      } catch (Exception xcpt) {
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");
View Full Code Here

TOP
Copyright © 2018 www.massapi.com. 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.