Esempio n. 1
0
  public DataElement getDataElement(org.hisp.dhis.dataelement.DataElement dataElement) {
    DataElement de = new DataElement();
    de.setId(dataElement.getId());
    de.setName(dataElement.getFormNameFallback());
    de.setType(dataElement.getType());

    de.setCategoryOptionCombos(getCategoryOptionCombos(dataElement));

    // Limit the optionset transfer to the client
    if (dataElement.getOptionSet() != null
        && dataElement.getOptionSet().getOptions().size() <= 50) {
      de.setOptionSet(getOptionSet(dataElement));
    }

    return de;
  }
Esempio n. 2
0
  public OptionSet getOptionSet(org.hisp.dhis.dataelement.DataElement dataElement) {
    org.hisp.dhis.option.OptionSet dhisOptionSet = dataElement.getOptionSet();
    OptionSet mobileOptionSet = new OptionSet();
    if (dhisOptionSet != null) {
      mobileOptionSet.setId(dhisOptionSet.getId());
      mobileOptionSet.setName(dhisOptionSet.getName());
      mobileOptionSet.setOptions(dhisOptionSet.getOptions());
    } else {
      return null;
    }

    return mobileOptionSet;
  }