Package javax.ejb

Examples of javax.ejb.EJBException


          cf.setValue(value);
        }
      } // end of while loop on values query
    } catch (Exception e) {
      logger.error("[getCustomFieldData] Exception thrown.", e);
      throw new EJBException(e);
    } finally {
      dl.destroy();
      dl = null;
    }
    return cusData;
View Full Code Here


      cvdal.executeUpdate();

      // update the syncnote table
      this.updateSyncNotes(noteVO, cvdal);
    } catch (NoteException ne) {
      throw new EJBException(ne);
    } finally {
      cvdal.destroy();
      cvdal = null;
    }
  } // end deleteNote(int,int) method
View Full Code Here

   */
  public void addUser(int individualId, UserVO uvo) throws UserException
  {
    // First find out if individualId is an Administrator, if not, blow up.
    if (!this.isAdministrator(individualId)) {
      throw new EJBException("Not Authorized");
    }
    CVDal cvdl = new CVDal(dataSource);
    try {
      if (uvo == null) {
        throw new UserException(UserException.INVALID_DATA, "Cannot add User. User is empty.");
View Full Code Here

   * @throws UserException
   */
  public void updateUser(int individualId, UserVO uvo) throws UserException
  {
    if (!this.isAdministrator(individualId)) {
      throw new EJBException("Not Authorized");
    }
    CVDal cvdl = new CVDal(dataSource);
    try {
      if (uvo == null) {
        throw new UserException(UserException.INVALID_DATA, "Cannot update User. UserVO is empty.");
View Full Code Here

   * @return
   */
  public ValueListVO getUserValueList(int individualId, ValueListParameters parameters)
  {
    if (!(this.isAdministrator(individualId) || this.isCustomer(individualId))) {
      throw new EJBException("Not Authorized");
    }
    ArrayList list = new ArrayList();
    boolean applyFilter = false;
    CVDal cvdl = new CVDal(this.dataSource);
    try {
View Full Code Here

  }

  public UserList getUserList(int individualId, HashMap hashmap)
  {
    if (!this.isAdministrator(individualId)) {
      throw new EJBException("Not Authorized");
    }
    Integer intStart = (Integer) hashmap.get("startATparam");
    Integer intEnd = (Integer) hashmap.get("EndAtparam");
    String strSearch = (String) hashmap.get("searchString");
    String strSortMem = (String) hashmap.get("sortmem");
View Full Code Here

      }
      if (user.getUserType().equals(UserVO.UT_ADMINISTRATOR)) {
        test = true;
      }
    } catch (UserException ue) {
      throw new EJBException(ue);
    }
    return test;
  }
View Full Code Here

      }
      if (user.getUserType().equals(UserVO.UT_CUSTOMER)) {
        test = true;
      }
    } catch (UserException ue) {
      throw new EJBException(ue);
    }
    return test;
  }
View Full Code Here

        query.append("FROM individual AS a, entity AS e ");
        query.append("WHERE e.entityid = a.entity");
        fieldList = criteria.getIndividualFieldList();
        break;
      default : // we aren't 1 or 2 we cannot continue.
        throw new EJBException("Merge Type must be 1 or 2");
    }
    // If the list is not zero then we need to reduce the selection further.
    if (list != 0)
    {
      query.append(" AND a.list = ");
      query.append(list);
    }
    // The order of the returned results probably doesn't matter.
    // Now the query is ready, lets fire up the data access layer.
    StringBuffer domainQueryIds = new StringBuffer("(");
    CVDal cvdal = new CVDal(this.dataSource);
    ArrayList domain = new ArrayList();
    cvdal.setSqlQuery(query.toString());
    ResultSet domainResultSet = cvdal.executeQueryNonParsed();
    // Do this non-parsed so on one pass through the resultset
    // we can build the hashmap for display, and get the ids
    // gathered up for the query.
    try
    {
      boolean firstPass = true;
      while (domainResultSet.next())
      {
        HashMap record = new HashMap();
        Object id = domainResultSet.getObject(1);
        record.put("id",id); // The Object can be cast to a Number
        record.put("title", domainResultSet.getString(2));
        if(mergeType == 1){
          record.put("owner", domainResultSet.getString(3));
        }
        if(mergeType == 2){
          record.put("entityID", domainResultSet.getString(3));
          record.put("entityName", domainResultSet.getString(4));
        }
        // This TreeMap will allow us to easily obtain the underlying
        // HashMap when we find matches.
        domain.add(record);
        if (!firstPass)
        {
          domainQueryIds.append(", ");
        } else {
          firstPass = false;
        }
        domainQueryIds.append(id);
      } // end while (domainResultSet.next())
      domainQueryIds.append(")");
    } catch (SQLException e) {
      System.out.println("[Exception][MergeEJB.performSearch] SQLException Thrown: " + e);
      cvdal.destroy();
      throw new EJBException(e);
    } finally {
      if (domainResultSet != null)
      {
        try { domainResultSet.close(); domainResultSet = null; } catch (SQLException e) {}
      }
      cvdal.setSqlQueryToNull();
    }
    // domain is now an TreeMap of hashmaps.  HashMaps are used to minimize changes
    // with the rest of the code during a rewrite of this algorithm on May 21, 2004.
    // Previously we just used CVDal.executeQuery(); which outputted collections of hashmaps.

    // Not enough results from the query to actually do anything
    // So return an empty ResultVO.
    if (domain.size() < 2)
    {
      return searchResults;  // is currently empty
    }

    int threshhold = criteria.getThreshhold();
    // Could potentially save a lot of time here by checking if the sum of the
    // criteria scores is < threshhold and just returrning no results
    // as there can never be a valid set of matches.

    // criteriaFields is an arraylist of HashMaps.  The internal HashMap contains the
    // actual fields pulled from the database.  Keyed to the ID
    // So comparison can be done fast and in memory.
    ArrayList criteriaFields = new ArrayList();
    int criteriaSize = matchCriteria.size();
    for (int i =  0; i < criteriaSize; i++)
    {
      HashMap criterion = (HashMap)matchCriteria.get(i);
      int fieldIndex = ((Integer)criterion.get(SearchCriteriaVO.FIELD_KEY)).intValue();
      MergeField field = (MergeField)fieldList.get(fieldIndex);
      StringBuffer fieldQuery = new StringBuffer(field.getQuery());
      fieldQuery.append(domainQueryIds);
      cvdal.setSqlQuery(fieldQuery.toString());
      ResultSet fieldResultSet = cvdal.executeQueryNonParsed();
      HashMap fieldMap = new HashMap();
      try
      {
        while(fieldResultSet.next())
        {
          // Put the String in the
          if(fieldResultSet.getObject(2) != null && fieldResultSet.getString(1) != null){
            fieldMap.put(fieldResultSet.getObject(2), fieldResultSet.getString(1).trim());
         }
        }
        criteriaFields.add(fieldMap);
      } catch (SQLException se) {
        System.out.println("[Exception][MergeEJB.performSearch] SQLException Thrown: " + se);
        throw new EJBException(se);
      } finally {
        if (domainResultSet != null)
        {
          try { fieldResultSet.close(); domainResultSet = null; } catch (SQLException e) {}
        }
View Full Code Here

      ptvo.setUserid(individualId);
      ptvo.setPtsubject((String)hm.get("ptsubject"));
      ptvo.setPtcategoryId(((Number)hm.get("ptcategoryid")).intValue());
    }catch(Exception e){
      logger.error("[getDefaultPrintTemplate] Exception thrown.", e);
      throw new EJBException(e);
    }finally{
      cvdl.destroy();
      cvdl = null;
    }
    return ptvo;
View Full Code Here

TOP

Related Classes of javax.ejb.EJBException

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.