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.Operation;
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_OPERATIONS")
035public class JpaOperation implements Operation, Serializable {
036
037    @Id
038    @Column(name="NAME")
039    private String name;
040    @Column(name="DESCRIPTION")
041    private String description;
042    @Column(name="PERMANENT", nullable = false)
043    private Boolean permanent = false;
044
045
046    @Override
047    public String getName() {
048        return name;
049    }
050
051    @Override
052    public void setName(String name) {
053        this.name = name;
054    }
055
056    @Override
057    public String getDescription() {
058        return description;
059    }
060
061    @Override
062    public void setDescription(String description) {
063        this.description = description;
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        JpaOperation that = (JpaOperation) o;
082
083        return name.equals(that.name);
084
085    }
086
087    @Override
088    public int hashCode() {
089        return name.hashCode();
090    }
091}