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.util.List;
20  import java.util.stream.Collectors;
21  
22  import com.linecorp.centraldogma.internal.thrift.SchemaEntry;
23  
24  public class SchemaEntryDto {
25      private String repositoryName;
26      private String path;
27      private PropertyFilterDto propertyFilter;
28      private List<String> types;
29      private CommentDto comment;
30  
31      public SchemaEntryDto() {}
32  
33      public SchemaEntryDto(SchemaEntry schemaEntry) {
34          repositoryName = schemaEntry.getRepositoryName();
35          path = schemaEntry.getPath();
36          propertyFilter = new PropertyFilterDto(schemaEntry.getPropertyFilter());
37          types = schemaEntry.getTypes().stream().map(Enum::name).collect(Collectors.toList());
38          if (schemaEntry.getComment() != null) {
39              comment = new CommentDto(schemaEntry.getComment());
40          }
41      }
42  
43      public String getRepositoryName() {
44          return repositoryName;
45      }
46  
47      public void setRepositoryName(String repositoryName) {
48          this.repositoryName = repositoryName;
49      }
50  
51      public String getPath() {
52          return path;
53      }
54  
55      public void setPath(String path) {
56          this.path = path;
57      }
58  
59      public PropertyFilterDto getPropertyFilter() {
60          return propertyFilter;
61      }
62  
63      public void setPropertyFilter(PropertyFilterDto propertyFilter) {
64          this.propertyFilter = propertyFilter;
65      }
66  
67      public List<String> getTypes() {
68          return types;
69      }
70  
71      public void setTypes(List<String> types) {
72          this.types = types;
73      }
74  
75      public CommentDto getComment() {
76          return comment;
77      }
78  
79      public void setComment(CommentDto comment) {
80          this.comment = comment;
81      }
82  }