Search in sources :

Example 1 with SettingOptions

use of org.motechproject.mds.dto.SettingOptions in project motech by motech.

the class FieldSetting method toDto.

public SettingDto toDto() {
    List<SettingOptions> options = new ArrayList<>();
    if (details.getTypeSettingOptions() != null) {
        for (TypeSettingOption option : details.getTypeSettingOptions()) {
            options.add(SettingOptions.valueOf(option.getName()));
        }
    }
    Type valueType = details.getValueType();
    SettingDto dto = new SettingDto();
    dto.setType(valueType.toDto());
    dto.setValue(valueType.parse(value));
    dto.setName(details.getName());
    dto.setOptions(options);
    return dto;
}
Also used : IdentityType(javax.jdo.annotations.IdentityType) SettingOptions(org.motechproject.mds.dto.SettingOptions) ArrayList(java.util.ArrayList) SettingDto(org.motechproject.mds.dto.SettingDto)

Aggregations

ArrayList (java.util.ArrayList)1 IdentityType (javax.jdo.annotations.IdentityType)1 SettingDto (org.motechproject.mds.dto.SettingDto)1 SettingOptions (org.motechproject.mds.dto.SettingOptions)1