Package com.centraview.common

Examples of com.centraview.common.DDNameValue


   
    String dataSource = Settings.getInstance().getSiteInfo(CVUtility.getHostName(super.getServlet().getServletContext())).getDataSource();

    // Set up the collections for the drop downs, and stick them on the request.
    ArrayList mergeType = new ArrayList();
    mergeType.add(new DDNameValue("1", "Entities"));
    mergeType.add(new DDNameValue("2", "Individuals"));

    // The search domain list conists of a 0 value for all records
    // And listid values for the marketing lists.
    ArrayList searchDomain = new ArrayList();
    searchDomain.add(new DDNameValue("0", "All Records"));

    // get marketing lists from the EJB
    ArrayList marketingLists = null;
  ContactFacadeHome contactFacadeHome = (ContactFacadeHome)CVUtility.getHomeObject("com.centraview.contact.contactfacade.ContactFacadeHome", "ContactFacade");
    try
    {
      ContactFacade remoteContactFacade = contactFacadeHome.create();
      remoteContactFacade.setDataSource(dataSource);
      marketingLists = (ArrayList)remoteContactFacade.getAllMarketingList();
    } catch (Exception e) {
    logger.error("[Exception] MergeSearch.Execute Handler ", e);
        throw new ServletException(e);
    }
    // this should never be null worst case it should be an empty arraylist.
    for(int i = 0; i < marketingLists.size(); i++)
    {
      HashMap currentList = (HashMap)marketingLists.get(i);
      searchDomain.add(new DDNameValue(((Number)currentList.get("listid")).toString(), (String)currentList.get("title")));
    }

    // Get the searchCriteria from the EJB, needs to come from EJB layer for
    // custom fields, otherwise we could just instantiate it.
    SearchCriteriaVO searchCriteria = null;
  MergeHome mergeHome = (MergeHome)CVUtility.getHomeObject("com.centraview.administration.merge.MergeHome", "Merge");
    try
    {
      Merge remoteMerge = mergeHome.create();
      remoteMerge.setDataSource(dataSource);
      searchCriteria = remoteMerge.getSearchCriteriaVO();
    }
    catch (Exception e)
    {
    logger.error("[Exception] MergeSearch.Execute Handler ", e);
        throw new ServletException(e);
    }
   
    // Check the request parameter to see what type of field list we need to show.
    // Default to entities = 1.  (Individuals = 2)
    String mergeTypeParam = request.getParameter("mergeType");
    String selectedMergeType = mergeTypeParam != null ? mergeTypeParam : "1";
    ArrayList rawFieldList = null;
    if (selectedMergeType.equals("1"))
    {
      rawFieldList = searchCriteria.getEntityFieldList();
    } else {
      rawFieldList = searchCriteria.getIndividualFieldList();
    } // end if(selectedMergeType.equals("1"))
    // Set the mergeType on the form-bean
    mergeSearchForm.set("mergeType", selectedMergeType);
    // We are now prepared to DDNameValue-up the fieldList
    ArrayList fieldList = new ArrayList();
    for (int i = 0; i < rawFieldList.size(); i++)
    {
      MergeField field = (MergeField)rawFieldList.get(i);
      fieldList.add(new DDNameValue(Integer.toString(i),field.getDescription()));
    } // end while fieldIterator.hasNext()
   
    ArrayList rawSearchType = SearchCriteriaVO.getSearchType();
    // DDNameValue it UP!
    ArrayList searchType = new ArrayList();
    for (int i = 0; i < rawSearchType.size(); i++)
    {
      searchType.add(new DDNameValue(Integer.toString(i), (String)rawSearchType.get(i)));
    }
   
    // We have to grow the Array of SearchCriteriaLines on the formbean
    // based on the property bean property addRow
    SearchCriteriaLine [] currentLine = (SearchCriteriaLine[])mergeSearchForm.get("criteriaLine");
