AccessionInfo.java

/*
 * Copyright 2026 Global Crop Diversity Trust
 *
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 *   http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */

package org.gringlobal.model.elastic;

import lombok.Getter;
import lombok.Setter;
import org.gringlobal.custom.elasticsearch.SearchField;
import org.gringlobal.custom.validation.javax.CodeValueField;
import org.gringlobal.model.community.CommunityCodeValues;
import org.springframework.data.elasticsearch.annotations.Field;
import org.springframework.data.elasticsearch.annotations.FieldType;

import java.time.Instant;
import java.util.Date;

import static org.gringlobal.model.community.CommunityCodeValues.ACCESSION_MLS_STATUS;

@Getter
@Setter
public class AccessionInfo {

	private Long id;
	private Long ownedBy;
	private Instant ownedDate;
	private Long createdBy;
	private Instant createdDate;
	private Long modifiedBy;
	private Instant modifiedDate;

	@SearchField
	@Field(type = FieldType.Keyword)
	private String accessionNumber;

	@CodeValueField(value = ACCESSION_MLS_STATUS, indexed = true)
	private String mlsStatus;

	@Field(type = FieldType.Keyword)
	private String accessionNumberPart1;

	private Long accessionNumberPart2;

	@Field(type = FieldType.Keyword)
	private String accessionNumberPart3;

	@Field(type = FieldType.Keyword)
	private String doi;

	@CodeValueField(value = "IMPROVEMENT_LEVEL", indexed = true)
	private String improvementStatusCode;

	private Date initialReceivedDate;

	@Field(type = FieldType.Keyword)
	private String initialReceivedDateCode;

	@CodeValueField(value = CommunityCodeValues.GERMPLASM_FORM, indexed = true)
	private String initialReceivedFormCode;

	@Field(type = FieldType.Keyword)
	private String isBackedUp;

	@Field(type = FieldType.Keyword)
	private String isCore;

	@Field(type = FieldType.Keyword)
	private String isWebVisible;

	@CodeValueField(value = "ACCESSION_LIFE_FORM", indexed = true)
	private String lifeFormCode;

	@Field(type = FieldType.Text)
	private String note;

	@CodeValueField(value = "REPRODUCTIVE_UNIFORMITY", indexed = true)
	private String reproductiveUniformityCode;

	@CodeValueField(value = CommunityCodeValues.ACCESSION_STATUS, indexed = true)
	private String statusCode;

	@CodeValueField(value = CommunityCodeValues.ACCESSION_CURATION_TYPE, indexed = true)
	private String curationTypeCode;

	@CodeValueField(value = CommunityCodeValues.ACCESSION_COLLECTION, indexed = true)
	private String collectionCode;

	@Field(type = FieldType.Text)
	private String preferredName;
}