Package com.knowgate.acl

Examples of com.knowgate.acl.ACLUser


  public short getWorkLoadPercentage() {
    return iPct;
  }

  public boolean load (JDCConnection oConn, String sWorkArea, String sId) throws SQLException {
    ACLUser  oUser = new ACLUser();
    Fellow   oFellw = new Fellow();
    Contact  oCont = new Contact();
    Company  oComp = new Company();
    Supplier oSupl = new Supplier();
    boolean bFound;
   
  PreparedStatement oStmt = oConn.prepareStatement("SELECT "+DB.pg_lookup+" FROM "+DB.k_duties_lookup+" WHERE "+DB.gu_owner+"=? AND "+DB.id_section+"='nm_resource' AND "+DB.vl_lookup+"=?",
                                                   ResultSet.TYPE_FORWARD_ONLY, ResultSet.CONCUR_READ_ONLY);
  oStmt.setString(1, sWorkArea);
  oStmt.setString(2, sId);
  ResultSet oRSet = oStmt.executeQuery();
  bFound = oRSet.next();
  if (bFound) iPg = oRSet.getInt(1);
  oRSet.close();
  oStmt.close();

  if (bFound) {
      sVl = sId;

      if (oFellw.load(oConn, sId)) {
      sFullName = (oFellw.getStringNull(DB.tx_name,"")+" "+oFellw.getStringNull(DB.tx_surname,"")).trim();
      sEmail = oUser.getStringNull(DB.tx_email,"");
      sPhone = oUser.getStringNull(DB.work_phone,"");
      } else if (oUser.load(oConn, sId)) {
      sFullName = (oUser.getStringNull(DB.nm_user,"")+" "+oUser.getStringNull(DB.tx_surname1,"")+" "+oUser.getStringNull(DB.tx_surname2,"")).trim();
      sEmail = oUser.getStringNull(DB.tx_main_email,"");
      sPhone = "";
      } else if (oCont.load(oConn, sId)) {
      sFullName = (oCont.getStringNull(DB.tx_name,"")+" "+oCont.getStringNull(DB.tx_surname,"")).trim();
      sEmail = "";
      sPhone = "";
View Full Code Here


      Job oSnd;
      DBPersist oJob = new DBPersist(DB.k_jobs,"Job");
      oCon = oDbb.getConnection("SendMail",false);
      oCon.setAutoCommit(false);

      ACLUser oUsr = new ACLUser(oCon, oMacc.getString(DB.gu_user));

      String sJobId = Job.getIdFromTitle(oCon, sJobTl, oUsr.getString(DB.gu_workarea));

      if (null==sJobId) {
        if (DebugFile.trace) DebugFile.writeln("Job "+sJobTl+" not found, creating a new one...");
     
      if (oMacc.isNull(DB.gu_account)) {
        if (DebugFile.trace) DebugFile.decIdent();
          throw new SQLException("No MailAccount found for user "+oUsr.getString(DB.gu_user),"01S06");       
      }

        String sMBoxDir = DBStore.MBoxDirectory(oDbb.getProfileName(),oUsr.getInt(DB.id_domain),oUsr.getString(DB.gu_workarea));

        if (DebugFile.trace) DebugFile.writeln("mbox directory is "+sMBoxDir);

        SessionHandler oHndl = new SessionHandler(oMacc,sMBoxDir);
        DBStore oRDBMS = DBStore.open(oHndl.getSession(), oDbb.getProfileName(), sMBoxDir, oUsr.getString(DB.gu_user), oUsr.getString(DB.tx_pwd));
      DBFolder oOutbox = oRDBMS.openDBFolder("outbox",DBFolder.READ_WRITE);

      DBMimeMessage oMsg = DraftsHelper.draftMessage(oOutbox, oMacc.getString(DB.outgoing_server),
                               oUsr.getString(DB.gu_workarea),
                               oUsr.getString(DB.gu_user),
                               sTextHtml==null ? "plain" : "html");

      String sMsgId = oMsg.getContentID();

        if (null==sMsgId) throw new NullPointerException("MIME message identifier could not be set for message with GUID "+oMsg.getMessageGuid());

        DraftsHelper.draftUpdate(oCon, oUsr.getInt(DB.id_domain),
                     oUsr.getString(DB.gu_workarea),
                     oMsg.getMessageGuid(), sMsgId,
                                    sFromAddr,sReplyAddr,sFromPersonal,
                                    sSubject, "text/"+(sTextHtml==null ? "plain" : "html")+";charset="+sEncoding,
                                   (sTextHtml==null ? sTextPlain : sTextHtml), null, null, null);

      if (aAttachments!=null) {
          Integer oPart = DBCommand.queryMaxInt(oCon, DB.id_part, DB.k_mime_parts, DB.gu_mimemsg+"='"+oMsg.getMessageGuid()+"'");
          if (oPart==null) oPart = new Integer(1);
          PreparedStatement oStm = oCon.prepareStatement("INSERT INTO " + DB.k_mime_parts + "("+DB.gu_mimemsg+","+DB.id_message+","+DB.id_part+","+DB.id_disposition+","+DB.id_content+","+DB.id_type+","+DB.len_part+","+DB.de_part+","+DB.file_name+") VALUES ('"+oMsg.getMessageGuid()+"',?,?,'reference',?,?,?,?,?)");
        for (int p=0; p<aAttachments.length; p++) {
              String sFilePath = Gadgets.chomp(sUserDir,File.separator)+aAttachments[p];
              File oAttach = new File(sFilePath);
              if (oAttach.exists()) {
                oStm.setString(1, sMsgId);
                  oStm.setInt(2, oPart.intValue()+p);
              oStm.setString(3, DBMimePart.getMimeType(oCon,aAttachments[p]));       
              oStm.setString(4, DBMimePart.getMimeType(oCon,aAttachments[p]));       
              oStm.setInt(5, (int) oAttach.length());
              oStm.setString(6, aAttachments[p]);
              oStm.setString(7, sFilePath)
              oStm.executeUpdate();
              } // fi
        } // next
        oStm.close()
      } // fi

      sJobId = (sId.length()==32 ? sId : Gadgets.generateUUID());
        oJob.put(DB.gu_job, sJobId);
        oJob.put(DB.gu_workarea, oUsr.getString(DB.gu_workarea));
        oJob.put(DB.gu_writer, oUsr.getString(DB.gu_user));
        oJob.put(DB.id_command, Job.COMMAND_SEND);
        oJob.put(DB.id_status, bAutoRunJob ? Job.STATUS_SUSPENDED : Job.STATUS_PENDING);
        oJob.put(DB.tl_job, sJobTl);
        oJob.put(DB.tx_parameters, (bTestMode ? "testmode:true," : "")+
                                 "message:"+oMsg.getMessageGuid()+","+
View Full Code Here

    else
    oDbb = oGlobalDbb;

    JDCConnection oCon = oDbb.getConnection("SendMail_RO1", false);
   
    ACLUser oUsr = new ACLUser(oCon, ACLUser.getIdFromEmail(oCon,sFromAddr));
    if (!oUsr.exists(oCon)) {
      oCon.close("SendMail_RO1");
      if (DebugFile.trace) DebugFile.decIdent();
    throw new SQLException(sFromAddr+" e-mail address not found at k_users table","01S06");
    }

    MailAccount oMacc = MailAccount.forUser(oCon, oUsr.getString(DB.gu_user), oDbb.getProperties());
    if (null==oMacc) {
      oCon.close("SendMail_RO1");
      if (DebugFile.trace) DebugFile.decIdent();
    throw new SQLException("No default e-mail account found for user "+oUsr.getString(DB.gu_user),"01S06");
    }

    oCon.close("SendMail_RO1");
   
    if (DebugFile.trace) DebugFile.writeln("Ready to send message "+sSubject);
View Full Code Here

      DebugFile.incIdent();
    }

    MailAccount oRetVal = MailAccount.forUser(oConn, sGuUser);
    if (null==oRetVal) {
      ACLUser oUser = new ACLUser();
      if (oUser.load(oConn, new Object[]{sGuUser})) {
        oRetVal = new MailAccount();
        oRetVal.setProperties(oProps);
        oRetVal.put(DB.gu_user, oUser.getString(DB.gu_user));
        oRetVal.put(DB.tl_account, "Default account for " + oUser.getString(DB.tx_nickname));
        oRetVal.put(DB.bo_default, (short)1);
        oRetVal.put(DB.bo_synchronize, (short)0);
        oRetVal.put(DB.tx_main_email, oUser.getString(DB.tx_main_email));
        oRetVal.put(DB.tx_reply_email, oUser.getString(DB.tx_main_email));
        oRetVal.put(DB.incoming_password, oUser.getString(DB.tx_pwd));
        oRetVal.put(DB.outgoing_password, oUser.getString(DB.tx_pwd));
      }
    }

    if (DebugFile.trace) {
      DebugFile.decIdent();
View Full Code Here

    } // next (category)
  } // deleteCategorySet

  public boolean delete(JDCConnection oConn)
    throws SQLException {
    ACLUser oUsr = new ACLUser(getString(DB.gu_user));
    Category oRootCat = new Category(oConn, oUsr.getMailRoot(oConn));
    DBSubset oMailFoldersCatgs = new DBSubset(DB.k_cat_tree, DB.gu_child_cat, DB.gu_parent_cat+"=?", 10);
    oMailFoldersCatgs.load(oConn, new Object[]{oRootCat.getString(DB.gu_category)});
    try {
      deleteCategorySet(oConn, oMailFoldersCatgs);
    } catch (IOException ioe) {
View Full Code Here

    oData.append("  <nm_project><![CDATA["+getStringNull(DB.nm_project,"")+"]]></nm_project>\n");
    oData.append("  <dt_created>"+oXMLDate.format(new Date())+"</dt_created>\n");
    if (sAuditUsr==null) {
      oData.append("  <tx_full_name/>\n");
    } else {
      ACLUser oWrt = new ACLUser(oConn, sAuditUsr);
      oData.append("  <tx_full_name><![CDATA["+oWrt.getStringNull(DB.nm_user,"")+" "+oWrt.getStringNull(DB.tx_surname1,"")+" "+oWrt.getStringNull(DB.tx_surname2,"")+"]]></tx_full_name>\n");     
    }
    oData.append(sSnapshot);
    oData.append("  <Resources>\n");
  Iterator<String> oIter = oResources.keySet().iterator();
  while (oIter.hasNext()) {
View Full Code Here

  }

  protected void setWriter(JDCConnection oConn, String sGuWriter)
    throws SQLException {
    if (null!=sGuWriter)
      oUser = new ACLUser(oConn, sGuWriter);
    else
      oUser = null;
  }
View Full Code Here

      if (!oMeetings.isNull(6,m)) oEvt.setCategories(oMeetings.getString(6,m));
      if (oMeetings.isNull(4,m) || sGuFellow.equals(oMeetings.get(4,m))) {
        sOrganizerName = (oFlw.getStringNull(DB.tx_name,"")+" "+oFlw.getStringNull(DB.tx_surname,"")).trim();
        sOrganizerMail = oFlw.getStringNull(DB.tx_email,"");
      } else {
        ACLUser oWrt = new ACLUser();
        if (oWrt.load(oConn, new Object[]{oMeetings.get(4,m)})) {
          sOrganizerName = (oFlw.getStringNull(DB.nm_user,"")+" "+oFlw.getStringNull(DB.tx_surname1,"")+" "+oFlw.getStringNull(DB.tx_surname2,"")).trim();
          sOrganizerMail = oFlw.getStringNull(DB.tx_main_email,"");
        } else {
          sOrganizerName = (oFlw.getStringNull(DB.tx_name,"")+" "+oFlw.getStringNull(DB.tx_surname,"")).trim();
          sOrganizerMail = oFlw.getStringNull(DB.tx_email,"");
View Full Code Here

  }

  protected void setWriter(JDCConnection oConn, String sGuWriter)
    throws SQLException {
    if (null!=sGuWriter)
      oUser = new ACLUser(oConn, sGuWriter);
    else
      oUser = null;
  }
View Full Code Here

   * @throws SQLException
   */
  public boolean load(JDCConnection oConn, Object[] PKVals) throws SQLException {
    boolean bRetVal = super.load(oConn, PKVals);
    if (bRetVal)
      oUser = new ACLUser(oConn, getString(DB.gu_sales_man));
    return bRetVal;
  }
View Full Code Here

TOP

Related Classes of com.knowgate.acl.ACLUser

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.