Package com.centraview.common

Examples of com.centraview.common.CVDal


  } //end of deleteLicense method
 
  public LicenseVO getPrimaryLicense()
  {
    LicenseVO licenseDetails = null;
    CVDal dataConnection = new CVDal (dataSource);
    try
    {
      dataConnection.setSqlQuery("SELECT LicenseID, LicenseKey, LastVerified , LicenseVerification "
        + "FROM license ORDER BY LicenseID ASC" );
     
      Collection resultsCollection = dataConnection.executeQuery();
      if (null != resultsCollection)
      {
        //No need to iterate through the collection
        //because are taking the first result.
        HashMap result = (HashMap) resultsCollection.iterator().next();
        licenseDetails = new LicenseVO ();
        licenseDetails.setLicenseID (((Long) result.get("LicenseID")).intValue());
        licenseDetails.setLicenseKey ((String) result.get("LicenseKey"));
        licenseDetails.setLicenseVerification ((String) result.get("LicenseVerification"));
        licenseDetails.setLastVerified ((java.util.Date) result.get("LastVerified"));
        resultsCollection = null;
        result = null;
      } //end of if statement
    } //end of try block
    catch (NoSuchElementException noSuchElementException)
    {
      System.out.println ("There is no license installed for this server.");
      licenseDetails = null;
    }
    catch (Exception ex)
    {
      System.out.println ("Exception in LicenseEJB.getPrimaryLicense:");
      ex.printStackTrace ();
    } finally {
      dataConnection.destroy();
      dataConnection = null;
    }
    return licenseDetails;
  } //end of getPrimaryLicense method
View Full Code Here


   * @param statusCollection A Collection of DDNameValues.
   * @see com.centraview.common.DDNameValue
   */
  private void updateStatus(Collection statusCollection)
  {
    CVDal cvdl = new CVDal(dataSource);
    try {
      if (statusCollection != null) {
        StringBuffer stringBuffer = new StringBuffer();
        Iterator it = statusCollection.iterator();
        while (it.hasNext()) {
          DDNameValue sourceObject = (DDNameValue) it.next();
          // System.out.println("[DEBUG] [AppSettingsEJB]: sourceObject: " +
          // sourceObject.toString());
          if (sourceObject.getName() != null && sourceObject.getId() == -1) {
            // create a new Source Record
            cvdl.setSqlQueryToNull();
            cvdl.setSqlQuery("INSERT INTO projectstatus (Title) VALUES (?)");
            cvdl.setString(1, sourceObject.getName());
            cvdl.executeUpdate();
            int newId = cvdl.getAutoGeneratedKey();
            stringBuffer.append(newId);
          } // end of if statement (sourceObject.getName() != null ...
          else if (sourceObject.getName() != null) {
            // update the existing Source Record
            cvdl.setSqlQueryToNull();
            cvdl.setSqlQuery("UPDATE projectstatus SET Title = ? WHERE StatusID = ?");
            cvdl.setString(1, sourceObject.getName());
            cvdl.setInt(2, sourceObject.getId());
            cvdl.executeUpdate();
            stringBuffer.append(sourceObject.getId());
          } // end of else if statement (sourceObject.getName() != null)
          if (stringBuffer.length() > 0 && it.hasNext()) {
            stringBuffer.append(", ");
          }
        } // end of while loop (it.hasNext())
        if (stringBuffer.length() > 0) {
          cvdl.setSqlQueryToNull();
          cvdl.setSqlQuery("DELETE FROM projectstatus WHERE StatusID NOT IN (" + stringBuffer + ")");
          cvdl.executeUpdate();
        } // end of if statement (stringBuffer.length() > 0)
      } // end of if statement (sourceValues != null)
    }catch (Exception e) {
      logger.error("[updateStatus]: Exception", e);
    }finally {
      cvdl.destroy();
    } // end of finally block
  } // end of updateStatus method
