Package com.zesped.model

Examples of com.zesped.model.User


  public Resolution form() {
    final String sUsrId = getSessionAttribute("user_docid");
    if (sUsrId!=null) {
      try {
        connect();
        User oUsr = new User(getSession(), sUsrId);
        setName(oUsr.getFirstName()+" "+oUsr.getLastName());
        setEmail(oUsr.getEmail());
        uuid = oUsr.getString("user_uuid");
        disconnect();
      } catch (StorageException e) {
      } finally {
        close();
      }
View Full Code Here


    final String sSubject = getParam("subject");
    final String sBody = getParam("body");
    if (getErrorsCount()==0) {
      try {
        connect();
        User oMe = new User(getSession(), getSessionAttribute("user_docid"));
        User oRe = new User(getSession(), User.forUuid(sReciptId));
        Message oMsg = Messages.reply(getSession(), sThreadId,
                        oMe.getFullName(), oMe.getEmail(), oMe.getNickName(),
                             oRe.getEmail(), oRe.getNickName(), sSubject, sBody);
        disconnect();
          addDataLine("id",oMsg.id());
      } catch (Exception xcpt) {
        Log.out.error(xcpt.getMessage(), xcpt);
        addError(new SimpleError(xcpt.getMessage()));
View Full Code Here

        setParam("former_id", getId());
      }
      disconnect();
      if (oInv.hasMistakes()) {
        connect();
        User oMe = new User(getSession(), getSessionAttribute("user_docid"));
        User oTo = new User(getSession(), User.forUuid(oInv.getString("captured_by")));
        Messages.notify(getSession(), oMe.getFirstName()+" "+oMe.getLastName(),
                  oMe.getEmail(), oMe.getNickName(), oTo.getEmail(), oTo.getNickName(),
                  "Incidencia con la factura "+getId(), oInv.getComments(), getId());     
        disconnect();
      }
    } catch (Exception e) {
      Log.out.error("Invoice.save() "+e.getClass().getName()+" "+e.getMessage());
View Full Code Here

        SortableList<Document> oNext = oDms.query("(Invoice$is_processed='1') & (Invoice$is_approved='0') & (Invoice$recipient_taxpayer='"+getRecipientTaxPayer()+"')");
        if (!oNext.isEmpty()) {
          oRes = new RedirectResolution("/EditInvoice.action?a=1&id="+oNext.get(0).id());
          setParam("former_id", getId());
        }
        User oMe = new User(getSession(), getSessionAttribute("user_docid"));
        User oTo = new User(getSession(), User.forUuid(oInv.getString("captured_by")));
        Messages.notify(getSession(), oMe.getFirstName()+" "+oMe.getLastName(),
                  oMe.getEmail(), oMe.getNickName(), oTo.getEmail(), oTo.getNickName(),
                  "Incidencia con la factura "+getId(), oInv.getComments(), getId());
        disconnect();
      } catch (Exception e) {
        Log.out.error("Invoice.reject()"+e.getClass().getName()+" "+e.getMessage());
      } finally {
View Full Code Here

    final String sFormerPassword = getParam("formerPassword","");
    final String sNewPassword1 = getParam("newPassword","");
    final String sNewPassword2 = getParam("newPassword2","");
    try {
      connect();
      User oUsr = new User(getSession(), getSessionAttribute("user_docid"));
      if (!oUsr.getPassword().equals(sFormerPassword) && sFormerPassword.length()>0)
        addError("password", new LocalizableError("com.zesped.action.SaveConfig.formerPassWordMismatch"));
      else if (!sNewPassword1.equals(sNewPassword2))
        addError("password", new LocalizableError("com.zesped.action.SaveConfig.newPassWordsMismatch"));
      else if (sNewPassword1.length()<6 && sNewPassword1.length()>0)
        addError("password", new LocalizableError("com.zesped.action.SaveConfig.newPassWordTooShort"));
View Full Code Here

      final String sEmail = getParam("user.email","");
      final String sFormerPassword = getParam("formerPassword","");
      final String sNewPassword1 = getParam("newPassword","");
      try {
        connect();
        User oUsr = new User(getSession(), getSessionAttribute("user_docid"));
        if (sNewPassword1.length()>0 && sFormerPassword.length()>0) {
          oUsr.setPassword(sNewPassword1);
          LoginInterceptor.expire(oUsr.getNickName(), oUsr.getPassword());
          setSessionAttribute("password", sNewPassword1);
        }
        oUsr.setFirstName(sFirstName);
        oUsr.setLastName(sLastName);
        oUsr.setEmail(sEmail);
        oUsr.save(getSession());         
        setSessionAttribute("fullname", oUsr.getFirstName()+" "+oUsr.getLastName());
        disconnect();
        addDataLine("id",oUsr.id());
      } catch (RecentlyUsedPasswordException rupe) {
        addError("password", new LocalizableError("com.zesped.action.SaveConfig.recentlyUsedPassword"));
      } catch (Exception xcpt) {
        Log.out.error("SaveConfig.save( "+xcpt.getClass().getName()+" "+xcpt.getMessage(), xcpt);   
      } finally {
View Full Code Here

        final String sUuid = oIter.next().getName();
        if (!sUuid.equals("admin")) {
            String sId = "";
            try {
              sId = User.forUuid(sUuid);
              aUsrs.add(new User(oSes, sId));
            } catch (NotEnoughRightsException nere) {
                Log.out.error("UserGroup.getMembers() "+nere.getMessage()+" "+sUuid+" "+sId);             
            }
        }
      }
View Full Code Here

  }

  @DefaultHandler
  public Resolution form() {

    User oUser;
    HashMap<String, Object> oSessionInfo;
   
    id = getParam("id","");
    uid = getParam("uid","");
    passw = getParam("pwd","");
    changepassw = passw.length()>0;
   
    if (id.length()==0)
      return new RedirectResolution("/error.jsp?e=usernotfound");
    if (uid.length()==0 && passw.length()==0)
      return new RedirectResolution("/error.jsp?e=userdatanotfound");
   
    try {
      oSessionInfo = Cache.getEntryMap(id+"activationinfo");
    } catch (Exception xcpt) {
      oSessionInfo = null;
    }

    if (oSessionInfo!=null) {

      setSessionAttributes(oSessionInfo);
      email = (String) oSessionInfo.get("email");
      hasorders = ((Boolean) oSessionInfo.get("hasorders")).booleanValue();
      if (!changepassw) {
        try {
          connect();
          oUser = new User(getSession(), id);
          oUser.activate();
          oUser.save(getSession());
          DAO.log(User.class, "ACTIVATE USER", AtrilEvent.Level.INFO, email+";"+id+";"+uid);
          disconnect();
        } catch (StorageException stge) {
          Log.out.error("ActivateUser.form() "+stge.getClass().getName()+" "+stge.getMessage(), stge);
        } finally {
          close();
        }
      }
      try {
        Cache.deleteEntry(id+"activationinfo");
      } catch (SQLException ignore) { }
     
    } else {
      try {
        connect();
        oUser = new User(getSession(), id);
        if (!oUser.getNickName().equals(uid) && !oUser.getPassword().equals(passw))
          throw new AuthenticationException("User Id. does not match UUID or Password");
        email = oUser.getEmail();
        if (!changepassw) {
          oUser.activate();
          oUser.save(getSession());
          DAO.log(User.class, "ACTIVATE USER", AtrilEvent.Level.INFO, email+";"+id+";"+uid);
        }
        CustomerAccount oCacc = new CustomerAccount(getSession(), oUser);
        Employee oEmpl = new Employee();
        String sEmpl = null;
        if (oEmpl.exists(getSession(), "employee_uuid", oUser.getNickName())!=null)
          sEmpl = oUser.getNickName();
        setSessionAttributes(oUser, oCacc, oCacc.taxpayers(getSession()).byDefault(getSession(),oUser),sEmpl);
        hasorders = (oCacc.orders(getSession()).count()>0);
        disconnect();       
        } catch (AuthenticationException acpt) {
          DAO.log(User.class, "ACTIVATE USER", AtrilEvent.Level.WARNING, email+";"+id+";"+uid);
View Full Code Here

  }

  public Resolution save() {
    try {
      connect();
      User oUser = new User(getSession(), getId());
      oUser.setPassword(getPassword());
      oUser.activate();
      oUser.save(getSession());
      DAO.log(User.class, "ACTIVATE USER", AtrilEvent.Level.INFO, email+";"+id+";"+uid);
      disconnect();
      setSessionAttribute("password", getPassword());
    } catch (Exception xcpt) {
      Log.out.error("ActivateUser.save() "+xcpt.getClass().getName()+" "+xcpt.getMessage(), xcpt);
View Full Code Here

    final String sTid = getParam("tid","");
    Log.out.debug("Begin MultiSelectTaxPayers.form({id:"+sUid+",tid:"+sTid+"})");
    if (sUid.length()>0) {
      try {
            connect();
            User oUsr = new User(getSession(), sUid);
            if (oUsr.getAllowedTaxPayers().size()>0)
              for (BaseCompanyObject oAtp : oUsr.getAllowedTaxPayers())
                selectedTaxPayers.add(new NameValuePair(oAtp.getBusinessName(), oAtp.getString("taxpayer")));         
            else if (oUsr.getDeniedTaxPayers().size()>0)
              for (BaseCompanyObject oDtp : oUsr.getDeniedTaxPayers())
                selectedTaxPayers.add(new NameValuePair(oDtp.getBusinessName(), oDtp.getString("taxpayer")));               
            disconnect();
          } catch (Exception xcpt) {
            Log.out.error(xcpt.getMessage(), xcpt);
          } finally {
View Full Code Here

TOP

Related Classes of com.zesped.model.User

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.