Line data Source code
1 : // Copyright (C) 2008 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.entities; 16 : 17 : import static java.util.Objects.requireNonNull; 18 : 19 : import java.util.List; 20 : import org.eclipse.jgit.lib.AnyObjectId; 21 : import org.eclipse.jgit.lib.ObjectId; 22 : 23 : /** Additional data about a {@link PatchSet} not normally loaded. */ 24 : public final class PatchSetInfo { 25 : public static class ParentInfo { 26 : public ObjectId commitId; 27 : public String shortMessage; 28 : 29 85 : public ParentInfo(AnyObjectId commitId, String shortMessage) { 30 85 : this.commitId = commitId.copy(); 31 85 : this.shortMessage = requireNonNull(shortMessage); 32 85 : } 33 : 34 0 : ParentInfo() {} 35 : } 36 : 37 : private PatchSet.Id key; 38 : 39 : /** First line of {@link #message}. */ 40 : private String subject; 41 : 42 : /** The complete description of the change the patch set introduces. */ 43 : private String message; 44 : 45 : /** Identity of who wrote the patch set. May differ from {@link #committer}. */ 46 : private UserIdentity author; 47 : 48 : /** Identity of who committed the patch set to the VCS. */ 49 : private UserIdentity committer; 50 : 51 : /** List of parents of the patch set. */ 52 : private List<ParentInfo> parents; 53 : 54 : /** ID of commit. */ 55 : private ObjectId commitId; 56 : 57 : /** Optional user-supplied description for the patch set. */ 58 : private String description; 59 : 60 0 : PatchSetInfo() {} 61 : 62 104 : public PatchSetInfo(PatchSet.Id k) { 63 104 : key = k; 64 104 : } 65 : 66 : public PatchSet.Id getKey() { 67 104 : return key; 68 : } 69 : 70 : public String getSubject() { 71 104 : return subject; 72 : } 73 : 74 : public void setSubject(String s) { 75 104 : if (s != null && s.length() > 255) { 76 1 : subject = s.substring(0, 255); 77 : } else { 78 104 : subject = s; 79 : } 80 104 : } 81 : 82 : public String getMessage() { 83 103 : return message; 84 : } 85 : 86 : public void setMessage(String m) { 87 103 : message = m; 88 103 : } 89 : 90 : public UserIdentity getAuthor() { 91 103 : return author; 92 : } 93 : 94 : public void setAuthor(UserIdentity u) { 95 103 : author = u; 96 103 : } 97 : 98 : public UserIdentity getCommitter() { 99 103 : return committer; 100 : } 101 : 102 : public void setCommitter(UserIdentity u) { 103 103 : committer = u; 104 103 : } 105 : 106 : public void setParents(List<ParentInfo> p) { 107 87 : parents = p; 108 87 : } 109 : 110 : public List<ParentInfo> getParents() { 111 0 : return parents; 112 : } 113 : 114 : public void setCommitId(AnyObjectId commitId) { 115 103 : this.commitId = commitId.copy(); 116 103 : } 117 : 118 : public ObjectId getCommitId() { 119 103 : return commitId; 120 : } 121 : 122 : public void setDescription(String description) { 123 0 : this.description = description; 124 0 : } 125 : 126 : public String getDescription() { 127 0 : return description; 128 : } 129 : }