com.denimgroup.threadfix.data.entities.DefaultDefectProfile 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.denimgroup.threadfix.views.AllViews;
import com.fasterxml.jackson.annotation.JsonIgnore;
import com.fasterxml.jackson.annotation.JsonView;
import javax.persistence.*;
import java.util.List;
@Entity
@Table(name = "DefaultDefectProfile")
public class DefaultDefectProfile extends AuditableEntity {
private static final long serialVersionUID = -1581568334031972837L;
private String name;
private List defaultDefectFields;
private DefectTracker defectTracker;
private Application referenceApplication;
private String referenceProduct;
private List applicationsWithMainProfile;
private List applicationDefectTrackers;
@Column(length = 25, nullable = false)
@JsonView(Object.class) // This means it will be included in all ObjectWriters with Views.
public String getName() {
return name;
}
public void setName(String name) {
this.name = name;
}
@Transient
@JsonView(Object.class) // This means it will be included in all ObjectWriters with Views.
public String getFullName() {
if (referenceApplication != null) {
return referenceApplication.getName() + " / " + name;
}
return name;
}
@ManyToOne
@JoinColumn(name = "defectTrackerId", foreignKey = @ForeignKey(name="FKB7B08657D9C91C2A"))
@JsonIgnore
public DefectTracker getDefectTracker() {
return defectTracker;
}
public void setDefectTracker(DefectTracker defectTracker) {
this.defectTracker = defectTracker;
}
@ManyToOne
@JoinColumn(name = "applicationId", foreignKey = @ForeignKey(name="FKB7B08657C96E039C"))
@JsonView(AllViews.DefectTrackerInfos.class)
public Application getReferenceApplication() {
return referenceApplication;
}
public void setReferenceApplication(Application application) {
this.referenceApplication = application;
}
@OneToMany(mappedBy = "defaultDefectProfile", cascade = CascadeType.ALL)
@JsonIgnore
public List getDefaultDefectFields() {
return defaultDefectFields;
}
public void setDefaultDefectFields(List defaultDefectFields) {
this.defaultDefectFields = defaultDefectFields;
}
@OneToMany(mappedBy = "mainDefaultDefectProfile")
@JsonIgnore
public List getApplicationsWithMainProfile() {
return applicationsWithMainProfile;
}
public void setApplicationsWithMainProfile(
List applicationsWithMainProfile) {
this.applicationsWithMainProfile = applicationsWithMainProfile;
}
@OneToMany(mappedBy = "mainDefaultDefectProfile")
@JsonIgnore
public List getApplicationDefectTrackers() {
return applicationDefectTrackers;
}
public void setApplicationDefectTrackers(List applicationDefectTrackers) {
this.applicationDefectTrackers = applicationDefectTrackers;
}
@JoinColumn
@JsonView({AllViews.DefectTrackerInfos.class, AllViews.FormInfo.class})
public String getReferenceProduct() {
if (referenceProduct != null && !referenceProduct.isEmpty())
return referenceProduct;
if (referenceApplication != null && referenceApplication.getProjectName() != null) {
referenceProduct = referenceApplication.getProjectName();
} else {
referenceProduct = defectTracker.getDefaultProductName();
}
if (referenceApplication != null)
referenceApplication = null;
return referenceProduct;
}
public void setReferenceProduct(String referenceProduct) {
this.referenceProduct = referenceProduct;
}
}
© 2015 - 2025 Weber Informatics LLC | Privacy Policy