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 javax.annotation.Nullable;
20  
21  import com.fasterxml.jackson.annotation.JsonIgnoreProperties;
22  import com.google.common.base.MoreObjects;
23  
24  @JsonIgnoreProperties(ignoreUnknown = true)
25  public class EntryDto {
26  
27      @Nullable
28      private String revision;
29      @Nullable
30      private String path;
31      @Nullable
32      private String type;
33      @Nullable
34      private String content;
35  
36      @Nullable
37      public String getRevision() {
38          return revision;
39      }
40  
41      public void setRevision(@Nullable String revision) {
42          this.revision = revision;
43      }
44  
45      @Nullable
46      public String getPath() {
47          return path;
48      }
49  
50      public void setPath(@Nullable String path) {
51          this.path = path;
52      }
53  
54      @Nullable
55      public String getName() {
56          if (path == null) {
57              return null;
58          } else {
59              return path.substring(path.lastIndexOf('/') + 1);
60          }
61      }
62  
63      @Nullable
64      public String getType() {
65          return type;
66      }
67  
68      public void setType(@Nullable String type) {
69          this.type = type;
70      }
71  
72      @Nullable
73      public String getContent() {
74          return content;
75      }
76  
77      public void setContent(@Nullable String content) {
78          this.content = content;
79      }
80  
81      @Override
82      public String toString() {
83          return MoreObjects.toStringHelper(this)
84                            .add("revision", revision)
85                            .add("path", path)
86                            .add("type", type)
87                            .add("content", content)
88                            .toString();
89      }
90  }