001package org.apache.archiva.redback.rbac.memory; 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 * 014 * Unless required by applicable law or agreed to in writing, 015 * software distributed under the License is distributed on an 016 * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY 017 * KIND, either express or implied. See the License for the 018 * specific language governing permissions and limitations 019 * under the License. 020 */ 021 022import org.apache.archiva.redback.rbac.Resource; 023 024/** 025 * MemoryResource 026 * 027 * @author <a href="mailto:joakim@erdfelt.com">Joakim Erdfelt</a> 028 * 029 */ 030public class MemoryResource 031 implements Resource, java.io.Serializable 032{ 033 /** 034 * Field identifier 035 */ 036 private String identifier; 037 038 /** 039 * Field pattern 040 */ 041 private boolean pattern = false; 042 043 /** 044 * Field permanent 045 */ 046 private boolean permanent = false; 047 048 /** 049 * Method equals 050 * 051 * @param other 052 */ 053 public boolean equals( Object other ) 054 { 055 if ( this == other ) 056 { 057 return true; 058 } 059 060 if ( !( other instanceof MemoryResource ) ) 061 { 062 return false; 063 } 064 065 MemoryResource that = (MemoryResource) other; 066 boolean result = true; 067 result = result 068 && ( getIdentifier() == null ? that.getIdentifier() == null : getIdentifier().equals( that.getIdentifier() ) ); 069 return result; 070 } 071 072 /** 073 * Get 074 * The string identifier for an operation. 075 * 076 */ 077 public String getIdentifier() 078 { 079 return this.identifier; 080 } 081 082 /** 083 * Method hashCode 084 */ 085 public int hashCode() 086 { 087 int result = 17; 088 result = 37 * result + ( identifier != null ? identifier.hashCode() : 0 ); 089 return result; 090 } 091 092 /** 093 * Get 094 * true if the identifer is a pattern that is to be 095 * evaluated, for example x.* could match x.a or x.b and x.** 096 * could match x.foo 097 * 098 */ 099 public boolean isPattern() 100 { 101 return this.pattern; 102 } 103 104 /** 105 * Set 106 * The string identifier for an operation. 107 * 108 * 109 * @param identifier 110 */ 111 public void setIdentifier( String identifier ) 112 { 113 this.identifier = identifier; 114 } 115 116 /** 117 * Set 118 * true if the identifer is a pattern that is to be 119 * evaluated, for example x.* could match x.a or x.b and x.** 120 * could match x.foo 121 * 122 * 123 * @param pattern 124 */ 125 public void setPattern( boolean pattern ) 126 { 127 this.pattern = pattern; 128 } 129 130 /** 131 * Method toString 132 */ 133 public String toString() 134 { 135 StringBuilder buf = new StringBuilder(); 136 buf.append( "identifier = '" ).append( getIdentifier() + "'" ); 137 return buf.toString(); 138 } 139 140 public boolean isPermanent() 141 { 142 return permanent; 143 } 144 145 public void setPermanent( boolean permanent ) 146 { 147 this.permanent = permanent; 148 } 149}