package ca.corefacility.bioinformatics.irida.model.project.library;

import java.util.Objects;

import javax.persistence.Column;
import javax.persistence.Embeddable;
import javax.persistence.EnumType;
import javax.persistence.Enumerated;

/**
 * Describes the layout part of a {@link LibraryDescription} single or paired
 * end reads, and read lengths.
 * 
 * @author Franklin Bristow <franklin.bristow@phac-aspc.gc.ca>
 *
 */
@Embeddable
public class Layout {
	@Column(name = "read_lengths", nullable = false)
	private final Integer readLengths;

	@Enumerated(EnumType.STRING)
	@Column(name = "layout_type", nullable = false)
	private final LayoutType layoutType;

	/**
	 * For hibernate.
	 */
	@SuppressWarnings("unused")
	private Layout() {
		this.readLengths = null;
		this.layoutType = null;
	}

	public Layout(final Integer readLengths, final LayoutType layoutType) {
		this.readLengths = readLengths;
		this.layoutType = layoutType;
	}

	@Override
	public boolean equals(final Object o) {
		if (o == this) {
			return true;
		} else if (o instanceof Layout) {
			final Layout l = (Layout) o;
			return Objects.equals(readLengths, l.readLengths) && Objects.equals(layoutType, l.layoutType);
		}

		return false;
	}

	public Integer getReadLengths() {
		return readLengths;
	}

	public static enum LayoutType {
		SINGLE_END, PAIRED_END
	}
}

@@ -1209,24 +1209,175 @@
 rn false;%0A%09%7D
+%0A%09%0A%09@Override%0A%09public int hashCode() %7B%0A%09%09return Objects.hash(readLengths, layoutType);%0A%09%7D%0A%0A%09public LayoutType getLayoutType() %7B%0A%09%09return layoutType;%0A%09%7D
 %0A%0A%09public In

Add hashCode and accessor for LayoutType to Layout.