Package javax.servlet

Examples of javax.servlet.ServletException


    ValueList valueList = null;
    try {
      valueList = valueListHome.create();
    } catch (CreateException e) {
      logger.error("[execute] Exception thrown.", e);
      throw new ServletException(e);
    }
    valueList.setDataSource(dataSource);
    ValueListVO listObject = valueList.getValueList(individualId, listParameters);
   
    ArrayList buttonList = new ArrayList();
View Full Code Here


    try {
      customField = (CustomField)CVUtility.setupEJB("CustomField",
          "com.centraview.customfield.CustomFieldHome", dataSource);
    } catch (Exception e) {
      logger.error("[execute] Exception thrown.", e);
      throw new ServletException(e);
    }
    // Only 8 custom fields fit on the detail screen so we have to pull only the
    // first 8 out.
    TreeMap customFieldMap = customField.getCustomFieldData("Entity");
    Collection customFieldValues = customFieldMap.values();
View Full Code Here

                catch( IOException ioException )
                {
                    // If we got here, the file exists and is a file, but there
                    // was some error loading it.  Not much we can do, so just
                    // error out.  This should never happen.
                    throw new ServletException( "Unable to load the properties file from the specified location: " + propertiesFile.getAbsolutePath() + " due to an IOException: " + ioException );
                }
            }
            else
            {
                throw new ServletException( "The specified properties file: " + propertiesFile.getAbsolutePath() + " does not exist." );
            }
        }
        else
        {
            // If the soht.properties location was not specified as a
            // system property, attempt to load it from the default
            // location.

            System.out.println( "The system property \"soht.properties\" was not specified.  Using the default location." );

            propertiesFile = new File( "soht.properties" );
            if( propertiesFile.exists() && propertiesFile.isFile() )
            {
                // Load the properties file from the default location.
                try
                {
                    loadProperties();
                }
                catch( IOException ioException )
                {
                    // If we got here, the file exists and is a file, but there
                    // was some error loading it.  Not much we can do, so just
                    // error out.  This should never happen.
                    throw new ServletException( "Unable to load the properties file from the default location: " + propertiesFile.getAbsolutePath() + " due to an IOException: " + ioException );
                }
            }
            else
            {
                // The default properties file does not exist, so attempt
                // to copy the properties file from the war to the default
                // file location.

                InputStream propertiesStream = getServletContext().getResourceAsStream("/WEB-INF/soht.properties");
                if( propertiesStream != null )
                {
                    try
                    {
                        // Load from the WAR
                        properties.load( propertiesStream );
                        // Save to the default location.
                        saveProperties();
                    }
                    catch( IOException ioException )
                    {
                        throw new ServletException( "Error copying the properties file from the WAR to the default location: " + propertiesFile.getAbsolutePath() + " due to an IOException: " + ioException );
                    }
                }
                else
                {
                    throw new ServletException( "Unable to load soht.properties from WAR.  SOHT will not function correctly!" );
                }
            }
        }
    }
View Full Code Here

    try {
      contactFacade = (ContactFacade)CVUtility.setupEJB("ContactFacade",
          "com.centraview.contact.contactfacade.ContactFacadeHome", dataSource);
    } catch (Exception e) {
      logger.error("[execute] Exception thrown.", e);
      throw new ServletException(e);
    }
    IndividualVO individualVO = contactFacade.getIndividual(Integer.parseInt(viewIndividualId));
    individualVO.populateFormBean(individualForm);
    // Now we need to get the custom field stuff because it doesn't live on the
    // individualVO even though there is a nice space for it there
    CustomField customField = null;
    try {
      customField = (CustomField)CVUtility.setupEJB("CustomField",
          "com.centraview.customfield.CustomFieldHome", dataSource);
    } catch (Exception e) {
      logger.error("[execute] Exception thrown.", e);
      throw new ServletException(e);
    }
    // Only 8 custom fields fit on the detail screen so we have to pull only the
    // first 8 out.
    TreeMap customFieldMap = customField.getCustomFieldData("Individual", individualVO
        .getContactID());
    Collection customFieldValues = customFieldMap.values();
    int arraySize = customFieldValues.size() > 8 ? 8 : customFieldValues.size();
    CustomFieldVO[] fieldArray = new CustomFieldVO[arraySize];
    Iterator i = customFieldValues.iterator();
    int count = 0;
    while (i.hasNext() && count < 8) {
      fieldArray[count++] = (CustomFieldVO)i.next();
    }
    individualForm.set("customFields", fieldArray);
    // Useful Stuff for the request (common things for every type of screen so
    // we don't have to program for each different form bean)
    request.setAttribute("recordType", "Individual");
    request.setAttribute("recordName", individualVO.getFullName());
    request.setAttribute("recordId", viewIndividualId);
    request.setAttribute("dynamicTitle", individualVO.getFullName());
    request.setAttribute("parentId", new Integer(individualVO.getEntityID()));
    request.setAttribute("parentName", individualVO.getEntityName());
    request.setAttribute("marketingList", new Integer(individualVO.getList()));
    individualForm.set("mocTypeList", Globals.MOC_TYPE);
    // end getting the data together for the main window.
    // if we clicked copy to, then show this data on the simple copyto jsp.
    if (request.getParameter("copyTo") != null) {
      return mapping.findForward(".view.contact.copyto");
    }
    // get the list together for the right nav
    int rpp = 15;
    String currentParam = request.getParameter("current");
    int current = 1;
    try {
      current = Integer.valueOf(currentParam).intValue();
    } catch (Exception e) {}
    String selectedIds = request.getParameter("rowId");
    ValueListParameters listParameters = new ValueListParameters(
        ValueListConstants.INDIVIDUAL_LIST_TYPE, rpp, current);
    String filter = "SELECT individual.individualId FROM individual WHERE individualId IN ("
        + selectedIds + ")";
    listParameters.setFilter(filter);
    ArrayList columns = new ArrayList();
    FieldDescriptor nameField = (FieldDescriptor)ValueListConstants.individualViewMap.get("Name");
    listParameters.setSortColumn(nameField.getQueryIndex());
    listParameters.setSortDirection("ASC");
    columns.add(nameField);
    listParameters.setColumns(columns);
    ValueList valueList = null;
    try {
      valueList = (ValueList)CVUtility.setupEJB("ValueList",
          "com.centraview.valuelist.ValueListHome", dataSource);
    } catch (Exception e) {
      logger.error("[execute] Exception thrown.", e);
      throw new ServletException(e);
    }
    ValueListVO listObject = valueList.getValueList(individualId, listParameters);
    // Paging stuff.
    int total = listObject.getParameters().getTotalRecords();
    long totalPages = (long)Math.ceil((double)total / rpp);
