001package org.apache.archiva.redback.rbac.jpa.model; 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 024import javax.persistence.Column; 025import javax.persistence.Entity; 026import javax.persistence.Id; 027import javax.persistence.Table; 028import java.io.Serializable; 029 030/** 031 * Created by martin on 25.09.16. 032 */ 033@Entity 034@Table(name="SECURITY_RESOURCES") 035public class JpaResource implements Resource, Serializable { 036 037 @Id 038 @Column(name="IDENTIFIER") 039 private String identifier; 040 @Column(name="PATTERN", nullable = false) 041 private Boolean pattern = false; 042 @Column(name="PERMANENT", nullable = false) 043 private Boolean permanent = false; 044 045 046 @Override 047 public String getIdentifier() { 048 return identifier; 049 } 050 051 @Override 052 public void setIdentifier(String identifier) { 053 this.identifier = identifier; 054 } 055 056 @Override 057 public boolean isPattern() { 058 return pattern; 059 } 060 061 @Override 062 public void setPattern(boolean pattern) { 063 this.pattern = pattern; 064 } 065 066 @Override 067 public boolean isPermanent() { 068 return permanent; 069 } 070 071 @Override 072 public void setPermanent(boolean permanent) { 073 this.permanent = permanent; 074 } 075 076 @Override 077 public boolean equals(Object o) { 078 if (this == o) return true; 079 if (o == null || getClass() != o.getClass()) return false; 080 081 JpaResource that = (JpaResource) o; 082 083 return identifier.equals(that.identifier); 084 085 } 086 087 @Override 088 public int hashCode() { 089 return identifier.hashCode(); 090 } 091}