001package org.apache.archiva.redback.rest.api.model.v2; 002/* 003 * Licensed to the Apache Software Foundation (ASF) under one 004 * or more contributor license agreements. See the NOTICE file 005 * distributed with this work for additional information 006 * regarding copyright ownership. The ASF licenses this file 007 * to you under the Apache License, Version 2.0 (the 008 * "License"); you may not use this file except in compliance 009 * with the License. You may obtain a copy of the License at 010 * 011 * http://www.apache.org/licenses/LICENSE-2.0 012 * 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; 025 026/** 027 * @author Olivier Lamy 028 * @since 1.4 029 */ 030@XmlRootElement( name = "operation" ) 031@Schema(name="Operation", description = "Operation assigned to a permission") 032public class Operation 033 implements Serializable 034{ 035 private static final long serialVersionUID = 3666638961610656624L; 036 037 private String name; 038 039 private String description; 040 041 private String descriptionKey; 042 043 private boolean permanent; 044 045 public Operation() 046 { 047 // no op 048 } 049 050 public Operation( org.apache.archiva.redback.rbac.Operation operation ) 051 { 052 this.name = operation.getName(); 053 this.description = operation.getDescription(); 054 this.permanent = operation.isPermanent(); 055 } 056 057 @Schema(description = "The operation name") 058 public String getName() 059 { 060 return name; 061 } 062 063 public void setName( String name ) 064 { 065 this.name = name; 066 } 067 068 @Schema(description = "The description of the operation") 069 public String getDescription() 070 { 071 return description; 072 } 073 074 public void setDescription( String description ) 075 { 076 this.description = description; 077 } 078 079 @Schema(description = "True, if this operation is permanent") 080 public boolean isPermanent() 081 { 082 return permanent; 083 } 084 085 public void setPermanent( boolean permanent ) 086 { 087 this.permanent = permanent; 088 } 089 090 @Override 091 public String toString() 092 { 093 final StringBuilder sb = new StringBuilder(); 094 sb.append( "Operation" ); 095 sb.append( "{name='" ).append( name ).append( '\'' ); 096 sb.append( ", description='" ).append( description ).append( '\'' ); 097 sb.append( ", permanent=" ).append( permanent ); 098 sb.append( '}' ); 099 return sb.toString(); 100 } 101 102 @Schema(name="description_key",description = "The language key for the description") 103 public String getDescriptionKey( ) 104 { 105 return descriptionKey; 106 } 107 108 public void setDescriptionKey( String descriptionKey ) 109 { 110 this.descriptionKey = descriptionKey; 111 } 112}