001package org.apache.archiva.redback.rest.api.model.v2;/*
002 * Licensed to the Apache Software Foundation (ASF) under one
003 * or more contributor license agreements.  See the NOTICE file
004 * distributed with this work for additional information
005 * regarding copyright ownership.  The ASF licenses this file
006 * to you under the Apache License, Version 2.0 (the
007 * "License"); you may not use this file except in compliance
008 * with the License.  You may obtain a copy of the License at
009 *
010 * http://www.apache.org/licenses/LICENSE-2.0
011 * Unless required by applicable law or agreed to in writing,
012 * software distributed under the License is distributed on an
013 * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
014 * KIND, either express or implied.  See the License for the
015 * specific language governing permissions and limitations
016 * under the License.
017 */
018
019import io.swagger.v3.oas.annotations.media.Schema;
020
021import java.io.Serializable;
022import java.util.ArrayList;
023import java.util.List;
024
025/**
026 * This class is used for role update. Contains only the role attributes, that can be updated.
027 *
028 * @author Martin Stockhammer <martin_s@apache.org>
029 */
030@Schema(name="Role",description="Role attributes that are used for updating a role")
031public class Role implements Serializable
032{
033    private static final long serialVersionUID = 3238571295658509062L;
034
035    protected String name;
036    protected String id;
037    protected String description;
038    protected Boolean permanent;
039    protected Boolean assignable;
040
041    /**
042     * The ids of all the assigned users.
043     */
044    protected List<BaseUserInfo> assignedUsers = new ArrayList<>( 0 );
045
046    @Schema(description = "The role name")
047    public String getName()
048    {
049        return name;
050    }
051
052    public void setName( String name )
053    {
054        this.name = name;
055    }
056
057    @Schema( description = "A description of the role" )
058    public String getDescription( )
059    {
060        return description;
061    }
062
063    public void setDescription( String description )
064    {
065        this.description = description;
066    }
067
068    @Schema( description = "True, if this role cannot be deleted.")
069    public Boolean isPermanent()
070    {
071        return permanent;
072    }
073
074    @Schema( description = "True, if this role can be assigned" )
075    public Boolean isAssignable( )
076    {
077        return assignable;
078    }
079
080
081    @Schema(description = "The identifier of this role")
082    public String getId( )
083    {
084        return id;
085    }
086
087    public void setId( String id )
088    {
089        this.id = id;
090    }
091
092    @Schema( description = "List of user ids that are assigned to this role.")
093    public List<BaseUserInfo> getAssignedUsers( )
094    {
095        return assignedUsers;
096    }
097
098    public void setAssignedUsers( List<BaseUserInfo> assignedUsers )
099    {
100        this.assignedUsers = assignedUsers;
101    }
102
103    public void addAssignedUser( BaseUserInfo id) {
104        this.assignedUsers.add( id );
105    }
106
107
108    public Boolean getPermanent( )
109    {
110        return permanent;
111    }
112
113    public void setPermanent( Boolean permanent )
114    {
115        this.permanent = permanent;
116    }
117
118
119    public void setAssignable( Boolean assignable )
120    {
121        this.assignable = assignable;
122    }
123}