View Full Code Here

      EmailFacade emailFacade = facadeHome.create();
      emailFacade.setDataSource(dataSource);
      filter = emailFacade.getRelatedEmailList(individualId, recordID.intValue(), contactType);
    } catch (Exception e) {
      logger.error("[Exception] RelatedEmailHistory.Execute Handler ", e);
      throw new ServletException(e);
    }
    // Buttons
    ArrayList buttonList = (ArrayList)request.getAttribute("buttonList");
    // now, get the data from the EJB layer and put it on the request
    RelatedInfoUtil.relatedInfoSetup(request, dataSource, viewType, ValueListConstants.EMAIL_LIST_TYPE, ValueListConstants.emailViewMap, filter.toString(), buttonList, recordID.intValue());
View Full Code Here

    ValueList valueList = null;
    try {
      valueList = valueListHome.create();
    } catch (CreateException e) {
      logger.error("[execute] Exception thrown.", e);
      throw new ServletException(e);
    }
    valueList.setDataSource(dataSource);
    ValueListVO listObject = valueList.getValueList(individualId, listParameters);
   
    ArrayList buttonList = new ArrayList();
View Full Code Here

      ContactFacade remote = aa.create();
      remote.setDataSource(dataSource);
      remote.addContactToGroup(userobject.getIndividualID(), groupId, memberIds);
    } catch (Exception e) {
      logger.error("[execute] Exception thrown.", e);
      throw new ServletException(e);
    }
    StringBuffer path = new StringBuffer(mapping.findForward("viewGroup").getPath());
    path.append(groupId);
    return new ActionForward(path.toString(), true);
  }
View Full Code Here

    try {
      customField = (CustomField)CVUtility.setupEJB("CustomField",
          "com.centraview.customfield.CustomFieldHome", dataSource);
    } catch (Exception e) {
      logger.error("[execute] Exception thrown.", e);
      throw new ServletException(e);
    }
    // Only 8 custom fields fit on the detail screen so we have to pull only the
    // first 8 out.
    TreeMap customFieldMap = customField.getCustomFieldData("Individual");
    Collection customFieldValues = customFieldMap.values();
View Full Code Here

    ValueList valueList = null;
    try {
      valueList = valueListHome.create();
    } catch (CreateException e) {
      logger.error("[execute] Exception thrown.", e);
      throw new ServletException(e);
    }
    valueList.setDataSource(dataSource);
    ValueListVO listObject = valueList.getValueList(individualId, listParameters);

    ArrayList buttonList = new ArrayList();
View Full Code Here

        sform.setPassword(user.getPassword());
        request.setAttribute("groups", groups);
       
      } catch (Exception e) {
        Mapping.rollback();
        throw new ServletException(e);
      }

      // Forward to the view page
      return (mapping.findForward("view"));
    }   

    // fill data | errors
    if (errors.size() > 0) {
      try {
        Mapping.begin();       
        Vector groups = Group.listAll();
        Mapping.rollback();
       
        request.setAttribute("groups", groups);
        request.setAttribute(ERROR_KEY, errors);
               
      } catch (Exception e) {
        Mapping.rollback();
        throw new ServletException(e);
      }

      // Forward to the view page
      return (mapping.findForward("view"));
    }

    // all it's ok : update user
    try {
      Mapping.begin();
      User user = User.getInstance(id);
      user.setMetaData("name", sform.getName());
      user.setMetaData("email", sform.getEmail());
      user.setPassword(sform.getPassword());
      user.resetGroups();
      for( int i=0; i<sform.getGroups().length; i++ ) {
        Group group = Group.getInstance(sform.getGroups()[i]);
        user.addGroup(group);
      }
      Mapping.commit();
     
    } catch (Exception e) {
      Mapping.rollback();
      throw new ServletException(e);
    }

    // Forward to the next page
    return (mapping.findForward("ok"));
  }
View Full Code Here

TOP

Related Classes of javax.servlet.ServletException

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.