Examples of CustomFieldVO


Examples of com.centraview.contact.helper.CustomFieldVO

        allErrors.add(ActionMessages.GLOBAL_MESSAGE, new ActionMessage("error.general.requiredField", "Field ID"));
        saveErrors(request, allErrors);
        return(mapping.findForward(forward));
      }
    
      CustomFieldVO customFieldVO = new CustomFieldVO()
     
      CustomFieldHome customfieldHome = (CustomFieldHome)CVUtility.getHomeObject("com.centraview.customfield.CustomFieldHome","CustomField");
      CustomField customfieldRemote = customfieldHome.create();
      customfieldRemote.setDataSource(dataSource);
     
      // get the custom field data from the EJB layer
      customFieldVO = customfieldRemote.getCustomField(customFieldId.intValue());

      customFieldForm.set("fieldid", customFieldId);
      customFieldForm.set("fieldname", customFieldVO.getLabel());
      customFieldForm.set("layerSwitch", customFieldVO.getFieldType());
      customFieldForm.set("recordTypeId", new Integer(customFieldVO.getRecordTypeID()));

      HashMap moduleInfo = customfieldRemote.getFieldModuleInfo(individualId, customFieldId.intValue());
      customFieldForm.set("module", moduleInfo.get("moduleName"));
      customFieldForm.set("recordtype", moduleInfo.get("recordType"));
      request.setAttribute("valuelist", customFieldVO.getOptionValues());
      request.setAttribute("valueidslist", customFieldVO.getOptionValuesIds());
    } catch (Exception e) {
      logger.error("[execute]: Exception", e);
    }
    return (mapping.findForward(forward));
  }   // end execute() method
View Full Code Here

Examples of com.centraview.contact.helper.CustomFieldVO


         DynaActionForm cf= (DynaActionForm) form;
         // initialize customfield vo

         CustomFieldVO customfieldVO = new CustomFieldVO();

         String module = (String)request.getParameter("module");
         String fieldtype = (String)cf.get("layerSwitch");

         int tableId = 0;

         customfieldVO.setFieldID(customfieldid);
         customfieldVO.setLabel(cf.get("fieldname").toString());
         // customfieldVO.setRecordType(tableName);
         customfieldVO.setFieldType(fieldtype);

          Integer recordTypeId = (Integer)cf.get("recordTypeId");
         customfieldVO.setRecordTypeID(recordTypeId.intValue());

         if (fieldtype.equals(CustomFieldVO.MULTIPLE))
         {
            String[] optionValues=(String[])cf.get("valuelist");
            Vector vecOption = new Vector();
            HashMap vecOptionIds = new HashMap();
            for(int i=0;i<optionValues.length;i++) {

               vecOption.addElement(optionValues[i]);

               if (request.getParameter("optionName" + optionValues[i]) != null) {

                  vecOptionIds.put(optionValues[i]
                     , request.getParameter("optionName" + optionValues[i]));

               }
            }
            customfieldVO.setOptionValues(vecOption);
            customfieldVO.setOptionValuesIds(vecOptionIds);
         }

         CustomFieldHome customfieldHome = (CustomFieldHome)CVUtility.getHomeObject("com.centraview.customfield.CustomFieldHome","CustomField");
         CustomField customfieldRemote = (CustomField)customfieldHome.create();
         customfieldRemote.setDataSource(dataSource);
View Full Code Here

Examples of com.centraview.contact.helper.CustomFieldVO

        {
          tableId = lngObj.intValue();
        }
      }

      CustomFieldVO customfieldVO = new CustomFieldVO();
      customfieldVO.setLabel(cf.get("fieldname").toString());
      customfieldVO.setRecordType(tableName);
      customfieldVO.setRecordTypeID(tableId);
      customfieldVO.setFieldType((String) cf.get("layerSwitch"));

      if ((cf.get("layerSwitch")).equals(CustomFieldVO.MULTIPLE))
      {
        String[] optionValues = (String[]) cf.get("valuelist");
        Vector vecOption = new Vector();

        for (int i = 0; i < optionValues.length; i++)
        {
          vecOption.addElement(optionValues[i]);
        }

        customfieldVO.setOptionValues(vecOption);
      }

      CustomFieldHome customfieldHome = (CustomFieldHome) CVUtility
        .getHomeObject("com.centraview.customfield.CustomFieldHome", "CustomField");
      CustomField customfieldRemote = (CustomField) customfieldHome.create();
