GeneticObservationData.java

/*
 * Copyright 2026 Global Crop Diversity Trust
 * Licensed under the Apache License, Version 2.0
 * See LICENSE file in project root folder or http://www.apache.org/licenses/LICENSE-2.0
 */

package org.gringlobal.model;

import javax.persistence.*;

import org.genesys.blocks.model.Copyable;

import lombok.Getter;
import lombok.NoArgsConstructor;
import lombok.Setter;

import com.fasterxml.jackson.annotation.JsonIdentityInfo;
import com.fasterxml.jackson.annotation.JsonProperty;
import com.fasterxml.jackson.annotation.ObjectIdGenerators;

/**
 * Auto-generated by:
 * org.apache.openjpa.jdbc.meta.ReverseMappingTool$AnnotatedCodeGenerator
 */
@Entity
@Table(name = "genetic_observation_data")
@JsonIdentityInfo(scope = GeneticObservationData.class, generator = ObjectIdGenerators.PropertyGenerator.class, property = "id")
@Getter
@Setter
@NoArgsConstructor
public class GeneticObservationData extends CooperatorOwnedModel implements Copyable<GeneticObservationData> {

	private static final long serialVersionUID = 4527343190610650264L;

	/** Genetic Observation Data ID. */
	@Id
	@JsonProperty
	@GeneratedValue(strategy = GenerationType.IDENTITY)
	@Column(name = "genetic_observation_data_id", columnDefinition = "int")
	private Long id;

	/** Genetic Annotation: Reference to the genetic annotation described by this genetic observation data. */
	@ManyToOne(fetch = FetchType.LAZY, cascade = {})
	@JoinColumn(name = "genetic_annotation_id", nullable = false)
	private GeneticAnnotation geneticAnnotation;

	/** Genetic Observation Aggregate: Reference to the genetic observation aggregate described by this genetic observation data. */
	@ManyToOne(fetch = FetchType.LAZY, cascade = {})
	@JoinColumn(name = "genetic_observation_id")
	private GeneticObservation geneticObservation;

	/** Inventory: Reference to the inventory described by this genetic observation data. */
	@ManyToOne(fetch = FetchType.LAZY, cascade = {})
	@JoinColumn(name = "inventory_id", nullable = false)
	private Inventory inventory;

	/** Individual: Number of the individual plants on which the raw data was based. No decimals; whole numbers only. */
	@Basic
	private Integer individual;

	/** Value: The observed value for the raw data for this genetic observation. */
	@Basic
	@Column(nullable = false, length = 1000)
	private String value;

	/** Individual Allele Number: The individual allele number (raw data) of the genetic observation. No decimals; whole numbers only. */
	@Basic
	@Column(name = "individual_allele_number")
	private Integer individualAlleleNumber;

	public GeneticObservationData(final Long id) {
		this.id = id;
	}

	@Override
	public void lazyLoad() {
		super.lazyLoad();
		lazyLoad(this.geneticAnnotation);
		lazyLoad(this.geneticObservation);
		lazyLoad(this.inventory);
	}

	@Override
	public boolean canEqual(Object other) {
		return other instanceof GeneticObservationData;
	}
}