Search in sources :

Example 1 with ServiceDTO

use of org.apache.dubbo.admin.model.dto.ServiceDTO in project incubator-dubbo-ops by apache.

the class ProviderServiceImpl method convertProviders2DTO.

/**
 * Convert provider list to ServiceDTO list
 *
 * @param providers list of providers
 * @return ServiceDTO list of front page
 */
public Set<ServiceDTO> convertProviders2DTO(List<Provider> providers) {
    Set<ServiceDTO> result = new TreeSet<>();
    for (Provider provider : providers) {
        String app = provider.getApplication();
        String service = provider.getService();
        String group = Tool.getGroup(service);
        String version = Tool.getVersion(service);
        String interfaze = Tool.getInterface(service);
        ServiceDTO s = new ServiceDTO();
        s.setAppName(app);
        s.setService(interfaze);
        s.setGroup(group);
        s.setVersion(version);
        s.setRegistrySource(provider.getRegistrySource());
        result.add(s);
    }
    return result;
}
Also used : TreeSet(java.util.TreeSet) ServiceDTO(org.apache.dubbo.admin.model.dto.ServiceDTO) Provider(org.apache.dubbo.admin.model.domain.Provider)

Aggregations

TreeSet (java.util.TreeSet)1 Provider (org.apache.dubbo.admin.model.domain.Provider)1 ServiceDTO (org.apache.dubbo.admin.model.dto.ServiceDTO)1