InventoryViabilityEnvironment.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 javax.validation.constraints.Size;
import org.genesys.blocks.model.Copyable;
import org.gringlobal.custom.validation.javax.CodeValueField;
import org.gringlobal.model.community.CommunityCodeValues;
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;
@Entity
@Table(name = "inventory_viability_environment",
// Unique constraints
uniqueConstraints = @UniqueConstraint(columnNames = { "light_hours", "nm_wave_lenght", "light_potency", "light_grades", "light_potency_unit_code", "grades_unit_code", "dark_grades", "equipment_code"}))
@JsonIdentityInfo(scope = InventoryViabilityEnvironment.class, generator = ObjectIdGenerators.PropertyGenerator.class, property = "id")
@Getter
@Setter
@NoArgsConstructor
public class InventoryViabilityEnvironment extends CooperatorOwnedModel implements Copyable<InventoryViabilityEnvironment> {
private static final long serialVersionUID = 5087750409300945335L;
/** Inventory Viability Environment ID. */
@Id
@JsonProperty
@GeneratedValue(strategy = GenerationType.IDENTITY)
@Column(name = "inventory_viability_environment_id", columnDefinition = "int")
private Long id;
/** Light Hours: Number of light hours per day. No decimals; whole numbers only. */
@Column(name = "light_hours")
private Integer lightHours;
/** NM Wavelength: Wavelength in nanometers. No decimals; whole numbers only. */
@Column(name = "nm_wave_lenght")
private Integer nmWaveLenght;
/** Light Potency: Light potency value. No decimals; whole numbers only. */
@Column(name = "light_potency")
private Integer lightPotency;
/** Light Grades: Light temperature grades. No decimals; whole numbers only. */
@Column(name = "light_grades")
private Integer lightGrades;
/** Light Potency Unit: Units for light potency. Uses UNIT_OF_LIGHTPOTENCY vocabulary. */
@Size(max = CODE_VALUE_LENGTH) @Column(name = "light_potency_unit_code", length = CODE_VALUE_LENGTH)
@CodeValueField(CommunityCodeValues.UNIT_OF_LIGHTPOTENCY)
private String lightPotencyUnitCode;
/** Grades Unit: Units for temperature grades. Uses UNIT_OF_TEMPERATURE vocabulary. */
@Size(max = CODE_VALUE_LENGTH) @Column(name = "grades_unit_code", length = CODE_VALUE_LENGTH)
@CodeValueField(CommunityCodeValues.UNIT_OF_TEMPERATURE)
private String gradesUnitCode;
/** Dark Grades: Dark temperature grades. No decimals; whole numbers only. */
@Column(name = "dark_grades")
private Integer darkGrades;
/** Equipment Code: Equipment used for the test. Uses VIABILITY_EQUIPMENT vocabulary. */
@Size(max = CODE_VALUE_LENGTH) @Column(name = "equipment_code", length = CODE_VALUE_LENGTH)
@CodeValueField(CommunityCodeValues.VIABILITY_EQUIPMENT)
private String equipmentCode;
/** Note: General remarks about the viability environment. */
@Lob
@Column(name = "note")
private String note;
public InventoryViabilityEnvironment(final Long id) {
this.id = id;
}
@Override
public boolean canEqual(Object other) {
return other instanceof InventoryViabilityEnvironment;
}
}