1 package org.apache.archiva.redback.rbac.memory; 2 3 /* 4 * Licensed to the Apache Software Foundation (ASF) under one 5 * or more contributor license agreements. See the NOTICE file 6 * distributed with this work for additional information 7 * regarding copyright ownership. The ASF licenses this file 8 * to you under the Apache License, Version 2.0 (the 9 * "License"); you may not use this file except in compliance 10 * with the License. You may obtain a copy of the License at 11 * 12 * http://www.apache.org/licenses/LICENSE-2.0 13 * 14 * Unless required by applicable law or agreed to in writing, 15 * software distributed under the License is distributed on an 16 * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY 17 * KIND, either express or implied. See the License for the 18 * specific language governing permissions and limitations 19 * under the License. 20 */ 21 22 import org.apache.archiva.redback.rbac.Resource; 23 24 /** 25 * MemoryResource 26 * 27 * @author <a href="mailto:joakim@erdfelt.com">Joakim Erdfelt</a> 28 * 29 */ 30 public class MemoryResource 31 implements Resource, java.io.Serializable 32 { 33 /** 34 * Field identifier 35 */ 36 private String identifier; 37 38 /** 39 * Field pattern 40 */ 41 private boolean pattern = false; 42 43 /** 44 * Field permanent 45 */ 46 private boolean permanent = false; 47 48 /** 49 * Method equals 50 * 51 * @param other 52 */ 53 public boolean equals( Object other ) 54 { 55 if ( this == other ) 56 { 57 return true; 58 } 59 60 if ( !( other instanceof MemoryResource ) ) 61 { 62 return false; 63 } 64 65 MemoryResource that = (MemoryResource) other; 66 boolean result = true; 67 result = result 68 && ( getIdentifier() == null ? that.getIdentifier() == null : getIdentifier().equals( that.getIdentifier() ) ); 69 return result; 70 } 71 72 /** 73 * Get 74 * The string identifier for an operation. 75 * 76 */ 77 public String getIdentifier() 78 { 79 return this.identifier; 80 } 81 82 /** 83 * Method hashCode 84 */ 85 public int hashCode() 86 { 87 int result = 17; 88 result = 37 * result + ( identifier != null ? identifier.hashCode() : 0 ); 89 return result; 90 } 91 92 /** 93 * Get 94 * true if the identifer is a pattern that is to be 95 * evaluated, for example x.* could match x.a or x.b and x.** 96 * could match x.foo 97 * 98 */ 99 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 }