<commit_before>package ca.corefacility.bioinformatics.irida.model.workflow.analysis;

import java.nio.file.Path;
import java.util.Date;
import java.util.Objects;

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

import org.codehaus.jackson.annotate.JsonIgnore;

import ca.corefacility.bioinformatics.irida.model.IridaThing;
import ca.corefacility.bioinformatics.irida.model.VersionedFileFields;
import ca.corefacility.bioinformatics.irida.repositories.filesystem.FilesystemSupplementedRepository;

/**
 * Store file references to files produced by a workflow execution that we
 * otherwise don't want to parse metadata from.
 * 
 *
 */
@Entity
@Table(name = "analysis_output_file")
public class AnalysisOutputFile implements IridaThing, VersionedFileFields<Long> {

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

	@Column(name = "file_path", unique = true)
	@NotNull(message = "{analysis.output.file.file.notnull}")
	@JsonIgnore
	private final Path file;

	@NotNull
	@Temporal(TemporalType.TIMESTAMP)
	@Column(name = "created_date", nullable = false)
	private final Date createdDate;

	@NotNull(message = "{analysis.output.file.execution.manager.file.id}")
	@Column(name = "execution_manager_file_id")
	private final String executionManagerFileId;

	@NotNull
	@OneToOne(fetch = FetchType.EAGER, cascade = CascadeType.ALL, optional = false)
	@JoinColumn(name = "tool_execution_id")
	private final ToolExecution createdByTool;

	/**
	 * for hibernate
	 */
	@SuppressWarnings("unused")
	private AnalysisOutputFile() {
		this.createdDate = new Date();
		this.id = null;
		this.file = null;
		this.executionManagerFileId = null;
		this.createdByTool = null;
	}

	/**
	 * Create a new instance of {@link AnalysisOutputFile}.
	 * 
	 * @param file
	 *            the file that this resource owns.
	 * @param executionManagerFileId
	 *            the identifier for this file in the execution manager that it
	 *            was created by.
	 * @param analysis
	 *            the analysis that owns this resource.
	 * @param createdByTool
	 *            the tools that were used to create the file.
	 */
	public AnalysisOutputFile(final Path file, final String executionManagerFileId, final ToolExecution createdByTool) {
		this.id = null;<commit_msg>Remove analysis from constructor javadoc.<commit_after>package ca.corefacility.bioinformatics.irida.model.workflow.analysis;

import java.nio.file.Path;
import java.util.Date;
import java.util.Objects;

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

import org.codehaus.jackson.annotate.JsonIgnore;

import ca.corefacility.bioinformatics.irida.model.IridaThing;
import ca.corefacility.bioinformatics.irida.model.VersionedFileFields;
import ca.corefacility.bioinformatics.irida.repositories.filesystem.FilesystemSupplementedRepository;

/**
 * Store file references to files produced by a workflow execution that we
 * otherwise don't want to parse metadata from.
 * 
 *
 */
@Entity
@Table(name = "analysis_output_file")
public class AnalysisOutputFile implements IridaThing, VersionedFileFields<Long> {

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

	@Column(name = "file_path", unique = true)
	@NotNull(message = "{analysis.output.file.file.notnull}")
	@JsonIgnore
	private final Path file;

	@NotNull
	@Temporal(TemporalType.TIMESTAMP)
	@Column(name = "created_date", nullable = false)
	private final Date createdDate;

	@NotNull(message = "{analysis.output.file.execution.manager.file.id}")
	@Column(name = "execution_manager_file_id")
	private final String executionManagerFileId;

	@NotNull
	@OneToOne(fetch = FetchType.EAGER, cascade = CascadeType.ALL, optional = false)
	@JoinColumn(name = "tool_execution_id")
	private final ToolExecution createdByTool;

	/**
	 * for hibernate
	 */
	@SuppressWarnings("unused")
	private AnalysisOutputFile() {
		this.createdDate = new Date();
		this.id = null;
		this.file = null;
		this.executionManagerFileId = null;
		this.createdByTool = null;
	}

	/**
	 * Create a new instance of {@link AnalysisOutputFile}.
	 * 
	 * @param file
	 *            the file that this resource owns.
	 * @param executionManagerFileId
	 *            the identifier for this file in the execution manager that it
	 *            was created by.
	 * @param createdByTool
	 *            the tools that were used to create the file.
	 */
	public AnalysisOutputFile(final Path file, final String executionManagerFileId, final ToolExecution createdByTool) {
		this.id = null;
{'fraction_non_alphanumeric': 0.09508686717728376, 'fraction_numerical': 0.0, 'mean_word_length': 4.806941431670282, 'pattern_counts': {'":': 0, '<': 5, '<?xml version=': 0, '>': 5, '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': '424918', 'n_tokens_mistral': 1615, 'n_tokens_neox': 1545, 'n_words': 389}