Search in sources :

Example 1 with MonetizationAttributeDTO

use of org.wso2.carbon.apimgt.rest.api.publisher.v1.dto.MonetizationAttributeDTO in project carbon-apimgt by wso2.

the class SettingsMappingUtil method getMonetizationAttributes.

/**
 * This method returns the monetization properties from configuration.
 *
 * @return List<String> monetization properties
 * @throws APIManagementException
 */
private List<MonetizationAttributeDTO> getMonetizationAttributes() {
    List<MonetizationAttributeDTO> monetizationAttributeDTOSList = new ArrayList<MonetizationAttributeDTO>();
    JSONArray monetizationAttributes = APIUtil.getMonetizationAttributes();
    for (int i = 0; i < monetizationAttributes.size(); i++) {
        JSONObject monetizationAttribute = (JSONObject) monetizationAttributes.get(i);
        MonetizationAttributeDTO monetizationAttributeDTO = new MonetizationAttributeDTO();
        monetizationAttributeDTO.setName((String) monetizationAttribute.get(APIConstants.Monetization.ATTRIBUTE));
        monetizationAttributeDTO.setDisplayName((String) monetizationAttribute.get(APIConstants.Monetization.ATTRIBUTE_DISPLAY_NAME));
        monetizationAttributeDTO.setDescription((String) monetizationAttribute.get(APIConstants.Monetization.ATTRIBUTE_DESCRIPTION));
        monetizationAttributeDTO.setRequired((Boolean) monetizationAttribute.get(APIConstants.Monetization.IS_ATTRIBITE_REQUIRED));
        monetizationAttributeDTO.setHidden((Boolean) monetizationAttribute.get(APIConstants.Monetization.IS_ATTRIBUTE_HIDDEN));
        monetizationAttributeDTOSList.add(monetizationAttributeDTO);
    }
    return monetizationAttributeDTOSList;
}
Also used : JSONObject(org.json.simple.JSONObject) MonetizationAttributeDTO(org.wso2.carbon.apimgt.rest.api.publisher.v1.dto.MonetizationAttributeDTO) ArrayList(java.util.ArrayList) JSONArray(org.json.simple.JSONArray)

Aggregations

ArrayList (java.util.ArrayList)1 JSONArray (org.json.simple.JSONArray)1 JSONObject (org.json.simple.JSONObject)1 MonetizationAttributeDTO (org.wso2.carbon.apimgt.rest.api.publisher.v1.dto.MonetizationAttributeDTO)1