001package org.apache.archiva.redback.rest.api.model.v2;
002
003/*
004 * Licensed to the Apache Software Foundation (ASF) under one
005 * or more contributor license agreements.  See the NOTICE file
006 * distributed with this work for additional information
007 * regarding copyright ownership.  The ASF licenses this file
008 * to you under the Apache License, Version 2.0 (the
009 * "License"); you may not use this file except in compliance
010 * with the License.  You may obtain a copy of the License at
011 *
012 * http://www.apache.org/licenses/LICENSE-2.0
013 * Unless required by applicable law or agreed to in writing,
014 * software distributed under the License is distributed on an
015 * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
016 * KIND, either express or implied.  See the License for the
017 * specific language governing permissions and limitations
018 * under the License.
019 */
020
021import io.swagger.v3.oas.annotations.media.Schema;
022
023import javax.xml.bind.annotation.XmlRootElement;
024import java.io.Serializable;
025import java.util.ArrayList;
026import java.util.List;
027
028/**
029 * REST API Version 2 group element
030 * @author Martin Stockhammer <martin_s@apache.org>
031 * @since 3.0
032 */
033@XmlRootElement(name="group")
034@Schema(name="Group", description = "Group object")
035public class Group implements Serializable
036{
037    private static final long serialVersionUID = -1842878251787304632L;
038    String name;
039    String uniqueName;
040    String description;
041    List<String> memberList;
042
043    public Group() {
044
045    }
046
047    public Group( String name )
048    {
049        this.name = name;
050    }
051
052    @Schema(description = "The name of the group")
053    public String getName( )
054    {
055        return name;
056    }
057
058    public void setName( String name )
059    {
060        this.name = name;
061    }
062
063    @Schema(name="unique_name", description = "The unique name of the group. Depends on the backend repository, e.g. the LDAP DN.")
064    public String getUniqueName( )
065    {
066        return uniqueName;
067    }
068
069    public void setUniqueName( String uniqueName )
070    {
071        this.uniqueName = uniqueName;
072    }
073
074    @Schema( description = "The group description, if available" )
075    public String getDescription( )
076    {
077        return description;
078    }
079
080    public void setDescription( String description )
081    {
082        this.description = description;
083    }
084
085    @Schema(name="member_list", description = "The list of members. The format of the member strings depends on the backend repository, e.g. for LDAP these may be the member DNs")
086    public List<String> getMemberList( )
087    {
088        return memberList;
089    }
090
091    public void setMemberList( List<String> memberList )
092    {
093        this.memberList = memberList;
094    }
095
096    public void addMember(String member) {
097        if (this.memberList==null) {
098            this.memberList = new ArrayList<>( );
099        }
100        this.memberList.add( member );
101    }
102}