View Full Code Here


    // 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
      // and display name properties for the HTML select widget should
      // be the name of the field. So I'm not changing it. -MK 12/29/2004
      String fieldName = (String)field.getName();
      fieldMap.put("fieldId", fieldName);
      fieldMap.put("fieldName", fieldName);
      selectedFields.add(fieldMap);
      unionFields.add(fieldName);
    }
    viewForm.set("selectedFields", selectedFields);

    // availableFields - the list of fields available in this module
    ArrayList availableFields = new ArrayList();    // collection we send to JSP via form bean
    ArrayList allFields = new ArrayList();    // collection of all available fields
    Vector availableFieldsDb = (Vector)remote.getAllColumns(listType);    // collection from DB
    Iterator afIter = availableFieldsDb.iterator();
    while (afIter.hasNext()) {
      DDNameValue field = (DDNameValue)afIter.next();
      HashMap fieldMap = new HashMap();
      // someone made a decision long before me, that both the value
      // and display name properties for the HTML select widget should
      // be the name of the field. So I'm not changing it. -MK 12/29/2004
      fieldMap.put("fieldId", field.getName());
      fieldMap.put("fieldName", field.getName());
      if (! unionFields.contains(field.getName())) {
        // only add the field if it's not in the selectedFields list
        availableFields.add(fieldMap);
      }
      // used for the sort fields list
      allFields.add(fieldMap);
View Full Code Here

      StringBuffer next = new StringBuffer();
      next.append("c_goTo('/calendar.do?Type=DAILY&selectedDay=" + nextDailyDay);
      next.append("&selectedMonthName=" + nextDailyMonth + "&selectedYear=" + nextDailyYear + "');");

      calendarNavBarList.add(new DDNameValue("Previous", previous.toString()));
      calendarNavBarList.add(new DDNameValue("Today", current.toString()));
      calendarNavBarList.add(new DDNameValue("Next", next.toString()));
    } else if (calendarType != null && (calendarType.equals("WEEKLY") || calendarType.equals("WEEKLYCOLUMNS"))) {
      int previousWeekDate = 0;
      String previousWeekMonth = "";
      int previousWeekYear = 0;
      if (currentDay != 0 && currentMonth >= 0 && currentYear != 0) {
        Calendar previousCalendarWeek = Calendar.getInstance();
        previousCalendarWeek.set(currentYear, currentMonth, currentDay);
        previousCalendarWeek.add(Calendar.DATE, -7);
        previousWeekDate = previousCalendarWeek.get(Calendar.DATE);
        int intYearOfMonth = previousCalendarWeek.get(Calendar.MONTH);
        previousWeekMonth = getCalenderMonthName(intYearOfMonth);
        previousWeekYear = previousCalendarWeek.get(Calendar.YEAR);
      }
      int nextWeekDay = 0;
      String nextWeekMonth = "";
      int nextWeekYear = 0;

      if (currentDay != 0 && currentMonth >= 0 && currentYear != 0) {
        Calendar nextCalendarWeek = Calendar.getInstance();
        nextCalendarWeek.set(currentYear, currentMonth, currentDay);
        nextCalendarWeek.add(Calendar.DATE, +7);
        nextWeekDay = nextCalendarWeek.get(Calendar.DATE);
        int intYearOfMonth = nextCalendarWeek.get(Calendar.MONTH);
        nextWeekYear = nextCalendarWeek.get(Calendar.YEAR);
        nextWeekMonth = getCalenderMonthName(intYearOfMonth);
      }

      StringBuffer previous = new StringBuffer();
      previous.append("c_goTo('/calendar.do?Type=" + calendarType + "&selectedDay=" + previousWeekDate);
      previous.append("&selectedMonthName=" + previousWeekMonth + "&selectedYear=" + previousWeekYear + "');");

      StringBuffer current = new StringBuffer();
      current.append("c_goTo('/calendar.do?Type=" + calendarType + "&selectedDay=" + thisDayOfMonth);
      current.append("&selectedMonthName=" + thisMonth + "&selectedYear=" + thisYear + "');");

      StringBuffer next = new StringBuffer();
      next.append("c_goTo('/calendar.do?Type=" + calendarType + "&selectedDay=" + nextWeekDay);
      next.append("&selectedMonthName=" + nextWeekMonth + "&selectedYear=" + nextWeekYear + "');");

      calendarNavBarList.add(new DDNameValue("Previous", previous.toString()));
      calendarNavBarList.add(new DDNameValue("Current Week", current.toString()));
      calendarNavBarList.add(new DDNameValue("Next", next.toString()));
      SimpleDateFormat formatter = new SimpleDateFormat("MM/dd");

      String dailyGo = "c_goTo('/calendar.do?Type=DAILY";

      if (currentDay != 0 && currentMonth >= 0 && currentYear != 0) {
        Calendar headerCalendarWeek = Calendar.getInstance();
        headerCalendarWeek.set(currentYear, currentMonth, currentDay);

        int dayOfWeek = headerCalendarWeek.get(Calendar.DAY_OF_WEEK);
        // Subtracting it with 2 coz in the Calendar Starting Day is Monday.
        int offset = dayOfWeek - 2;
        if (offset < 0) {
          int daysInWeek = 7;
          // if we are before the current day of the week, we need to fall all
          // the way back to the previous beginning of the week. calculating our
          // offset in this way will give us the right num of days to the
          // previous start. this makes it easy to just add it to the
          // currentDate.
          offset = daysInWeek + offset;
        }
        int currentDate = headerCalendarWeek.get(Calendar.DATE);
        headerCalendarWeek.set(Calendar.DATE, currentDate - offset);

        int headerDayOfMonth = headerCalendarWeek.get(Calendar.DATE);
        int headerMonthOfYear = headerCalendarWeek.get(Calendar.MONTH);
        int headerYear = headerCalendarWeek.get(Calendar.YEAR);

        try {
          // This is used in the columnar weekly view for calculating the
          // date to be filled in when you click on a empty cell.
          calendarNavBarMap.put("startDayOfWeek", new Integer(headerDayOfMonth));
        } catch (NumberFormatException nfe) {
          logger.info("[setCalendarNavBar]: The offset for the clickable weekly view boxes will probably be broken.");
          calendarNavBarMap.put("startDayOfWeek", new Integer(0));
        }

        String dateString = headerYear + ",'" + getCalenderMonthName(headerMonthOfYear) + "'," + headerDayOfMonth;
        String headerDate = formatter.format(headerCalendarWeek.getTime());
        String dailyDate = "&selectedDay=" + headerDayOfMonth + "&selectedMonthName=" + getCalenderMonthName(headerMonthOfYear) + "&selectedYear="
            + headerYear;

        String action = "ScheduleActivity(" + dateString + ",'','');";
        dateList.put(String.valueOf(0), action);
        headerLinkList.put(String.valueOf(0), dailyGo + dailyDate + "');");
        headerList.put(String.valueOf(0), headerDate);
        int count = 1;
        for (int i = 0; i < 6; i++) {
          headerCalendarWeek.add(Calendar.DATE, 1);
          headerDayOfMonth = headerCalendarWeek.get(Calendar.DAY_OF_MONTH);
          headerMonthOfYear = headerCalendarWeek.get(Calendar.MONTH);
          headerYear = headerCalendarWeek.get(Calendar.YEAR);
          dateString = headerYear + ",'" + getCalenderMonthName(headerMonthOfYear) + "'," + headerDayOfMonth;
          action = "ScheduleActivity(" + dateString + ",'','');";
          dateList.put(String.valueOf(count), action);
          headerDate = formatter.format(headerCalendarWeek.getTime());
          headerList.put(String.valueOf(count), headerDate);
          dailyDate = "&selectedDay=" + headerDayOfMonth + "&selectedMonthName=" + getCalenderMonthName(headerMonthOfYear) + "&selectedYear="
              + headerYear;
          headerLinkList.put(String.valueOf(count), dailyGo + dailyDate + "');");
          count++;
        }
      }
    } else if (calendarType != null && calendarType.equals("MONTHLY")) {
      int previousMonthlyDay = 0;
      String previousMonthlyMonth = "";
      int previousMonthlyYear = 0;

      if (currentDay != 0 && currentMonth >= 0 && currentYear != 0) {
        Calendar previousCalendarWeek = Calendar.getInstance();
        previousCalendarWeek.set(currentYear, currentMonth, currentDay);
        previousCalendarWeek.add(Calendar.MONTH, -1);
        previousMonthlyDay = previousCalendarWeek.get(Calendar.DATE);
        int intYearOfMonth = previousCalendarWeek.get(Calendar.MONTH);
        previousMonthlyMonth = getCalenderMonthName(intYearOfMonth);
        previousMonthlyYear = previousCalendarWeek.get(Calendar.YEAR);
      }

      int nextMonthlyDay = 0;
      String nextMonthlyMonth = "";
      int nextMonthlyYear = 0;

      if (currentDay != 0 && currentMonth >= 0 && currentYear != 0) {
        Calendar nextCalendarWeek = Calendar.getInstance();
        nextCalendarWeek.set(currentYear, currentMonth, currentDay);
        nextCalendarWeek.add(Calendar.MONTH, 1);
        nextMonthlyDay = nextCalendarWeek.get(Calendar.DATE);
        int intYearOfMonth = nextCalendarWeek.get(Calendar.MONTH);
        nextMonthlyYear = nextCalendarWeek.get(Calendar.YEAR);
        nextMonthlyMonth = getCalenderMonthName(intYearOfMonth);
      }
      StringBuffer previous = new StringBuffer();
      previous.append("c_goTo('/calendar.do?Type=MONTHLY&selectedDay=" + previousMonthlyDay);
      previous.append("&selectedMonthName=" + previousMonthlyMonth + "&selectedYear=" + previousMonthlyYear + "');");

      StringBuffer current = new StringBuffer();
      current.append("c_goTo('/calendar.do?Type=MONTHLY&selectedDay=" + thisDayOfMonth);
      current.append("&selectedMonthName=" + thisMonth + "&selectedYear=" + thisYear + "');");

      StringBuffer next = new StringBuffer();
      next.append("c_goTo('/calendar.do?Type=MONTHLY&selectedDay=" + nextMonthlyDay);
      next.append("&selectedMonthName=" + nextMonthlyMonth + "&selectedYear=" + nextMonthlyYear + "');");

      calendarNavBarList.add(new DDNameValue("Previous", previous.toString()));
      calendarNavBarList.add(new DDNameValue("Current Month", current.toString()));
      calendarNavBarList.add(new DDNameValue("Next", next.toString()));
    } else if (calendarType != null && calendarType.equals("YEARLY")) {
      int previousYearlyYear = 0;
      previousYearlyYear = currentYear - 1;
      int nextYearlyYear = 0;
      nextYearlyYear = currentYear + 1;

      StringBuffer previous = new StringBuffer();
      previous.append("c_goTo('/calendar.do?Type=YEARLY&selectedYear=" + previousYearlyYear + "');");

      StringBuffer current = new StringBuffer();
      current.append("c_goTo('/calendar.do?Type=YEARLY&selectedYear=" + thisYear + "');");

      StringBuffer next = new StringBuffer();
      next.append("c_goTo('/calendar.do?Type=YEARLY&selectedYear=" + nextYearlyYear + "');");

      calendarNavBarList.add(new DDNameValue("Previous", previous.toString()));
      calendarNavBarList.add(new DDNameValue("Current Year", current.toString()));
      calendarNavBarList.add(new DDNameValue("Next", next.toString()));
    }
    calendarNavBarMap.put("calendarNavBar", calendarNavBarList);
    calendarNavBarMap.put("headerList", headerList);
    calendarNavBarMap.put("headerLinkList", headerLinkList);
    calendarNavBarMap.put("dateList", dateList);
