Package com.centraview.view

Examples of com.centraview.view.ViewVO


      }
      viewForm.setListType(listType);
      // get userid from session
      HttpSession session = request.getSession();
      int userId = ((UserObject)session.getAttribute("userobject")).getIndividualID();
      ViewVO viewVO = new ViewVO();
      viewId = 0;

      if (viewForm.getViewId() != null && viewForm.getViewId().length() > 0)
      {
        viewVO.setViewId(Integer.parseInt(viewForm.getViewId()));
        viewId = Integer.parseInt(viewForm.getViewId());
      }
      viewVO.setListType(viewForm.getListType());
      if (viewForm.getNoOfRecord() != null)
      {
        viewVO.setNoOfRecord(Integer.parseInt(viewForm.getNoOfRecord()));
      }
      if (viewForm.getSearchId() != null)
      {
        viewVO.setSearchId(Integer.parseInt(viewForm.getSearchId()));
      }
      viewVO.setSortMember(viewForm.getSortMember());
      viewVO.setSortType(viewForm.getSortType());
      viewVO.setSearchType(viewForm.getSearchType());
      viewVO.setViewName(viewForm.getViewName());
      viewVO.setCreatedBy(userId);
      viewVO.setOwner(userId);

      // get listpreference
      UserObject userObject = (UserObject)session.getAttribute("userobject");
      // get listpreference associated with the user for required listtype
      ListPreference listPreference = userObject.getListPreference(listType);
      String userDefaultId = "" + listPreference.getDefaultView();
      Vector columnInfo = new Vector();
      Vector selectedColumn = new Vector();
      if (viewForm.getSelectedColumn() != null)
      {
        int sizeOfSelectedColumn = viewForm.getSelectedColumn().length;
        String[] selectedColumnArray = viewForm.getSelectedColumn();
        for (int i = 0; i < sizeOfSelectedColumn; i++)
        {
          ViewColumnVO columnVO = new ViewColumnVO();
          DDNameValue ddSelectedColumn = new DDNameValue(selectedColumnArray[i], selectedColumnArray[i]);
          columnVO.setColumnOrder(i + 1);
          columnVO.setColumnName(selectedColumnArray[i]);
          columnInfo.add(columnVO);
          selectedColumn.add(ddSelectedColumn);
        }
      }
      viewVO.setViewColumnVO(columnInfo);
      ViewHome viewHome = (ViewHome)CVUtility.getHomeObject("com.centraview.view.ViewHome", "View");
      View remote = viewHome.create();
      remote.setDataSource(dataSource);
      if (request.getParameter("TYPEOFOPERATION").equals("ADD"))
      {
        viewId = remote.addView(userId, viewVO);
        viewForm.setViewId(viewId + "");
        request.setAttribute("TYPEOFOPERATION", "EDIT");
      } else if (request.getParameter("TYPEOFOPERATION").equals("EDIT")) {
        remote.updateView(userId, viewVO);
      }
      ListView listView = new ListView(viewId);
      listView.setListType(listType);
      listView.setViewName(viewVO.getViewName());
      listView.setViewID(viewId);
      listView.setSearchID(viewVO.getSearchId());
      if (viewForm.getSelectedColumn() != null)
      {
        int sizeOfSelectedColumn = viewForm.getSelectedColumn().length;
        String[] selectedColumnArray = viewForm.getSelectedColumn();
        for (int i = 0; i < sizeOfSelectedColumn; i++)
View Full Code Here


        // get data from database
        ViewHome viewHome = (ViewHome) CVUtility.getHomeObject("com.centraview.view.ViewHome",
            "View");
        View remote = viewHome.create();
        remote.setDataSource(dataSource);
        ViewVO viewVO = remote.getView(individualId, selectedViewId);
        ViewForm viewForm = (ViewForm) form;
        if (viewVO != null) {
          viewForm.setViewId("" + viewVO.getViewId());
          viewForm.setViewName(viewVO.getViewName());
          viewForm.setSortMember(viewVO.getSortMember());
          viewForm.setSortType(viewVO.getSortType());
          viewForm.setNoOfRecord("" + viewVO.getNoOfRecord());
          viewForm.setSearchId("" + viewVO.getSearchId());
          viewForm.setSearchType(viewVO.getSearchType());
          viewForm.setSelectedColumnVec(viewVO.getViewColumnVO());
          viewForm.setSearchIdName(viewVO.getSearchIdName());
          viewForm.setDefaultSystemView(viewVO.getDefaultView());
        } // end of if statement (viewVO != null)

        Vector vecColumn = remote.getAllColumns(listType);
        Vector selectedColumn = new Vector();
        if (viewForm.getSelectedColumnVec() != null) {
View Full Code Here

      System.out.println("[execute] Exception thrown: " + e);
      throw new ServletException(e);
    }
    remote.setDataSource(dataSource);
   
    ViewVO viewVO = remote.getView(individualId, viewId.intValue());

    if (viewVO != null) {
      viewForm.set("viewName", viewVO.getViewName());
      viewForm.set("moduleName", "");
      viewForm.set("recordType", viewVO.getListType());
      viewForm.set("sortColumn", viewVO.getSortMember());
      viewForm.set("sortDirection", viewVO.getSortType());
      try {
        viewForm.set("defaultSearch", new Integer(viewVO.getSearchId()));
      } catch (NumberFormatException nfe) {
        viewForm.set("defaultSearch", new Integer(0));
      }
      try {
        viewForm.set("recordsPerPage", new Integer(viewVO.getNoOfRecord()));
      } catch (NumberFormatException nfe) {
        viewForm.set("recordsPerPage", new Integer(10));
      }
      viewForm.set("defaultSystemView", viewVO.getDefaultView());

      try {
        viewForm.set("defaultSearch", new Integer(viewVO.getSearchId()));
      } catch (NumberFormatException nfe) {
        viewForm.set("defaultSearch", new Integer(0));
      }
    }

    String listType = viewVO.getListType();

                                              // holds fields that should not appear
    ArrayList unionFields = new ArrayList()// in available fields list because they
                                              // already appear in selected fields list

    // selectedFields - the list of fields selected for this view
    ArrayList selectedFields = new ArrayList();
    Vector selectedFieldsDb = (Vector)viewVO.getViewColumnVO();
    Iterator sfIter = selectedFieldsDb.iterator();
    while (sfIter.hasNext()) {
      DDNameValue field = (DDNameValue)sfIter.next();
      HashMap fieldMap = new HashMap();
      // someone made a decision long before me, that both the value
View Full Code Here

    viewForm.setListType(listType);
      // get userid from session
      HttpSession session = request.getSession();
      int IndividualId = ((UserObject)session.getAttribute("userobject")).getIndividualID();

      ViewVO viewVO = new ViewVO();
      viewId = 0;

      if (viewForm.getViewId() != null && viewForm.getViewId().length() > 0
      {
        viewVO.setViewId(Integer.parseInt(viewForm.getViewId()));
        viewId = Integer.parseInt(viewForm.getViewId());
      } //end of if statement (viewForm.getViewId() != null && viewForm.getViewId().length() > 0)
      viewVO.setListType(viewForm.getListType());
      if (viewForm.getNoOfRecord() != null)
      {
        viewVO.setNoOfRecord(Integer.parseInt(viewForm.getNoOfRecord()));
      } //end of if statement (viewForm.getNoOfRecord() != null)
      if (viewForm.getSearchId() != null
      {
        viewVO.setSearchId(Integer.parseInt(viewForm.getSearchId()));
      } //end of if statement (viewForm.getSearchId() != null)
      viewVO.setSortMember(viewForm.getSortMember());
      viewVO.setSortType(viewForm.getSortType());
      viewVO.setSearchType(viewForm.getSearchType());
      viewVO.setViewName(viewForm.getViewName());
      viewVO.setCreatedBy(IndividualId);
      viewVO.setOwner(IndividualId);

      // get listpreference
      // get user object from session   
      UserObject userObject = (UserObject)session.getAttribute( "userobject" );
      // get listpreference associated with the user for required listtype
      ListPreference listPreference = userObject.getListPreference(listType);
      String userDefaultId = ""+listPreference.getDefaultView();

      // set column info
      Vector columnInfo = new Vector();
      Vector selectedColumn = new Vector();
      if (viewForm.getSelectedColumn() != null)
      {
        int sizeOfSelectedColumn = viewForm.getSelectedColumn().length;
        String[] selectedColumnArray = viewForm.getSelectedColumn();
        for (int i = 0; i < sizeOfSelectedColumn; i++
        {
          ViewColumnVO columnVO = new ViewColumnVO();
          DDNameValue ddSelectedColumn = new DDNameValue(selectedColumnArray[i], selectedColumnArray[i]);
          columnVO.setColumnOrder(i+1);
          columnVO.setColumnName(selectedColumnArray[i]);
          columnInfo.add(columnVO);
          selectedColumn.add(ddSelectedColumn);
        } //end of for loop (int i = 0; i < sizeOfSelectedColumn; i++)
      } //end of if statement (viewForm.getSelectedColumn() != null)

      viewVO.setViewColumnVO(columnInfo);

      ViewHome viewHome = (ViewHome)CVUtility.getHomeObject("com.centraview.view.ViewHome","View");
      View remote =viewHome.create();
      remote.setDataSource(dataSource);

      if (request.getParameter("TYPEOFOPERATION").equals("new"))   
      {
        viewId = remote.addView(IndividualId, viewVO);
        viewForm.setViewId(viewId+"");
        request.setAttribute("TYPEOFOPERATION", "edit");
      } //end of if statement (request.getParameter("TYPEOFOPERATION").equals("ADD"))
      else if (request.getParameter("TYPEOFOPERATION").equals("edit")) 
      {
        remote.updateView(IndividualId, viewVO);
      } //end of else if statement (request.getParameter("TYPEOFOPERATION").equals("EDIT"))

      ListView listView = new ListView(viewId);
      listView.setListType(listType);
      listView.setViewName(viewVO.getViewName());
      listView.setViewID(viewId);
      listView.setSearchID(viewVO.getSearchId());
      if (viewForm.getSelectedColumn() != null)
      {
        int sizeOfSelectedColumn = viewForm.getSelectedColumn().length;
        String[] selectedColumnArray = viewForm.getSelectedColumn();
        for (int i = 0; i < sizeOfSelectedColumn; i++
View Full Code Here

TOP

Related Classes of com.centraview.view.ViewVO

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.