Line data Source code
1 : // Copyright (C) 2017 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 com.google.auto.value.AutoValue; 18 : import com.google.common.collect.ImmutableSet; 19 : import com.google.gerrit.common.Nullable; 20 : import java.io.Serializable; 21 : import java.time.Instant; 22 : import org.eclipse.jgit.lib.ObjectId; 23 : 24 : @AutoValue 25 153 : public abstract class InternalGroup implements Serializable { 26 : private static final long serialVersionUID = 1L; 27 : 28 : public abstract AccountGroup.Id getId(); 29 : 30 : public String getName() { 31 153 : return getNameKey().get(); 32 : } 33 : 34 : public abstract AccountGroup.NameKey getNameKey(); 35 : 36 : @Nullable 37 : public abstract String getDescription(); 38 : 39 : public abstract AccountGroup.UUID getOwnerGroupUUID(); 40 : 41 : public abstract boolean isVisibleToAll(); 42 : 43 : public abstract AccountGroup.UUID getGroupUUID(); 44 : 45 : public abstract Instant getCreatedOn(); 46 : 47 : public abstract ImmutableSet<Account.Id> getMembers(); 48 : 49 : public abstract ImmutableSet<AccountGroup.UUID> getSubgroups(); 50 : 51 : @Nullable 52 : public abstract ObjectId getRefState(); 53 : 54 : public abstract Builder toBuilder(); 55 : 56 : public static Builder builder() { 57 153 : return new AutoValue_InternalGroup.Builder(); 58 : } 59 : 60 : @AutoValue.Builder 61 153 : public abstract static class Builder { 62 : public abstract Builder setId(AccountGroup.Id id); 63 : 64 : public abstract Builder setNameKey(AccountGroup.NameKey name); 65 : 66 : public abstract Builder setDescription(@Nullable String description); 67 : 68 : public abstract Builder setOwnerGroupUUID(AccountGroup.UUID ownerGroupUuid); 69 : 70 : public abstract Builder setVisibleToAll(boolean visibleToAll); 71 : 72 : public abstract Builder setGroupUUID(AccountGroup.UUID groupUuid); 73 : 74 : public abstract Builder setCreatedOn(Instant createdOn); 75 : 76 : public abstract Builder setMembers(ImmutableSet<Account.Id> members); 77 : 78 : public abstract Builder setSubgroups(ImmutableSet<AccountGroup.UUID> subgroups); 79 : 80 : public abstract Builder setRefState(ObjectId refState); 81 : 82 : public abstract InternalGroup build(); 83 : } 84 : }