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 = "resource" ) 031@Schema(name="Resource", description = "Resource where permissions are applied to") 032public class Resource 033 implements Serializable 034{ 035 private static final long serialVersionUID = -4597120682491493340L; 036 private String identifier; 037 038 private boolean pattern; 039 040 private boolean permanent; 041 042 public Resource() 043 { 044 // no op 045 } 046 047 public Resource( org.apache.archiva.redback.rbac.Resource resource ) 048 { 049 this.identifier = resource.getIdentifier(); 050 this.pattern = resource.isPattern(); 051 this.permanent = resource.isPermanent(); 052 } 053 054 @Schema(name="identifier", description = "Identifier of the resource") 055 public String getIdentifier() 056 { 057 return identifier; 058 } 059 060 public void setIdentifier( String identifier ) 061 { 062 this.identifier = identifier; 063 } 064 065 @Schema(name="pattern", description = "True, if this resource is just a pattern") 066 public boolean isPattern() 067 { 068 return pattern; 069 } 070 071 public void setPattern( boolean pattern ) 072 { 073 this.pattern = pattern; 074 } 075 076 @Schema(name="permanent", description = "True, if this resource is permanent") 077 public boolean isPermanent() 078 { 079 return permanent; 080 } 081 082 public void setPermanent( boolean permanent ) 083 { 084 this.permanent = permanent; 085 } 086 087 @Override 088 public String toString() 089 { 090 final StringBuilder sb = new StringBuilder(); 091 sb.append( "Resource" ); 092 sb.append( "{identifier='" ).append( identifier ).append( '\'' ); 093 sb.append( ", pattern=" ).append( pattern ); 094 sb.append( ", permanent=" ).append( permanent ); 095 sb.append( '}' ); 096 return sb.toString(); 097 } 098}