com.denimgroup.threadfix.data.entities.EndpointPermission Maven / Gradle / Ivy
////////////////////////////////////////////////////////////////////////
//
// Copyright (c) 2009-2016 Denim Group, Ltd.
//
// The contents of this file are subject to the Mozilla Public License
// Version 2.0 (the "License"); you may not use this file except in
// compliance with the License. You may obtain a copy of the License at
// http://www.mozilla.org/MPL/
//
// Software distributed under the License is distributed on an "AS IS"
// basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See the
// License for the specific language governing rights and limitations
// under the License.
//
// The Original Code is ThreadFix.
//
// The Initial Developer of the Original Code is Denim Group, Ltd.
// Portions created by Denim Group, Ltd. are Copyright (C)
// Denim Group, Ltd. All Rights Reserved.
//
// Contributor(s): Denim Group, Ltd.
//
////////////////////////////////////////////////////////////////////////
package com.denimgroup.threadfix.data.entities;
import com.fasterxml.jackson.annotation.JsonIgnore;
import com.fasterxml.jackson.annotation.JsonView;
import javax.persistence.*;
import java.util.List;
import static com.denimgroup.threadfix.CollectionUtils.list;
/**
* Created by mcollins on 3/31/15.
*/
@Entity
@Table(name = "EndpointPermission")
public class EndpointPermission extends BaseEntity {
Application application = null;
String name = null;
List vulnerabilityList = list();
List findingList = list();
@ManyToOne(cascade = { CascadeType.PERSIST, CascadeType.MERGE })
@JoinColumn(name = "applicationId", foreignKey = @ForeignKey(name="FKF21E4564C96E039C"))
@JsonIgnore
public Application getApplication() {
return application;
}
public void setApplication(Application application) {
this.application = application;
}
@JsonView(Object.class)
@Column
public String getName() {
return name;
}
public void setName(String name) {
this.name = name;
}
@JsonIgnore
@ManyToMany(cascade = CascadeType.ALL)
@JoinTable(
name="EndpointPermission_Vulnerability",
joinColumns = { @JoinColumn(name="EndpointPermission_Id", foreignKey = @ForeignKey(name="FKDA3B1CC142F21C59")) },
inverseJoinColumns = { @JoinColumn(name="Vulnerability_Id", foreignKey = @ForeignKey(name="FKDA3B1CC18282DBDB")) }
)
public List getVulnerabilityList() {
return vulnerabilityList;
}
public void setVulnerabilityList(List vulnerabilityList) {
this.vulnerabilityList = vulnerabilityList;
}
@JsonIgnore
@ManyToMany(cascade = CascadeType.ALL)
@JoinTable(
name="EndpointPermission_Finding",
joinColumns = { @JoinColumn(name="EndpointPermission_Id", foreignKey = @ForeignKey(name="FKDB27B8E42F21C59")) },
inverseJoinColumns= { @JoinColumn(name="Finding_Id", foreignKey = @ForeignKey(name="FKDB27B8E259CF17B")) }
)
public List getFindingList() {
return findingList;
}
public void setFindingList(List findingList) {
this.findingList = findingList;
}
// Autogenerated methods
// we need these for contains()
@Override
public boolean equals(Object o) {
if (this == o) return true;
if (o == null || getClass() != o.getClass()) return false;
EndpointPermission that = (EndpointPermission) o;
if (application != null ? !application.equals(that.application) : that.application != null) return false;
return !(name != null ? !name.equals(that.name) : that.name != null);
}
@Override
public int hashCode() {
int result = application != null ? application.hashCode() : 0;
result = 31 * result + (name != null ? name.hashCode() : 0);
return result;
}
}
© 2015 - 2025 Weber Informatics LLC | Privacy Policy