Search in sources :

Example 1 with GroupIdDTO

use of org.wso2.carbon.apimgt.internal.service.dto.GroupIdDTO in project carbon-apimgt by wso2.

the class SubscriptionValidationDataUtil method fromApplicationToApplicationListDTO.

public static ApplicationListDTO fromApplicationToApplicationListDTO(List<Application> model) {
    ApplicationListDTO applicationListDTO = new ApplicationListDTO();
    if (model != null) {
        for (Application appModel : model) {
            ApplicationDTO applicationDTO = new ApplicationDTO();
            applicationDTO.setUuid(appModel.getUuid());
            applicationDTO.setId(appModel.getId());
            applicationDTO.setName(appModel.getName());
            applicationDTO.setPolicy(appModel.getPolicy());
            applicationDTO.setSubName(appModel.getSubName());
            applicationDTO.setTokenType(appModel.getTokenType());
            applicationDTO.setOrganization(appModel.getOrganization());
            Set<String> groupIds = appModel.getGroupIds();
            for (String grp : groupIds) {
                GroupIdDTO groupIdDTO = new GroupIdDTO();
                groupIdDTO.setApplicationId(appModel.getId());
                groupIdDTO.setGroupId(grp);
                applicationDTO.getGroupIds().add(groupIdDTO);
            }
            Map<String, String> attributes = appModel.getAttributes();
            applicationDTO.setAttributes(attributes);
            applicationListDTO.getList().add(applicationDTO);
        }
        applicationListDTO.setCount(model.size());
    } else {
        applicationListDTO.setCount(0);
    }
    return applicationListDTO;
}
Also used : GroupIdDTO(org.wso2.carbon.apimgt.internal.service.dto.GroupIdDTO) ApplicationDTO(org.wso2.carbon.apimgt.internal.service.dto.ApplicationDTO) Application(org.wso2.carbon.apimgt.api.model.subscription.Application) ApplicationListDTO(org.wso2.carbon.apimgt.internal.service.dto.ApplicationListDTO)

Aggregations

Application (org.wso2.carbon.apimgt.api.model.subscription.Application)1 ApplicationDTO (org.wso2.carbon.apimgt.internal.service.dto.ApplicationDTO)1 ApplicationListDTO (org.wso2.carbon.apimgt.internal.service.dto.ApplicationListDTO)1 GroupIdDTO (org.wso2.carbon.apimgt.internal.service.dto.GroupIdDTO)1