View Full Code Here

   * @param termCollection A Collection of DDNameValues.
   * @see com.centraview.common.DDNameValue
   */
  private void updateAccountingTerm(Collection termCollection)
  {
    CVDal cvdl = new CVDal(dataSource);
    try {
      if (termCollection != null) {
        StringBuffer stringBuffer = new StringBuffer();
        Iterator it = termCollection.iterator();
        while (it.hasNext()) {
          DDNameValue sourceObject = (DDNameValue) it.next();
          if (sourceObject.getName() != null && sourceObject.getId() == -1) {
            // create a new Source Record
            cvdl.setSqlQueryToNull();
            cvdl.setSqlQuery("INSERT INTO accountingterms (title) VALUES (?)");
            cvdl.setString(1, sourceObject.getName());
            cvdl.executeUpdate();
            int newId = cvdl.getAutoGeneratedKey();
            stringBuffer.append(newId);
          } // end of if statement (sourceObject.getName() != null ...
          else if (sourceObject.getName() != null) {
            // update the existing Source Record
            cvdl.setSqlQueryToNull();
            cvdl.setSqlQuery("UPDATE accountingterms SET title = ? WHERE termsid = ?");
            cvdl.setString(1, sourceObject.getName());
            cvdl.setInt(2, sourceObject.getId());
            cvdl.executeUpdate();
            stringBuffer.append(sourceObject.getId());
          } // end of else if statement (sourceObject.getName() != null)
          if (stringBuffer.length() > 0 && it.hasNext()) {
            stringBuffer.append(", ");
          }
        } // end of while loop (it.hasNext())
        if (stringBuffer.length() > 0) {
          cvdl.setSqlQueryToNull();
          cvdl.setSqlQuery("DELETE FROM accountingterms WHERE termsid NOT IN (" + stringBuffer + ")");
          cvdl.executeUpdate();
        } // end of if statement (stringBuffer.length() > 0)
      } // end of if statement (sourceValues != null)
    }catch (Exception e) {
      logger.error("[updateAccountingTerm]: Exception", e);
    }finally {
      cvdl.destroy();
    } // end of finally block
  } // end of updateAccountingTerm method
View Full Code Here

   * @param statusCollection A Collection of DDNameValues.
   * @see com.centraview.common.DDNameValue
   */
  private void updateOrderStatus(Collection statusCollection)
  {
    CVDal cvdl = new CVDal(dataSource);
    try {
      if (statusCollection != null) {
        StringBuffer stringBuffer = new StringBuffer();
        Iterator it = statusCollection.iterator();
        while (it.hasNext()) {
          DDNameValue sourceObject = (DDNameValue) it.next();
          // System.out.println("[DEBUG] [AppSettingsEJB]: sourceObject: " +
          // sourceObject.toString());
          if (sourceObject.getName() != null && sourceObject.getId() == -1) {
            // create a new Source Record
            cvdl.setSqlQueryToNull();
            cvdl.setSqlQuery("INSERT INTO accountingstatus (title) VALUES (?)");
            cvdl.setString(1, sourceObject.getName());
            cvdl.executeUpdate();
            int newId = cvdl.getAutoGeneratedKey();
            stringBuffer.append(newId);
          } // end of if statement (sourceObject.getName() != null ...
          else if (sourceObject.getName() != null) {
            // update the existing Source Record
            cvdl.setSqlQueryToNull();
            cvdl.setSqlQuery("UPDATE accountingstatus SET title = ? WHERE statusid = ?");
            cvdl.setString(1, sourceObject.getName());
            cvdl.setInt(2, sourceObject.getId());
            cvdl.executeUpdate();
            stringBuffer.append(sourceObject.getId());
          } // end of else if statement (sourceObject.getName() != null)
          if (stringBuffer.length() > 0 && it.hasNext()) {
            stringBuffer.append(", ");
          }
        } // end of while loop (it.hasNext())
        if (stringBuffer.length() > 0) {
          cvdl.setSqlQueryToNull();
          cvdl.setSqlQuery("DELETE FROM accountingstatus WHERE statusid NOT IN (" + stringBuffer + ")");
          cvdl.executeUpdate();
        } // end of if statement (stringBuffer.length() > 0)
      } // end of if statement (sourceValues != null)
    }catch (Exception e) {
      logger.error("[updateOrderStatus]: Exception", e);
    }finally {
      cvdl.destroy();
    } // end of finally block
  } // end of updateOrderStatus method