View Full Code Here

Examples of com.centraview.contact.helper.CustomFieldVO

        // value for each valid custom field...
        String formValue = (String)contactForm.get(fieldName);
        if (formValue != null && formValue.length() > 0)
        {
          // ... and create a CustomFieldVO if there is a valid form value
          CustomFieldVO customFieldVO = new CustomFieldVO();
          customFieldVO.setFieldID(fieldID.intValue());
          customFieldVO.setValue(formValue);
          contactVO.setCustomField(customFieldVO);
        }
      }   // end while (cfIter.hasNext())
    }   // end if (validCustomFields != null && validCustomFields.size() > 0)
  }   // end addCustomFields(ArrayList,String) method
View Full Code Here

Examples of com.centraview.contact.helper.CustomFieldVO

          CustomFieldLocalHome custHome = (CustomFieldLocalHome)ic.lookup("local/CustomField");
          CustomFieldLocal custRemote = custHome.create();
          custRemote.setDataSource(this.dataSource);
          for (int i =0;i<custfieldVec.size();i++)
          {
            CustomFieldVO custFieldVO = (CustomFieldVO)custfieldVec.get(i);
            custFieldVO.setRecordID(pKey);
            custRemote.addCustomField(custFieldVO);
          }
        }
        // Save CustomFields ends here
View Full Code Here

Examples of com.centraview.contact.helper.CustomFieldVO

      CustomFieldLocalHome custHome = (CustomFieldLocalHome)ic.lookup("local/CustomField");
      CustomFieldLocal custRemote = custHome.create();
      custRemote.setDataSource(this.dataSource);
      for (int i =0;i<custfieldVec.size();i++)
      {
        CustomFieldVO custFieldVO = (CustomFieldVO)custfieldVec.get(i);
        custFieldVO.setRecordID(pKey);
        custRemote.updateCustomField(custFieldVO);
      }
      // Save CustomFields ends here

      cvdl.clearParameters();
View Full Code Here