View Full Code Here

            promotionDetailListForm.setItemLines(itemLines);
          }
        }
        request.setAttribute("ItemLines",itemLines);
    ArrayList colStatus = new ArrayList();
        colStatus.add(new DDNameValue("YES","Active"));
        colStatus.add(new DDNameValue("NO","Inactive"));
        request.setAttribute("colStatus", colStatus);       
        request.setAttribute("TypeOfOperation", "Promotions");
        request.setAttribute("Operation", "Edit");
    }
    catch (Exception e)
View Full Code Here

      GlobalMasterLists gml = GlobalMasterLists.getGlobalMasterLists(dataSource);
      Vector salesStatusList = (Vector)gml.get("AllSaleProbability");
      Iterator it = salesStatusList.iterator();
     
      while (it.hasNext()) {
        DDNameValue thisStatus = (DDNameValue) it.next();
        if ((thisStatus.getName()).equalsIgnoreCase("100%")) {
          proposalListForm.setProbability(Integer.toString(thisStatus.getId()));
          break;
        }
      }
     
      proposalListForm.setAttachFileValues(new Vector());
View Full Code Here

      //To Make sure we don't go out of bounds.
      int arrayLength = (optionIDs.length < optionValues.length) ? optionIDs.length : optionValues.length;

      for (int i = 0; i < arrayLength; i++) {
        DDNameValue tempDDNameValue =
        new DDNameValue(Integer.parseInt(optionIDs[i]), optionValues[i]);
        vecOption.add(tempDDNameValue);
      }
      AppSettings appRemote = appHome.create();
      appRemote.setDataSource(dataSource);
      appRemote.addMasterDataSettings(setting, (Collection) vecOption);