View Full Code Here

   * @param locationCollection A Collection of DDNameValues.
   * @see com.centraview.common.DDNameValue
   */
  private void updateLocations(Collection locationCollection)
  {
    CVDal cvdl = new CVDal(dataSource);
    try {
      if (locationCollection != null) {
        StringBuffer stringBuffer = new StringBuffer();
        Iterator it = locationCollection.iterator();
        while (it.hasNext()) {
          DDNameValue sourceObject = (DDNameValue) it.next();
          // System.out.println("[DEBUG] [AppSettingsEJB]: sourceObject: " +
          // sourceObject.toString());
          if (sourceObject.getName() != null && sourceObject.getId() == -1) {
            // create a new Source Record
            cvdl.setSqlQueryToNull();
            cvdl.setSqlQuery("INSERT INTO location (title) VALUES (?)");
            cvdl.setString(1, sourceObject.getName());
            cvdl.executeUpdate();
            int newId = cvdl.getAutoGeneratedKey();
            stringBuffer.append(newId);
          } // end of if statement (sourceObject.getName() != null ...
          else if (sourceObject.getName() != null) {
            // update the existing Source Record
            cvdl.setSqlQueryToNull();
            cvdl.setSqlQuery("UPDATE location SET title = ? WHERE locationid = ?");
            cvdl.setString(1, sourceObject.getName());
            cvdl.setInt(2, sourceObject.getId());
            cvdl.executeUpdate();
            stringBuffer.append(sourceObject.getId());
          } // end of else if statement (sourceObject.getName() != null)
          if (stringBuffer.length() > 0 && it.hasNext()) {
            stringBuffer.append(", ");
          }
        } // end of while loop (it.hasNext())
        if (stringBuffer.length() > 0) {
          cvdl.setSqlQueryToNull();
          cvdl.setSqlQuery("DELETE FROM location WHERE locationid NOT IN (" + stringBuffer + ")");
          cvdl.executeUpdate();
        } // end of if statement (stringBuffer.length() > 0)
      } // end of if statement (sourceValues != null)
    }catch (Exception e) {
      logger.error("[updateLocations]: Exception", e);
    }finally {
      cvdl.destroy();
    } // end of finally block
  } // end of updateLocations method
View Full Code Here

   * @param emailSettingsVO The Email Setting information such as
   * username, password, smtpserver, etc...
   */
  public void updateEmailSettings(EmailSettingsVO emailSettingsVO)
  {
    CVDal dl = new CVDal(dataSource);
    try
    {
      dl.setSqlQuery("update `emailsettings` set smtpserver = ? , username = ? , password = ?, authentication = ? , smtpport = ?");
      dl.setString(1, emailSettingsVO.getSmtpServer());
      dl.setString(2, emailSettingsVO.getUsername());
      dl.setString(3, emailSettingsVO.getPassword());
      if (emailSettingsVO.getAuthentication())
      {
        dl.setString(4, "YES");
      } // end of if (emailSettingsVO.getAuthentication())
      else {
        dl.setString(4, "NO");
      }// end of else block
      dl.setString(5, String.valueOf(emailSettingsVO.getSmtpPort()));
      dl.executeUpdate();
    }// end of try block
    catch (Exception e)
    {
      System.out.println("[Exception][EmailSettingsEJB.updateEmailSettings] Exception Thrown: " + e);
      e.printStackTrace();
    }// end of catch Block
    finally
    {
      dl.destroy();
      dl = null;
    }// end of finally block
  } // end public void updateEmailSettings(EmailSettingsVO emailSettingsVO)
View Full Code Here

   * @param resourceCollection A Collection of DDNameValues.
   * @see com.centraview.common.DDNameValue
   */
  private void updateResources(Collection resourceCollection)
  {
    CVDal cvdl = new CVDal(dataSource);
    try {
      if (resourceCollection != null) {
        StringBuffer stringBuffer = new StringBuffer();
        Iterator it = resourceCollection.iterator();
        while (it.hasNext()) {
          DDNameValue resourceObject = (DDNameValue) it.next();
          // System.out.println("[DEBUG] [AppSettingsEJB]: resourceObject: " +
          // resourceObject.toString());
          if (resourceObject.getName() != null && resourceObject.getId() == -1) {
            // create a new Source Record
            cvdl.setSqlQueryToNull();
            cvdl.setSqlQuery("INSERT INTO activityresources (Name) VALUES (?)");
            cvdl.setString(1, resourceObject.getName());
            cvdl.executeUpdate();
            int newId = cvdl.getAutoGeneratedKey();
            stringBuffer.append(newId);
          } // end of if statement (resourceObject.getName() != null ...
          else if (resourceObject.getName() != null) {
            // update the existing Resource Record
            cvdl.setSqlQueryToNull();
            cvdl.setSqlQuery("UPDATE activityresources SET Name = ? WHERE ActivityResourceID = ?");
            cvdl.setString(1, resourceObject.getName());
            cvdl.setInt(2, resourceObject.getId());
            cvdl.executeUpdate();
            stringBuffer.append(resourceObject.getId());
          } // end of else if statement (resourceObject.getName() != null)
          if (stringBuffer.length() > 0 && it.hasNext()) {
            stringBuffer.append(", ");
          }
        } // end of while loop (it.hasNext())
        if (stringBuffer.length() > 0) {
          cvdl.setSqlQueryToNull();
          cvdl.setSqlQuery("DELETE FROM activityresources WHERE ActivityResourceID NOT IN (" + stringBuffer + ")");
          cvdl.executeUpdate();
        } // end of if statement (stringBuffer.length() > 0)
      } // end of if statement (sourceValues != null)
    }catch (Exception e) {
      logger.error("[updateResources]: Exception", e);
    }finally {
      cvdl.destroy();
    } // end of finally block
  } // end of updateResources method