Examples of com.centraview.contact.helper.CustomFieldVO

      dl.setSql("common.getCustomField");
      dl.setString(1, recordType);
      Collection col = dl.executeQuery();
      Iterator it = col.iterator();
      while (it.hasNext()) {
        CustomFieldVO field = new CustomFieldVO();
        HashMap hm = (HashMap) it.next();
        int fieldID = ((Long) hm.get("customfieldid")).intValue();
        String label = (String) hm.get("name");
        String fieldType = (String) hm.get("fieldtype");
        int recordTypeID = ((Long) hm.get("recordtype")).intValue();
        field.setFieldID(fieldID);
        field.setLabel(label);
        field.setFieldType(fieldType);
        field.setRecordTypeID(recordTypeID);
        cusData.put("" + fieldID, field);
      } // end of while
      dl.clearParameters();
      dl.setSql("common.getCustomFieldOption");
      dl.setString(1, recordType);
      col = dl.executeQuery();
      it = col.iterator();
      while (it.hasNext()) {
        HashMap hm = (HashMap) it.next();
        int fieldID = ((Long) hm.get("customfieldid")).intValue();
        int valueID = ((Long) hm.get("valueid")).intValue();
        String value = (String) hm.get("value");
        CustomFieldVO cf = (CustomFieldVO) cusData.get(String.valueOf(fieldID));
        Vector vec = cf.getOptionValues();
        if (vec == null) {
          vec = new Vector();
          DDNameValue dd = new DDNameValue(valueID, value);
          vec.add(dd);
        } else {
          DDNameValue dd = new DDNameValue(valueID, value);
          vec.add(dd);
        }
        cf.setOptionValues(vec);
        cusData.put(String.valueOf(fieldID), cf);
      }
    } catch (Exception e) {
      logger.error("[getCustomFieldData]: Exception", e);
    } finally {
View Full Code Here

Examples of com.centraview.contact.helper.CustomFieldVO

      dl.setSql("common.getCustomField");
      dl.setString(1, recordType);
      Collection col = dl.executeQuery();
      Iterator it = col.iterator();
      while (it.hasNext()) {
        CustomFieldVO field = new CustomFieldVO();
        HashMap hm = (HashMap) it.next();
        int fieldID = ((Long) hm.get("customfieldid")).intValue();
        String label = (String) hm.get("name");
        String fieldType = (String) hm.get("fieldtype");
        int recordTypeID = ((Long) hm.get("recordtype")).intValue();
        field.setFieldID(fieldID);
        field.setLabel(label);
        field.setFieldType(fieldType);
        field.setRecordTypeID(recordTypeID);
        cusData.put(String.valueOf(fieldID), field);
      } // end of while
      dl.setSqlQueryToNull();
      // now get the all the values of custom fields for this record
      String str = " SELECT cf.customfieldid, cf.name, cf.fieldtype,cf.recordType,cfv.valueid,cfv.value ,cfm.valueID as selected from customfield cf,customfieldvalue cfv left outer join customfieldmultiple cfm on ( cfv.customfieldid = cfm.customfieldid and cfv.valueid = cfm.valueid and cfm.recordid = "
          + recordID
          + " ),cvtable where cf.customfieldid = cfv.customfieldid and cf.recordtype = cvtable.tableid and  cvtable.name  =  '"
          + recordType + "' ";
      str = str
          + " union SELECT cf.customfieldid, cf.name, cf.fieldtype,cf.recordType,null ,cfs.value ,null as seleted from customfield cf,customfieldscalar cfs ,cvtable where cf.customfieldid = cfs.customfieldid and cf.recordtype = cvtable.tableid and  cvtable.name  =  '"
          + recordType + "'  and cfs.recordid = " + recordID + " order by value";
      dl.setSqlQuery(str);
      col = dl.executeQuery();
      it = col.iterator();
      while (it.hasNext()) {
        HashMap hm = (HashMap) it.next();
        int fieldID = ((Number) hm.get("customfieldid")).intValue();
        String fieldType = (String) hm.get("fieldtype");
        // The query returns scalars with the ID as NULL
        // Also some non-selected multiples give NULL
        // So we have to do something about that
        Object valueIdObject = hm.get("valueid");
        int valueId = 0;
        if (valueIdObject != null) {
          try {
            valueId = Integer.parseInt(valueIdObject.toString());
          } catch (NumberFormatException nfe) {}
        }
        String value = (String) hm.get("value");
        Object selectedObject = hm.get("selected");
        String selected;
        if (selectedObject != null) {
          selected = selectedObject.toString();
        } else {
          selected = "";
        }
        // Dig the custom field back out and set the options and values on it.
        CustomFieldVO cf = (CustomFieldVO) cusData.get(String.valueOf(fieldID));
        if (fieldType.equals("MULTIPLE")) {
          Vector optionsVector = cf.getOptionValues();
          if (optionsVector == null) {
            optionsVector = new Vector();
            DDNameValue dd = new DDNameValue(valueId, value);
            optionsVector.add(dd);
          } else {
            DDNameValue dd = new DDNameValue(valueId, value);
            optionsVector.add(dd);
          }
          cf.setOptionValues(optionsVector);
          if (!selected.equals("")) {
            cf.setValue(selected);
          }
        } else if (fieldType.equals("SCALAR")) {
          cf.setValue(value);
        }
      } // end of while loop on values query
    } catch (Exception e) {
      logger.error("[getCustomFieldData] Exception thrown.", e);
      throw new EJBException(e);
View Full Code Here

Examples of com.centraview.contact.helper.CustomFieldVO

    return cusData;
  } // end of getCustomFieldData(String recordType ,int recordID)

  public CustomFieldVO getCustomField(int customFieldID, int recordID)
  {
    CustomFieldVO field = null;
    CVDal dl = new CVDal(dataSource);
    try {
      dl.setSql("common.getCustomFieldOnly");
      dl.setInt(1, customFieldID);
      Collection col = dl.executeQuery();
      Iterator it = col.iterator();
      while (it.hasNext()) {
        field = new CustomFieldVO();
        HashMap hm = (HashMap) it.next();
        int fieldID = ((Long) hm.get("customfieldid")).intValue();
        String label = (String) hm.get("name");
        String fieldType = (String) hm.get("fieldtype");
        int recordTypeID = ((Long) hm.get("recordtype")).intValue();
        field.setFieldID(fieldID);
        field.setLabel(label);
        field.setFieldType(fieldType);
        field.setRecordTypeID(recordTypeID);
      }
      String str = " SELECT cf.customfieldid, cf.name, cf.fieldtype,cf.recordType,cfv.valueid,cfv.value ,cfm.valueID as selected from customfield cf,customfieldvalue cfv left outer join customfieldmultiple cfm on ( cfv.customfieldid = cfm.customfieldid) and cfm.recordid= "
          + recordID + " where cf.customfieldid = cfv.customfieldid  and cf.customfieldid  = " + customFieldID;
      str = str
          + " union SELECT cf.customfieldid, cf.name, cf.fieldtype,cf.recordType,null ,cfs.value ,null as selected  from customfield cf left outer join customfieldscalar cfs on (cf.customfieldid = cfs.customfieldid) and cfs.recordid="
          + recordID + " where cf.customfieldid  = " + customFieldID;
      dl.setSqlQueryToNull();
      dl.setSqlQuery(str);
      col = dl.executeQuery();
      it = col.iterator();

      while (it.hasNext()) {
        HashMap hm = (HashMap) it.next();
        String fieldType = (String) hm.get("fieldtype");
        int valueID = ((Long) hm.get("valueid")).intValue();
        String value = (String) hm.get("value");
        Long selectedLong = (Long)hm.get("seleted");
        String selected = "";
        if (selectedLong != null) {
          selected = "" + selectedLong.intValue();
        }
        CustomFieldVO cf = field;
        if (fieldType.equals("MULTIPLE")) {
          Vector vec = cf.getOptionValues();
          if (value != null) {
            if (vec == null) {
              vec = new Vector();
              DDNameValue dd = new DDNameValue(valueID, value);
              vec.add(dd);
            } else {
              DDNameValue dd = new DDNameValue(valueID, value);
              vec.add(dd);
            }

            cf.setOptionValues(vec);
            if (selected == null) {
              selected = "";
            }
            selected = selected.trim();

            if (!selected.equals("")) {
              cf.setValue(selected);
            }
          }
        } else if (fieldType.equals("SCALAR")) {
          cf.setValue(value);
        }
        field = cf;
      }
    } catch (Exception e) {
      logger.error("[getCustomField]: Exception", e);
View Full Code Here

Examples of com.centraview.contact.helper.CustomFieldVO

  public void deleteCustomField(int userID, int customFieldID)
  {
    CVDal cvdl = new CVDal(dataSource);

    try {
      CustomFieldVO cfData = getCustomField(customFieldID);
      if ((cfData.getFieldType()).equals(CustomFieldVO.SCALAR)) {
        cvdl.setSql("admin.deletecustomfield");
        cvdl.setInt(1, cfData.getFieldID());
        cvdl.executeUpdate();
        cvdl.clearParameters();
      } else if ((cfData.getFieldType()).equals(CustomFieldVO.MULTIPLE)) {
        cvdl.setSql("admin.deletecustomfieldvalues");
        cvdl.setInt(1, cfData.getFieldID());
        cvdl.executeUpdate();
        cvdl.clearParameters();
        cvdl.setSql("admin.deletecustomfield");
        cvdl.setInt(1, cfData.getFieldID());
        cvdl.executeUpdate();
        cvdl.clearParameters();
      }
    } catch (Exception e) {
      logger.error("[deleteCustomField]: Exception", e);
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. 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.