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;
}
Aggregations