View Full Code Here

   * username, password, smtpserver, etc...
   */
  public EmailSettingsVO getEmailSettings()
  {
    EmailSettingsVO emailSettingsVO = new EmailSettingsVO();
    CVDal dl = null;
    try
    {
      dl = new CVDal(dataSource);
      dl.setSqlQuery("select * from `emailsettings`");
      Collection col = dl.executeQuery();
      if (col != null){
        Iterator it = col.iterator();
        HashMap hm = null;
        if (it.hasNext()){
          hm = (HashMap)it.next();
        }// end of if (it.hasNext())
        if (hm != null){
          emailSettingsVO.setSmtpPort(((Number)hm.get("smtpport")).intValue());
          emailSettingsVO.setSmtpServer((String)hm.get("smtpserver"));
          emailSettingsVO.setUsername((String)hm.get("username"));
          emailSettingsVO.setPassword((String)hm.get("password"));
          String authenticationString = (String)hm.get("authentication");
          boolean authentication = (authenticationString == null) ? false : authenticationString.equalsIgnoreCase("YES");
          emailSettingsVO.setAuthentication(authentication);
        }// end of if (hm != null)
        ArrayList emailTemplateList = this.getEmailTemplateList();
        emailSettingsVO.setEmailTemplateList(emailTemplateList);
      }// end of if (col != null)
    }// end of try block
    catch (Exception e)
    {
      System.out.println("[Exception][EmailSettingsEJB.getEmailSettings] Exception Thrown: " + e);
      e.printStackTrace();
    }// end of catch block
    finally
    {
      dl.destroy();
      dl = null;
    }// end of finally block
    return emailSettingsVO;
  }// end of public EmailSettingsVOX getEmailSettings()
View Full Code Here

    } // end of finally block
  } // end of updateResources method

  public Vector viewMasterDataSettings(String setting)
  {
    CVDal dl = new CVDal(dataSource);
    Vector valuelist = new Vector();
    try {
      dl.setSqlQuery("select name from ?");
      dl.setString(1, setting);
      java.util.Collection col = dl.executeQuery();
      if (col != null) {
        java.util.Iterator it = col.iterator();
        int count = 1;
        while (it.hasNext()) {
          HashMap hm = (java.util.HashMap) it.next();
          valuelist.addElement(hm.get("Name").toString());
          count++;
        }
      }
    } catch (Exception e) {
      logger.error("[viewMasterDataSettings]: Exception", e);
    } finally {
      dl.destroy();
    }
    return valuelist;
  }
View Full Code Here

   * Intern HashMap Contains the information of the templateID, Name, Description.
   */
  private ArrayList getEmailTemplateList()
  {
    ArrayList emailTemplateList = new ArrayList();
    CVDal dl = null;
    try
    {
      dl = new CVDal(dataSource);
      dl.setSqlQuery("select templateID,name,description from emailtemplate");
      Collection col = dl.executeQuery();
      if (col != null){
        Iterator it = col.iterator();
        HashMap hm = null;
        while (it.hasNext()){
          hm = (HashMap)it.next();
          emailTemplateList.add(hm);
        }// end of if (it.hasNext())
      }// end of if (col != null)
    }// end of try block
    catch (Exception e)
    {
      System.out.println("[Exception][EmailSettingsEJB.getEmailTemplateList] Exception Thrown: " + e);
      e.printStackTrace();
    }// end of catch block
    finally
    {
      dl.destroy();
      dl = null;
    }// end of finally block
    return emailTemplateList;
  }// end of method getEmailTemplateList()
View Full Code Here

TOP

Related Classes of com.centraview.common.CVDal

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.