<commit_before>package ca.corefacility.bioinformatics.irida.model.remote;

import java.util.Date;
import java.util.Objects;

import javax.persistence.CascadeType;
import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.EntityListeners;
import javax.persistence.FetchType;
import javax.persistence.GeneratedValue;
import javax.persistence.GenerationType;
import javax.persistence.Id;
import javax.persistence.JoinColumn;
import javax.persistence.ManyToOne;
import javax.persistence.Table;
import javax.persistence.Temporal;
import javax.persistence.TemporalType;
import javax.persistence.UniqueConstraint;
import javax.validation.constraints.NotNull;

import org.hibernate.envers.Audited;
import org.hibernate.validator.constraints.URL;
import org.springframework.data.annotation.CreatedDate;
import org.springframework.data.annotation.LastModifiedDate;
import org.springframework.data.jpa.domain.support.AuditingEntityListener;

import ca.corefacility.bioinformatics.irida.model.IridaThing;
import ca.corefacility.bioinformatics.irida.model.RemoteAPI;
import ca.corefacility.bioinformatics.irida.model.project.Project;

/**
 * RelatedProjectJoin for remote projects
 * 
 * @author <NAME> <<EMAIL>>
 *
 */
@Entity
@Audited
@Table(name = "remote_related_project", uniqueConstraints = @UniqueConstraint(columnNames = { "project_id",
		"remote_api_id", "remoteProjectURI" }, name = "UK_REMOTE_RELATED_PROJECT"))
@EntityListeners(AuditingEntityListener.class)
public class RemoteRelatedProject implements IridaThing {

	@Id
	@GeneratedValue(strategy = GenerationType.AUTO)
	private Long id;

	@ManyToOne(fetch = FetchType.EAGER, cascade = CascadeType.DETACH)
	@JoinColumn(name = "project_id")
	@NotNull
	private Project localProject;

	@ManyToOne(fetch = FetchType.EAGER, cascade = CascadeType.DETACH)
	@JoinColumn(name = "remote_api_id")
	@NotNull
	private RemoteAPI remoteAPI;

	@NotNull
	@URL
	@Column(name = "remote_project_uri")
	private String remoteProjectURI;

	@CreatedDate
	@NotNull
	@Temporal(TemporalType.TIMESTAMP)
	@Column(name = "created_date")
	private Date createdDate;

	@LastModifiedDate
	@Temporal(TemporalType.TIMESTAMP)
	@Column(name = "modified_date")
	private Date modifiedDate;

	public RemoteRelatedProject() {
		createdDate = new Date();
	}

	public RemoteRelatedProject(Project localProject, RemoteAPI remoteAPI, String remoteProjectURI) {
		this.localProject = localProject;
		this.remoteAPI = remoteAPI;
		this.remoteProjectURI = remoteProjectURI;
	}

	/**
	 * @return the localProject
	 */
	public Project getLocalProject() {
		return localProject;
	}

	/**
	 * @param localProject<commit_msg>added default constructor call<commit_after>package ca.corefacility.bioinformatics.irida.model.remote;

import java.util.Date;
import java.util.Objects;

import javax.persistence.CascadeType;
import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.EntityListeners;
import javax.persistence.FetchType;
import javax.persistence.GeneratedValue;
import javax.persistence.GenerationType;
import javax.persistence.Id;
import javax.persistence.JoinColumn;
import javax.persistence.ManyToOne;
import javax.persistence.Table;
import javax.persistence.Temporal;
import javax.persistence.TemporalType;
import javax.persistence.UniqueConstraint;
import javax.validation.constraints.NotNull;

import org.hibernate.envers.Audited;
import org.hibernate.validator.constraints.URL;
import org.springframework.data.annotation.CreatedDate;
import org.springframework.data.annotation.LastModifiedDate;
import org.springframework.data.jpa.domain.support.AuditingEntityListener;

import ca.corefacility.bioinformatics.irida.model.IridaThing;
import ca.corefacility.bioinformatics.irida.model.RemoteAPI;
import ca.corefacility.bioinformatics.irida.model.project.Project;

/**
 * RelatedProjectJoin for remote projects
 * 
 * @author <NAME> <<EMAIL>>
 *
 */
@Entity
@Audited
@Table(name = "remote_related_project", uniqueConstraints = @UniqueConstraint(columnNames = { "project_id",
		"remote_api_id", "remoteProjectURI" }, name = "UK_REMOTE_RELATED_PROJECT"))
@EntityListeners(AuditingEntityListener.class)
public class RemoteRelatedProject implements IridaThing {

	@Id
	@GeneratedValue(strategy = GenerationType.AUTO)
	private Long id;

	@ManyToOne(fetch = FetchType.EAGER, cascade = CascadeType.DETACH)
	@JoinColumn(name = "project_id")
	@NotNull
	private Project localProject;

	@ManyToOne(fetch = FetchType.EAGER, cascade = CascadeType.DETACH)
	@JoinColumn(name = "remote_api_id")
	@NotNull
	private RemoteAPI remoteAPI;

	@NotNull
	@URL
	@Column(name = "remote_project_uri")
	private String remoteProjectURI;

	@CreatedDate
	@NotNull
	@Temporal(TemporalType.TIMESTAMP)
	@Column(name = "created_date")
	private Date createdDate;

	@LastModifiedDate
	@Temporal(TemporalType.TIMESTAMP)
	@Column(name = "modified_date")
	private Date modifiedDate;

	public RemoteRelatedProject() {
		createdDate = new Date();
	}

	public RemoteRelatedProject(Project localProject, RemoteAPI remoteAPI, String remoteProjectURI) {
		this();
		this.localProject = localProject;
		this.remoteAPI = remoteAPI;
		this.remoteProjectURI = remoteProjectURI;
	}

	/**
	 * @return the localProject
	 */
	public Project getLocalProject() {
		return localProject;
	}

	/**
	 * @param localProject
{'fraction_non_alphanumeric': 0.10103092783505155, 'fraction_numerical': 0.0, 'mean_word_length': 6.483870967741935, 'pattern_counts': {'":': 0, '<': 9, '<?xml version=': 0, '>': 9, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '3961280', 'n_tokens_mistral': 1673, 'n_tokens_neox': 1609, 'n_words': 307}