Package com.centraview.common

Examples of com.centraview.common.CustomFieldList


    // record.
    // It is used in relatedInfo primarily.
    // If a method is needed to get a list of customfields for a particular
    // recordtype without values,
    // write another one.
    CustomFieldList cfList = new CustomFieldList();
    CVDal cvdl = new CVDal(dataSource);

    try {
      cvdl.clearParameters();
      cvdl.setSql("customfield.createTempListTable");
      cvdl.executeUpdate();

      cvdl.clearParameters();
      cvdl.setSql("customfield.insertIntoTempListTable");
      cvdl.setString(1, recordType);
      cvdl.executeUpdate();

      cvdl.clearParameters();
      cvdl.setSql("customfield.updateTempListScalar");
      cvdl.setInt(1, recordID);
      cvdl.executeUpdate();

      cvdl.clearParameters();
      cvdl.setSql("customfield.updateTempListMultiple");
      cvdl.setInt(1, recordID);
      cvdl.executeUpdate();

      cvdl.clearParameters();
      cvdl.setSql("customfield.getCustomFieldList");
      Collection col = cvdl.executeQuery();

      cvdl.clearParameters();
      cvdl.setSql("customfield.deleteTempTable");
      cvdl.executeUpdate();

      if (col != null) {
        Iterator it = col.iterator();

        while (it.hasNext()) {
          HashMap hm = (HashMap) it.next();

          int customFieldID = ((Number) hm.get("customfieldid")).intValue();

          IntMember addId = new IntMember("CustomFieldID", customFieldID, 10, "/centraview/ViewHandler.do?customFieldID=" + customFieldID, 'T',
              false, 10);
          StringMember field = new StringMember("Field", (String) hm.get("name"), 10, "requestURL", 'T', true);
          StringMember value = new StringMember("Value", (String) hm.get("value"), 10, "requestURL", 'T', false);

          CustomFieldListElement listElement = new CustomFieldListElement(customFieldID);

          listElement.put("CustomFieldID", addId);
          listElement.put("Field", field);
          listElement.put("Value", value);

          cfList.put((String) hm.get("Field") + customFieldID, listElement);
        }
      }
    } catch (Exception e) {
      logger.error("[getCustomFieldList]: Exception", e);
    } finally {
View Full Code Here


    int intEndParam = intEnd.intValue();

    int beginindex = Math.max(intStartParam - 100, 1);
    int endindex = intEndParam + 100;

    CustomFieldList cfList = new CustomFieldList();
    cfList.setPrimaryMember("Name");
    cfList.setSortMember(strSortMem);

    CVDal cvdl = new CVDal(dataSource);

    Collection colList = null;
    try {
      if ((strSearch != null) && strSearch.startsWith("ADVANCE:")) {
        strSearch = strSearch.substring(8);
        String str = "create TEMPORARY TABLE customfieldlistSearch " + strSearch;
        cvdl.setSqlQueryToNull();
        cvdl.setSqlQuery(str);
        cvdl.executeUpdate();
        cvdl.clearParameters();

        String sortType = "ASC";

        if (charSort == 'A') {
          sortType = "ASC";
        } else {
          sortType = "DESC";
        }

        String strQuery = "select c.customfieldid as customfieldid,c.name as name,c.fieldtype as type,m.name as module,r.name as record from customfield c,module m,cvtable r,customfieldlistSearch cfsearch where r.moduleid=m.moduleid and c.recordtype=r.tableid  and cfsearch.customfieldid=c.customfieldid order by "
            + strSortMem + " " + sortType;
        cvdl.setSqlQueryToNull();
        cvdl.setSqlQuery(strQuery);
        colList = cvdl.executeQuery();
        cvdl.clearParameters();

        cvdl.setSqlQueryToNull();
        cvdl.setSqlQuery("DROP TABLE customfieldlistSearch");
        cvdl.executeUpdate();
      } else {
        String sortType = "ASC";

        if (charSort == 'A') {
          sortType = "ASC";
        } else {
          sortType = "DESC";
        }

        String strQuery = "select a.CustomFieldID as customfieldid, a.Name as name,a.FieldType as type,d.name as module,b.name as record from customfield a,cvtable b, module c, module d where a.RecordType = b.tableid and b.moduleid = c.moduleid and c.parentid = d.moduleid and d.name = ? union select a.CustomFieldID as customfieldid, a.Name as name,a.FieldType as type,b.name as module,b.name as record from customfield a,cvtable b, module c, module d where a.RecordType = b.tableid and b.moduleid = c.moduleid and  ISNULL(c.parentid) and c.name =?  order by "
            + strSortMem + " " + sortType;
        cvdl.setSqlQuery(strQuery);
        cvdl.setString(1, moduleName);
        cvdl.setString(2, moduleName);
        colList = cvdl.executeQuery();
      }

      if (colList.size() > 0) {
        Iterator it = colList.iterator();
        int i = 0;
        while (it.hasNext()) {
          i++;
          HashMap hm = (HashMap) it.next();
          int custfieldID = ((Long) hm.get("customfieldid")).intValue();
          try {
            IntMember intCustFieldID = new IntMember("CustomFieldID", custfieldID, 10, "", 'T', false, 10);
            StringMember strName = null;
            if ((hm.get("name") != null)) {
              strName = new StringMember("Name", (String) hm.get("name"), 10, "", 'T', true);
            } else {
              strName = new StringMember("Name", null, 10, "", 'T', true);
            }
            String typeValue = (hm.get("type") == null) ? "SCALAR" : (String) hm.get("type");
            if (typeValue.equals("SCALAR")) {
              typeValue = "Single";
            } else {
              typeValue = "Multiple";
            }
            StringMember strType = new StringMember("Type", typeValue, 10, "", 'T', false);
            StringMember strModule = null;
            if ((hm.get("module") != null)) {
              strModule = new StringMember("Module", (String) hm.get("module"), 10, "", 'T', false);
            } else {
              strModule = new StringMember("Module", "", 10, "", 'T', false);
            }
            StringMember strRecord = null;
            if ((hm.get("record") != null)) {
              strRecord = new StringMember("Record", (String) hm.get("record"), 10, "", 'T', false);
            } else {
              strRecord = new StringMember("Record", "", 10, "", 'T', false);
            }
            CustomFieldListElement cflistelement = new CustomFieldListElement(custfieldID);
            cflistelement.put("CustomFieldID", intCustFieldID);
            cflistelement.put("Name", strName);
            cflistelement.put("Type", strType);
            cflistelement.put("Module", strModule);
            cflistelement.put("Record", strRecord);
            StringBuffer stringbuffer = new StringBuffer("00000000000");
            stringbuffer.setLength(11);
            String s3 = (new Integer(i)).toString();
            stringbuffer.replace(stringbuffer.length() - s3.length(), stringbuffer.length(), s3);
            String s4 = stringbuffer.toString();
            cfList.put(s4, cflistelement);
          } catch (Exception e) {
            logger.error("[getCustomFieldList]: Exception", e);
          }
        }
      }
      cfList.setTotalNoOfRecords(cfList.size());
      cfList.setListType("CustomFields");
      cfList.setBeginIndex(beginindex);
      cfList.setEndIndex(endindex);
    } finally {
      cvdl.destroy();
    }
    return cfList;
  }
