|
23 | 23 | import java.util.Map;
|
24 | 24 | import java.util.Set;
|
25 | 25 | import java.util.stream.Collectors;
|
| 26 | + |
| 27 | +import com.ctrip.framework.apollo.openapi.dto.OpenAppDTO; |
| 28 | +import com.ctrip.framework.apollo.openapi.dto.OpenAppNamespaceDTO; |
| 29 | +import com.ctrip.framework.apollo.openapi.dto.OpenClusterDTO; |
| 30 | +import com.ctrip.framework.apollo.openapi.dto.OpenGrayReleaseRuleDTO; |
| 31 | +import com.ctrip.framework.apollo.openapi.dto.OpenGrayReleaseRuleItemDTO; |
| 32 | +import com.ctrip.framework.apollo.openapi.dto.OpenItemDTO; |
| 33 | +import com.ctrip.framework.apollo.openapi.dto.OpenNamespaceDTO; |
| 34 | +import com.ctrip.framework.apollo.openapi.dto.OpenNamespaceLockDTO; |
| 35 | +import com.ctrip.framework.apollo.openapi.dto.OpenReleaseDTO; |
| 36 | +import com.ctrip.framework.apollo.openapi.dto.OpenOrganizationDto; |
| 37 | +import com.ctrip.framework.apollo.portal.entity.vo.Organization; |
26 | 38 | import org.springframework.util.CollectionUtils;
|
27 | 39 | import com.ctrip.framework.apollo.common.dto.ClusterDTO;
|
28 | 40 | import com.ctrip.framework.apollo.common.dto.GrayReleaseRuleDTO;
|
|
33 | 45 | import com.ctrip.framework.apollo.common.entity.App;
|
34 | 46 | import com.ctrip.framework.apollo.common.entity.AppNamespace;
|
35 | 47 | import com.ctrip.framework.apollo.common.utils.BeanUtils;
|
36 |
| -import com.ctrip.framework.apollo.openapi.dto.OpenAppDTO; |
37 |
| -import com.ctrip.framework.apollo.openapi.dto.OpenAppNamespaceDTO; |
38 |
| -import com.ctrip.framework.apollo.openapi.dto.OpenClusterDTO; |
39 |
| -import com.ctrip.framework.apollo.openapi.dto.OpenGrayReleaseRuleDTO; |
40 |
| -import com.ctrip.framework.apollo.openapi.dto.OpenGrayReleaseRuleItemDTO; |
41 |
| -import com.ctrip.framework.apollo.openapi.dto.OpenItemDTO; |
42 |
| -import com.ctrip.framework.apollo.openapi.dto.OpenNamespaceDTO; |
43 |
| -import com.ctrip.framework.apollo.openapi.dto.OpenNamespaceLockDTO; |
44 |
| -import com.ctrip.framework.apollo.openapi.dto.OpenReleaseDTO; |
45 | 48 | import com.ctrip.framework.apollo.portal.entity.bo.ItemBO;
|
46 | 49 | import com.ctrip.framework.apollo.portal.entity.bo.NamespaceBO;
|
47 | 50 | import com.google.common.base.Preconditions;
|
@@ -188,4 +191,16 @@ public static ClusterDTO transformToClusterDTO(OpenClusterDTO openClusterDTO) {
|
188 | 191 | Preconditions.checkArgument(openClusterDTO != null);
|
189 | 192 | return BeanUtils.transform(ClusterDTO.class, openClusterDTO);
|
190 | 193 | }
|
| 194 | + |
| 195 | + public static OpenOrganizationDto transformFromOrganization(final Organization organization){ |
| 196 | + Preconditions.checkArgument(organization != null); |
| 197 | + return BeanUtils.transform(OpenOrganizationDto.class, organization); |
| 198 | + } |
| 199 | + |
| 200 | + public static List<OpenOrganizationDto> transformFromOrganizations(final List<Organization> organizations){ |
| 201 | + if (CollectionUtils.isEmpty(organizations)) { |
| 202 | + return Collections.emptyList(); |
| 203 | + } |
| 204 | + return organizations.stream().map(OpenApiBeanUtils::transformFromOrganization).collect(Collectors.toList()); |
| 205 | + } |
191 | 206 | }
|
0 commit comments