public void getData(String codeSystem, String codeSystemVersion, String searchText) {
    i_searchString = searchText;

    Criteria criteria = new Criteria();
    criteria.addCriteria("searchText", searchText);
    criteria.addCriteria("codeSystem", codeSystem);
    criteria.addCriteria("codeSystemVersion", codeSystemVersion);

    i_valueSetItemSearchXmlDS.fetchData(
        criteria,
        new DSCallback() {

          @Override
          public void execute(DSResponse response, Object rawData, DSRequest request) {

            if ((response != null) && (response.getAttribute("reason") != null)) {
              setEmptyMessage("<b><font color=\"red\">" + ERROR_MESSAGE + "</font></b>");
            } else {
              setEmptyMessage(EMPTY_MESSAGE);
            }

            setData(new ListGridRecord[0]);
            fetchData();

            redraw();

            // let others know that the data has been retrieved.
            Cts2Editor.EVENT_BUS.fireEvent(new ValueSetItemsReceivedEvent());
          }
        });
  }
Exemplo n.º 2
0
  private static Criteria createCriteria(int groupId, int definitionId) {
    Criteria criteria = new Criteria();

    criteria.addCriteria(MeasurementDataTraitCriteria.FILTER_FIELD_GROUP_ID, groupId);
    criteria.addCriteria(MeasurementDataTraitCriteria.FILTER_FIELD_DEFINITION_ID, definitionId);

    return criteria;
  }
  // TODO move to a utility
  // SmartGWT 2.4's version of Criteria.addCriteria for some reason doesn't have else clauses for
  // the array types
  // and it doesn't handle Object types properly (seeing odd behavior because of this), so this
  // method explicitly
  // supports adding array types and Objects.
  // This method takes the src criteria and adds it to the dest criteria.
  public static void addCriteria(Criteria dest, Criteria src) {
    Map otherMap = src.getValues();
    Set otherKeys = otherMap.keySet();
    for (Iterator i = otherKeys.iterator(); i.hasNext(); ) {
      String field = (String) i.next();
      Object value = otherMap.get(field);

      if (value instanceof Integer) {
        dest.addCriteria(field, (Integer) value);
      } else if (value instanceof Float) {
        dest.addCriteria(field, (Float) value);
      } else if (value instanceof String) {
        dest.addCriteria(field, (String) value);
      } else if (value instanceof Date) {
        dest.addCriteria(field, (Date) value);
      } else if (value instanceof Boolean) {
        dest.addCriteria(field, (Boolean) value);
      } else if (value instanceof Integer[]) {
        dest.addCriteria(field, (Integer[]) value);
      } else if (value instanceof Double[]) {
        dest.addCriteria(field, (Double[]) value);
      } else if (value instanceof String[]) {
        dest.addCriteria(field, (String[]) value);
      } else {
        // this is the magic piece - we need to get attrib as an object and set that value
        dest.setAttribute(field, src.getAttributeAsObject(field));
      }
    }
  }
Exemplo n.º 4
0
  private void setResults(HashMap<String, ArrayList<ClSelectionItem>> result) {
    result = result == null ? new HashMap<String, ArrayList<ClSelectionItem>>() : result;
    addrComp = new AddressComponent(true, true, result.get("" + ClSelection.T_REGION));
    setSelectItems(siCustomerType, result.get("" + ClSelection.T_CUST_TYPE));

    addrComp.getSiRegion().setTitle("Region");
    addrComp.getSiSubregion().setTitle("Sub Region");
    addrComp.getSiCity().setTitle("City");
    addrComp.getSiStreet().setTitle("Street");
    biSaveData.setStartRow(false);
    biSaveData.setEndRow(false);
    FormItem[] items =
        new FormItem[] {
          addrComp.getSiRegion(),
          addrComp.getSiSubregion(),
          addrComp.getSiCity(),
          addrComp.getSiStreet(),
          siZones,
          siCustomerType,
          tiNewZone,
          biSaveData
        };
    dmCriteria.setFields(items);

    ChangedHandler addressChange =
        new ChangedHandler() {

          @Override
          public void onChanged(ChangedEvent event) {

            if (event.getItem().equals(addrComp.getSiRegion())
                || event.getItem().equals(addrComp.getSiSubregion())) {
              setZoneValue();
            }

            creteriaChanged();
          }
        };

    addrComp.getSiRegion().addChangedHandler(addressChange);
    addrComp.getSiSubregion().addChangedHandler(addressChange);
    addrComp.getSiCity().addChangedHandler(addressChange);
    addrComp.getSiStreet().addChangedHandler(addressChange);

    Criteria cr = new Criteria();
    addZoneCriteria(cr, addrComp.getSiRegion(), "regionid");
    cr.addCriteria("uniq", SC.generateID());
    siZones.setOptionCriteria(cr);
    setZoneValue();

    biSaveData.addClickHandler(
        new com.smartgwt.client.widgets.form.fields.events.ClickHandler() {

          @Override
          public void onClick(com.smartgwt.client.widgets.form.fields.events.ClickEvent event) {
            saveData();
          }
        });
  }
Exemplo n.º 5
0
 private void search() {
   Criteria cr = new Criteria();
   addZoneCriteria(cr, siZones, "zone");
   addZoneCriteria(cr, siCustomerType, "custypeid");
   addZoneCriteria(cr, addrComp.getSiStreet(), "streetid");
   cr.addCriteria("uniq", SC.generateID());
   lgCustomers.fetchData(cr);
 }
Exemplo n.º 6
0
  private void addZoneCriteria(Criteria cr, FormItem fi, String fieldName) {
    Long criteria = null;
    try {
      criteria = Long.parseLong(fi.getValue().toString());
    } catch (Exception e) {

    }
    if (criteria != null) cr.addCriteria(fieldName, criteria.toString());
  }
  public void findUsers() {
    Criteria findValues;

    String condition = searchForm.getValueAsString("searchCondition");
    String keyword = searchForm.getValueAsString("searchWord");

    /*
    System.out.println("condition ======> " + condition);
    System.out.println("keyword ======> " + keyword);
    */

    if ("User ID".equals(condition)) {
      findValues = searchForm.getValuesAsCriteria();
      findValues.addCriteria("userId", keyword);
    } else if ("User Name".equals(condition)) {
      findValues = searchForm.getValuesAsCriteria();
      findValues.addCriteria("userName", keyword);
    } else {
      findValues = searchForm.getValuesAsCriteria();
    }

    userList.filterData(findValues);
    userDetailTabPane.clearDetails();
  }
Exemplo n.º 8
0
  private void creteriaChanged() {
    siZones.setValue((Integer) null);
    Criteria cr = new Criteria();
    addZoneCriteria(cr, addrComp.getSiRegion(), "regionid");
    addZoneCriteria(cr, addrComp.getSiSubregion(), "subregionid");
    addZoneCriteria(cr, addrComp.getSiCity(), "cityid");
    addZoneCriteria(cr, addrComp.getSiStreet(), "streetid");
    cr.addCriteria("uniq", SC.generateID());
    siZones.setOptionCriteria(cr);
    siZones.fetchData(
        new DSCallback() {

          @Override
          public void execute(DSResponse response, Object rawData, DSRequest request) {
            if (response.getData() != null && response.getData().length > 0)
              siZones.setValue(response.getData()[0].getAttributeAsDouble(siZones.getValueField()));
          }
        });
  }