View Full Code Here

   * @param rep ReportContentString
   * @param recordId int
   */
  public void addCustomFieldValues(ReportContentString rep, int recordId) throws Exception
  {
    CustomFieldList customFieldValues = null;
    try {
      InitialContext ic = CVUtility.getInitialContext();
      CustomFieldLocalHome homeCustomField = (CustomFieldLocalHome) ic.lookup("local/CustomField");
      CustomFieldLocal remoteCustomField = homeCustomField.create();
      customFieldValues = remoteCustomField.getCustomFieldList(tableName, recordId);

      // HashMap hm = customFieldValues.getColumnMap();
      DDNameValue fieldName = null;
      // CustomFieldListElement listElement = null;
      Set st = null;
      Iterator iter = null;
      StringMember fl = null;
      StringMember vl = null;
      boolean fieldPresent = false;
      int size = customFields.size();

      for (int i = 0; i < size; ++i) {
        fieldName = (DDNameValue) customFields.get(i);
        st = customFieldValues.keySet();
        iter = st.iterator();
        fieldPresent = false;
        while (iter.hasNext()) {
          String keyStr = (String) iter.next();
          ListElement ele = (ListElement) customFieldValues.get(keyStr);
          IntMember id = (IntMember) ele.get("CustomFieldID");

          if (fieldName.getStrid().equalsIgnoreCase(id.getDisplayString())) {

            fl = (StringMember) ele.get("Field");
View Full Code Here

TOP

Related Classes of com.centraview.common.CustomFieldList

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.