GeneticMarker.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 static org.gringlobal.model.community.CommunityCodeValues.CODE_VALUE_LENGTH;

import javax.persistence.*;

import org.genesys.blocks.model.Copyable;

import org.gringlobal.custom.validation.javax.CodeValueField;

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_marker")
@JsonIdentityInfo(scope = GeneticMarker.class, generator = ObjectIdGenerators.PropertyGenerator.class, property = "id")
@Getter
@Setter
@NoArgsConstructor
public class GeneticMarker extends CooperatorOwnedModel implements Copyable<GeneticMarker> {

	private static final long serialVersionUID = 6920509865027573502L;

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

	/** Crop: Reference to the crop described by this genetic marker. */
	@ManyToOne(fetch = FetchType.LAZY, cascade = {})
	@JoinColumn(name = "crop_id", nullable = false)
	private Crop crop;

	/** Name: Name of a single genetic locus used as a descriptor for a specific crop. */
	@Basic
	@Column(nullable = false, length = 100)
	private String name;

	/** Assay Conditions: Specifics about the conditions of the way standards were run, from already published data specific to the marker. */
	@Basic
	@Column(name = "assay_conditions", length = 4000)
	private String assayConditions;

	/** GenBank Number: Accession identifier of the sequence in the NCBI database. When seen on the screen, this number is a link to Genbank. */
	@Basic
	@Column(name = "genbank_number", length = 20)
	private String genbankNumber;

	/** Known Standards: A list of accession numbers and the genetic datapoint value (size or sequence) that are used to calibrate the genotyping. */
	@Basic
	@Column(name = "known_standards")
	@Lob
	private String knownStandards;

	/** Map Location: Link to a specific genomic map that shows the location of the marker on the map. */
	@Basic
	@Column(name = "map_location", length = 100)
	private String mapLocation;

	/** Poly Type: The type of polymorphism. Uses MARKER_POLY_TYPE vocabulary. */
	@Basic
	@Column(name = "poly_type_code", length = CODE_VALUE_LENGTH)
	@CodeValueField("MARKER_POLY_TYPE")
	private String polyTypeCode;

	/** Position: Text describing the marker's placement on a specific genetic map (provide details on name and source). */
	@Basic
	@Column(length = 1000)
	private String position;

	/** Primers: Nucleic acid strands that serve as starting points for DNA replication. Provide information on forward and reverse orientation (identify 3' and 5' ends). */
	@Basic
	@Column(length = 200)
	private String primers;

	/** Range Products: Size range in base pairs of known alleles for this marker. */
	@Basic
	@Column(name = "range_products", length = 60)
	private String rangeProducts;

	/** Repeat Motif: A basic description of the main repeated set of nucleotides in a microsatellite. */
	@Basic
	@Column(name = "repeat_motif", length = 100)
	private String repeatMotif;

	/** Synonym: Other name(s) for the marker. */
	@Basic
	@Column(length = 200)
	private String synonyms;

	/** Note: General remarks about the genetic marker. */
	@Basic
	@Column
	@Lob
	private String note;

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

	@Override
	public void lazyLoad() {
		super.lazyLoad();
		lazyLoad(this.crop);
	}

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