1   /*
2    * Copyright 2017 LINE Corporation
3    *
4    * LINE Corporation licenses this file to you under the Apache License,
5    * version 2.0 (the "License"); you may not use this file except in compliance
6    * with the License. You may obtain a copy of the License at:
7    *
8    *   https://www.apache.org/licenses/LICENSE-2.0
9    *
10   * Unless required by applicable law or agreed to in writing, software
11   * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
12   * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
13   * License for the specific language governing permissions and limitations
14   * under the License.
15   */
16  
17  package com.linecorp.centraldogma.server.internal.admin.dto;
18  
19  import java.io.Serializable;
20  import java.util.ArrayList;
21  import java.util.List;
22  import java.util.stream.Collectors;
23  
24  import com.linecorp.centraldogma.internal.thrift.Project;
25  
26  public class ProjectDto implements Serializable {
27  
28      private static final long serialVersionUID = -537677643104565582L;
29  
30      private String name;
31      private SchemaDto schema;
32      private List<PluginDto> plugins = new ArrayList<>();
33  
34      public ProjectDto() {}
35  
36      public ProjectDto(Project project) {
37          name = project.getName();
38          if (project.getSchema() != null) {
39              schema = new SchemaDto(project.getSchema());
40          }
41          if (project.getPlugins() != null) {
42              plugins = project.getPlugins().stream().map(PluginDto::new).collect(Collectors.toList());
43          }
44      }
45  
46      public String getName() {
47          return name;
48      }
49  
50      public void setName(String name) {
51          this.name = name;
52      }
53  
54      public SchemaDto getSchema() {
55          return schema;
56      }
57  
58      public void setSchema(SchemaDto schema) {
59          this.schema = schema;
60      }
61  
62      public List<PluginDto> getPlugins() {
63          return plugins;
64      }
65  
66      public void setPlugins(List<PluginDto> plugins) {
67          this.plugins = plugins;
68      }
69  }