Line data Source code
1 : // Copyright (C) 2014 The Android Open Source Project
2 : //
3 : // Licensed under the Apache License, Version 2.0 (the "License");
4 : // you may not use this file except in compliance with the License.
5 : // You may obtain a copy of the License at
6 : //
7 : // http://www.apache.org/licenses/LICENSE-2.0
8 : //
9 : // Unless required by applicable law or agreed to in writing, software
10 : // distributed under the License is distributed on an "AS IS" BASIS,
11 : // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12 : // See the License for the specific language governing permissions and
13 : // limitations under the License.
14 :
15 : package com.google.gerrit.extensions.api.projects;
16 :
17 : import com.google.gerrit.common.Nullable;
18 : import com.google.gerrit.extensions.common.GitPerson;
19 : import com.google.gerrit.extensions.common.WebLinkInfo;
20 : import java.sql.Timestamp;
21 : import java.time.Instant;
22 : import java.util.List;
23 :
24 : public class TagInfo extends RefInfo {
25 : public String object;
26 : public String message;
27 : public GitPerson tagger;
28 :
29 : // TODO(issue-15508): Migrate timestamp fields in *Info/*Input classes from type Timestamp to
30 : // Instant
31 : public Timestamp created;
32 :
33 : public List<WebLinkInfo> webLinks;
34 :
35 : public TagInfo(
36 : String ref,
37 : String revision,
38 : Boolean canDelete,
39 : List<WebLinkInfo> webLinks,
40 0 : Timestamp created) {
41 0 : this.ref = ref;
42 0 : this.revision = revision;
43 0 : this.canDelete = canDelete;
44 0 : this.webLinks = webLinks;
45 0 : this.created = created;
46 0 : }
47 :
48 : @SuppressWarnings("JdkObsolete")
49 : public TagInfo(
50 : String ref,
51 : String revision,
52 : Boolean canDelete,
53 : List<WebLinkInfo> webLinks,
54 7 : @Nullable Instant created) {
55 7 : this.ref = ref;
56 7 : this.revision = revision;
57 7 : this.canDelete = canDelete;
58 7 : this.webLinks = webLinks;
59 7 : this.created = created != null ? Timestamp.from(created) : null;
60 7 : }
61 :
62 : public TagInfo(String ref, String revision, Boolean canDelete, List<WebLinkInfo> webLinks) {
63 0 : this(ref, revision, canDelete, webLinks, (Instant) null);
64 0 : }
65 :
66 : public TagInfo(
67 : String ref,
68 : String revision,
69 : String object,
70 : String message,
71 : GitPerson tagger,
72 : Boolean canDelete,
73 : List<WebLinkInfo> webLinks,
74 : Timestamp created) {
75 0 : this(ref, revision, canDelete, webLinks, created);
76 0 : this.object = object;
77 0 : this.message = message;
78 0 : this.tagger = tagger;
79 0 : this.webLinks = webLinks;
80 0 : }
81 :
82 : public TagInfo(
83 : String ref,
84 : String revision,
85 : String object,
86 : String message,
87 : GitPerson tagger,
88 : Boolean canDelete,
89 : List<WebLinkInfo> webLinks,
90 : Instant created) {
91 2 : this(ref, revision, canDelete, webLinks, created);
92 2 : this.object = object;
93 2 : this.message = message;
94 2 : this.tagger = tagger;
95 2 : this.webLinks = webLinks;
96 2 : }
97 :
98 : public TagInfo(
99 : String ref,
100 : String revision,
101 : String object,
102 : String message,
103 : GitPerson tagger,
104 : Boolean canDelete,
105 : List<WebLinkInfo> webLinks) {
106 0 : this(ref, revision, object, message, tagger, canDelete, webLinks, (Instant) null);
107 0 : this.object = object;
108 0 : this.message = message;
109 0 : this.tagger = tagger;
110 0 : this.webLinks = webLinks;
111 0 : }
112 : }
|