View Full Code Here

        Vector taxJurisdiction = remote.getTaxJurisdiction();
        ArrayList taxMatrixValue = new ArrayList();
       
        if (taxJurisdiction != null && taxJurisdiction.size() != 0) {
          for (int i = 0; i < taxJurisdiction.size(); i++) {
            DDNameValue taxJurisdictionNameValue = (DDNameValue)taxJurisdiction.get(i);
            if (taxJurisdictionNameValue != null) {
              int taxJurisdictionID = taxJurisdictionNameValue.getId();
              String taxJurisdictionName = taxJurisdictionNameValue.getName();
             
              if (taxClass != null && taxClass.size() != 0) {
                for (int j = 0; j < taxClass.size(); j++) {
                  DDNameValue taxClassNameValue = (DDNameValue)taxClass.get(j);
                  if (taxClassNameValue != null) {
                    int taxClassID = taxClassNameValue.getId();
                    String taxClassName = taxClassNameValue.getName();
                   
                    String textBoxName = "J" + taxJurisdictionID + "C" + taxClassID;
                    String taxRate = request.getParameter(textBoxName);
                    if (taxRate == null || taxRate.length() <= 0) {
                      allErrors.add(ActionMessages.GLOBAL_MESSAGE, new ActionMessage("error.general.requiredField", taxJurisdictionName+"/"+taxClassName));
View Full Code Here

        Iterator idIterator = savedSearchIds.iterator();
        while (idIterator.hasNext())
        {
          Number searchId = (Number)idIterator.next();
          String searchName = (String)savedSearchMap.get(searchId);
          savedSearchVec.add(new DDNameValue(searchId.toString(),searchName));
        }
      }
      globalReplaceForm.set("savedSearchVec", savedSearchVec);

      HashMap allFields = (HashMap)globalReplaceForm.get("allFields");
View Full Code Here

        Set savedSearchIds = savedSearchMap.keySet();
        Iterator idIterator = savedSearchIds.iterator();
        while (idIterator.hasNext()) {
          Number searchId = (Number)idIterator.next();
          String searchName = (String)savedSearchMap.get(searchId);
          savedSearchVec.add(new DDNameValue(searchId.toString(),searchName));
        }
      }
      globalReplaceForm.set("savedSearchVec", savedSearchVec);

      HashMap allFields = (HashMap)globalReplaceForm.get("allFields");
View Full Code Here

        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++
        {
          listView.addColumnName(selectedColumnArray[i]);       
        } //end of for loop (int i = 0; i < sizeOfSelectedColumn; i++)
      } //end of if statement (viewForm.getSelectedColumn() != null)
      listPreference.addListView(listView);

      Vector vecColumn = remote.getAllColumns(listType);
      Vector sortMemberVec = new Vector(vecColumn);
      viewForm.setSortMemberVec(sortMemberVec);

      int sizeOfAvailableList = vecColumn.size();
      int sizeOfSelectedList = selectedColumn.size();
      int i = 0;
      int j = 0;
      String idOfAvailableList = "";
      String idOfSelectedList = "";
      DDNameValue ddAvailableListInfo = null;
      DDNameValue ddSelectedListInfo = null;
      boolean removed = false;
      while (i < sizeOfAvailableList
      {
        removed = false;
        ddAvailableListInfo = (DDNameValue) vecColumn.get(i);
        idOfAvailableList = ddAvailableListInfo.getStrid();
        while (j < sizeOfSelectedList
        {
          ddSelectedListInfo = (DDNameValue) selectedColumn.get(j);
          idOfSelectedList = ddSelectedListInfo.getStrid();
          if (idOfAvailableList.equals(idOfSelectedList)) 
          {
            vecColumn.remove(i)
            removed = true
            sizeOfAvailableList--; 
View Full Code Here

TOP

Related Classes of com.centraview.common.DDNameValue

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.