Search in sources :

Example 1 with ModelList

use of org.hisp.dhis.api.mobile.model.ModelList in project dhis2-core by dhis2.

the class ModelMapping method getCategoryOptionCombos.

public static ModelList getCategoryOptionCombos(org.hisp.dhis.dataelement.DataElement dataElement) {
    ModelList deCateOptCombo = new ModelList();
    List<Model> listCateOptCombo = new ArrayList<>();
    deCateOptCombo.setModels(listCateOptCombo);
    for (DataElementCategoryOptionCombo oneCatOptCombo : dataElement.getSortedCategoryOptionCombos()) {
        Model oneCateOptCombo = new Model();
        oneCateOptCombo.setId(oneCatOptCombo.getId());
        oneCateOptCombo.setName(oneCatOptCombo.getName());
        listCateOptCombo.add(oneCateOptCombo);
    }
    return deCateOptCombo;
}
Also used : ModelList(org.hisp.dhis.api.mobile.model.ModelList) ArrayList(java.util.ArrayList) Model(org.hisp.dhis.api.mobile.model.Model) DataElementCategoryOptionCombo(org.hisp.dhis.dataelement.DataElementCategoryOptionCombo)

Example 2 with ModelList

use of org.hisp.dhis.api.mobile.model.ModelList in project dhis2-core by dhis2.

the class ProgramStageDataElement method deSerialize.

@Override
public void deSerialize(DataInputStream dint) throws IOException {
    super.deSerialize(dint);
    this.setType(dint.readUTF());
    if (dint.readBoolean()) {
        this.setNumberType(dint.readUTF());
    } else {
        this.setNumberType(null);
    }
    this.setCompulsory(dint.readBoolean());
    this.categoryOptionCombos = new ModelList();
    this.categoryOptionCombos.deSerialize(dint);
    if (dint.readBoolean() == false) {
        this.optionSet = null;
    } else {
        this.optionSet = new OptionSet();
        this.optionSet.deSerialize(dint);
    }
    if (dint.readBoolean() == false) {
        this.setValue(null);
    } else {
        this.setValue(dint.readUTF());
    }
}
Also used : ModelList(org.hisp.dhis.api.mobile.model.ModelList) OptionSet(org.hisp.dhis.api.mobile.model.OptionSet)

Aggregations

ModelList (org.hisp.dhis.api.mobile.model.ModelList)2 ArrayList (java.util.ArrayList)1 Model (org.hisp.dhis.api.mobile.model.Model)1 OptionSet (org.hisp.dhis.api.mobile.model.OptionSet)1 DataElementCategoryOptionCombo (org.hisp.dhis.dataelement.DataElementCategoryOptionCombo)1