CommunityCodeValues.java

/*
 * Copyright 2020 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.community;

import java.lang.reflect.Modifier;
import java.util.List;

import org.gringlobal.model.CodeValue;
import org.gringlobal.model.SeedInventoryExtra;
import org.gringlobal.model.TissueCultureExtra;
import org.springframework.util.ReflectionUtils;

import com.google.common.collect.Lists;



/**
 * CommunityCodeValues declares {@link CodeValue} required for the operation of
 * GGCE.
 */
public abstract class CommunityCodeValues {
	
	public static final int CODE_VALUE_LENGTH = 30;
	public static final int ABBR_LENGTH = 20;

	public static final String GERMPLASM_FORM = "GERMPLASM_FORM";
	public static final CodeValueDef GERMPLASM_FORM_SEED = new CodeValueDef(GERMPLASM_FORM, "SD", "Seed", null);
	public static final CodeValueDef GERMPLASM_FORM_INVITRO = new CodeValueDef(GERMPLASM_FORM, "IV", "In vitro", null);

	public static final String UNIT_OF_QUANTITY = "UNIT_OF_QUANTITY";
	public static final CodeValueDef UNIT_OF_QUANTITY_SEED = new CodeValueDef(UNIT_OF_QUANTITY, "sd", "Seed", null);

	public static final String ACCESSION_STATUS = "ACCESSION_STATUS";
	public static final CodeValueDef ACCESSION_STATUS_INACTIVE = new CodeValueDef(ACCESSION_STATUS, "INACTIVE", "Inactive", null);

	public static final String ACCESSION_SOURCE_TYPE = "ACCESSION_SOURCE_TYPE";
	public static final CodeValueDef ACCESSION_SOURCE_TYPE_COLLECTED = new CodeValueDef(ACCESSION_SOURCE_TYPE, "COLLECTED", "Collection", "Material collected from in-situ conditions.");
	public static final CodeValueDef ACCESSION_SOURCE_TYPE_DEVELOPED = new CodeValueDef(ACCESSION_SOURCE_TYPE, "DEVELOPED", "Developed", "Material developed by breeding techniques.");
	public static final CodeValueDef ACCESSION_SOURCE_TYPE_DONATED = new CodeValueDef(ACCESSION_SOURCE_TYPE, "DONATED", "Donated", "Material donated by another institute.");

	public static final String ACCESSION_NAME_TYPE = "ACCESSION_NAME_TYPE";
	public static final CodeValueDef ACCESSION_NAME_TYPE_COLLECTOR = new CodeValueDef(ACCESSION_NAME_TYPE, "COLLECTOR", "Collecting number", "Germplasm number assigned to the collected sample by the collector.");
	public static final CodeValueDef ACCESSION_NAME_TYPE_CULTIVAR = new CodeValueDef(ACCESSION_NAME_TYPE, "CULTIVAR", "Cultivar name", "Name of the cultivar as locally used.");
	public static final CodeValueDef ACCESSION_NAME_TYPE_DONOR = new CodeValueDef(ACCESSION_NAME_TYPE, "DONOR", "Donor number", "Accession number at the institute that provided the material.");
	public static final CodeValueDef ACCESSION_NAME_TYPE_DEVELOPER = new CodeValueDef(ACCESSION_NAME_TYPE, "DEVELOPER", "Breeding number", "Identifier used by the breeder to identify the line.");
	public static final CodeValueDef ACCESSION_NAME_TYPE_SITE = new CodeValueDef(ACCESSION_NAME_TYPE, "SITE", "Site identifier", "Germplasm number at the site holding the accession.");
	public static final CodeValueDef ACCESSION_NAME_TYPE_EXPLORATION = new CodeValueDef(ACCESSION_NAME_TYPE, "EXPLORATION", "Exploration ID", "Identifier of the collecting/exploration mission.");

	public static final String CITATION_TYPE = "CITATION_TYPE";

	public static final String ACCESSION_QUARANTINE_TYPE = "ACCESSION_QUARANTINE_TYPE";

	public static final String ACCESSION_QUARANTINE_STATUS = "ACCESSION_QUARANTINE_STATUS";

	public static final String ACCESSION_RESTRICTION_TYPE = "ACCESSION_RESTRICTION_TYPE";

	public static final String ACCESSION_SOURCE_HABITAT_TYPE = "ACCESSION_SOURCE_HABITAT_TYPE";

	public static final String IMPROVEMENT_LEVEL = "IMPROVEMENT_LEVEL";

	public static final String INVENTORY_AVAILABILITY_STATUS = "INVENTORY_AVAILABILITY_STATUS";
	public static final CodeValueDef INVENTORY_AVAILABILITY_NOTSET = new CodeValueDef(INVENTORY_AVAILABILITY_STATUS, "NOT-SET", "No value specified", "Not currently set to a value");
	public static final CodeValueDef INVENTORY_AVAILABILITY_LOWINVENTORY = new CodeValueDef(INVENTORY_AVAILABILITY_STATUS, "LOW", "Low inventory", "Quantity on hand is below the level of regeneration critical quantity.");
	public static final CodeValueDef INVENTORY_AVAILABILITY_AVAILABLE = new CodeValueDef(INVENTORY_AVAILABILITY_STATUS, "AVAIL", "Available", "Quantity on hand is above the level of regeneration critical quantity.");

	public static final String INVENTORY_VIABILITY_ACTION = "INVENTORY_VIABILITY_ACTION";

	public static final String INVENTORY_ACTION = "INVENTORY_ACTION";
	public static final CodeValueDef INVENTORY_ACTION_QUANTITYSET = new CodeValueDef(INVENTORY_ACTION, "QUANTITYSET", "Quantity confirmed", "The amount of material was physically inspected.");
	public static final CodeValueDef INVENTORY_ACTION_100SEEDWEIGHT = new CodeValueDef(INVENTORY_ACTION, "100SEEDWEIGHT", "100 seed weight", "The 100 seed weight measured and recorded.");
	public static final CodeValueDef INVENTORY_ACTION_WITHDRAW = new CodeValueDef(INVENTORY_ACTION, "WITHDRAW", "Withdrawal", "The specified amount of material withdrawn from the sample.");
	public static final CodeValueDef INVENTORY_ACTION_VABILITYTEST = new CodeValueDef(INVENTORY_ACTION, "VABILITYTEST", "Viability test", "Inventory is tested for viability");
	public static final CodeValueDef INVENTORY_ACTION_LOG = new CodeValueDef(INVENTORY_ACTION, "LOG", "Log", "Information only");
	public static final CodeValueDef INVENTORY_ACTION_SPLIT = new CodeValueDef(INVENTORY_ACTION, "SPLIT", "Split inventory", "Inventory split into additional packages.");
	public static final CodeValueDef INVENTORY_ACTION_DISCARD = new CodeValueDef(INVENTORY_ACTION, "DISCARD", "Discard", "A part or all material discarded.");
	public static final CodeValueDef INVENTORY_ACTION_MULTIPLICATION = new CodeValueDef(INVENTORY_ACTION, "MULTIPLICATION", "Multiplication", "Multiply seed inventory for increased amount of material.");;

	public static final String STORAGE_TYPE = "STORAGE_TYPE";
	public static final CodeValueDef STORAGE_TYPE_TEMPORARY = new CodeValueDef(STORAGE_TYPE, "TEMP", "Temporary", "Temporary storage");
	public static final CodeValueDef STORAGE_TYPE_SEED_LTS = new CodeValueDef(STORAGE_TYPE, "SDLTS", "Seed LTS", "Long-term seed collection");
	public static final CodeValueDef STORAGE_TYPE_SEED_MTS = new CodeValueDef(STORAGE_TYPE, "SDMTS", "Seed MTS", "Medium-term seed collection");
	public static final CodeValueDef STORAGE_TYPE_SEED_ACTIVE = new CodeValueDef(STORAGE_TYPE, "SDACT", "Seed Active", "Active seed collection");
	public static final CodeValueDef STORAGE_TYPE_FIELD = new CodeValueDef(STORAGE_TYPE, "FIELD", "Field", "Field collection");
	public static final CodeValueDef STORAGE_TYPE_IV_LTS = new CodeValueDef(STORAGE_TYPE, "IVLTS", "Invitro LTS", "Long-term invitro collection");
	public static final CodeValueDef STORAGE_TYPE_IV_MTS = new CodeValueDef(STORAGE_TYPE, "IVMTS", "Invitro MTS", "Medium-term invitro collection");
	public static final CodeValueDef STORAGE_TYPE_CRYO = new CodeValueDef(STORAGE_TYPE, "CRYO", "Cryo", "Cryopreserved collection");

	public static final String MEDIA_TYPE_CODE = "MEDIA_TYPE_CODE";

	public static final String PATHOGEN_STATUS = "PATHOGEN_STATUS";

	public static final String PATHOLOGY_TEST = "PATHOLOGY_TEST";

	public static final String PATHOLOGY_TEST_TYPE = "PATHOLOGY_TEST_TYPE";

	public static final String PATHOLOGY_TEST_RESULT = "PATHOLOGY_TEST_RESULT";

	public static final String PATH_TEST_SCORE_TYPE = "PATH_TEST_SCORE_TYPE";

	public static final String DATE_FORMAT = "DATE_FORMAT";
	public static final CodeValueDef DATE_FORMAT_DATE = new CodeValueDef(DATE_FORMAT, "MM/dd/yyyy", "MM/dd/yyyy", "Complete date");
	public static final CodeValueDef DATE_FORMAT_DATETIME = new CodeValueDef(DATE_FORMAT, "MM/dd/yyyy HH:mm", "MM/dd/yyyy HH:mm", "Date and time"); // FIXME Remove
	public static final CodeValueDef DATE_FORMAT_MONTHYEAR = new CodeValueDef(DATE_FORMAT, "MM/yyyy", "MM/yyyy", "Only year and month");
	public static final CodeValueDef DATE_FORMAT_YEAR = new CodeValueDef(DATE_FORMAT, "yyyy", "yyyy", "Only year");

	public static final String ATTACH_CATEGORY = "ATTACH_CATEGORY";
	public static final CodeValueDef ATTACH_CATEGORY_DOCUMENT = new CodeValueDef(ATTACH_CATEGORY, "DOCUMENT", "Document attachment", null);
	public static final CodeValueDef ATTACH_CATEGORY_IMAGE = new CodeValueDef(ATTACH_CATEGORY, "IMAGE", "Image attachment", null);
	public static final CodeValueDef ATTACH_CATEGORY_LINK = new CodeValueDef(ATTACH_CATEGORY, "LINK", "URL link", null);

	// Order request actions
	public static final String ORDER_REQUEST_ACTION = "ORDER_REQUEST_ACTION";
	public static final CodeValueDef ORDER_REQUEST_ACTION_LOG = new CodeValueDef(ORDER_REQUEST_ACTION, "LOG", "Information", "Log general information about order request.");
	public static final CodeValueDef ORDER_REQUEST_ACTION_REPORT_TO_ITPGRFA = new CodeValueDef(ORDER_REQUEST_ACTION, "REPORT_TO_ITPGRFA", "Report to ITPGRFA", "Report SMTA to ITPGRFA Easy-SMTA.");

	// Order request status
	public static final String ORDER_REQUEST_ITEM_STATUS = "ORDER_REQUEST_ITEM_STATUS";
	public static final CodeValueDef ORDER_REQUEST_ITEM_STATUS_NEW = new CodeValueDef(ORDER_REQUEST_ITEM_STATUS, "NEW", "Retrieve from storage", "Retrieve source inventory from storage for distribution.");
	public static final CodeValueDef ORDER_REQUEST_ITEM_STATUS_PENDING = new CodeValueDef(ORDER_REQUEST_ITEM_STATUS, "PENDING", "Retrieve from storage", "Retrieve source inventory from storage for distribution.");
	public static final CodeValueDef ORDER_REQUEST_ITEM_STATUS_SPLIT = new CodeValueDef(ORDER_REQUEST_ITEM_STATUS, "SPLIT", "Split out order item", null);
	public static final CodeValueDef ORDER_REQUEST_ITEM_STATUS_CANCEL = new CodeValueDef(ORDER_REQUEST_ITEM_STATUS, "CANCEL", "Cancel or abort order item", null);
	public static final CodeValueDef ORDER_REQUEST_ITEM_STATUS_SHIPPED = new CodeValueDef(ORDER_REQUEST_ITEM_STATUS, "SHIPPED", "Shipped order item", null);

	public static final String ORDER_REQUEST_ITEM_ACTION = "ORDER_REQUEST_ITEM_ACTION";
	public static final CodeValueDef ORDER_REQUEST_ITEM_ACTION_RETRIEVE = new CodeValueDef(ORDER_REQUEST_ITEM_ACTION, "RETRIEVE", "Retrieve from storage", "Retrieve source inventory from storage for distribution.");
	public static final CodeValueDef ORDER_REQUEST_ITEM_ACTION_VERIFY = new CodeValueDef(ORDER_REQUEST_ITEM_ACTION, "VERIFY", "Verify item", "Verify item is on the distribution list.");
	public static final CodeValueDef ORDER_REQUEST_ITEM_ACTION_PACK = new CodeValueDef(ORDER_REQUEST_ITEM_ACTION, "PACK", "Pack", "Item is packed for shipping.");

	public static final String GEOGRAPHY_COUNTRY_CODE = "GEOGRAPHY_COUNTRY_CODE";

	/* Cooperator */
	public static final String COOPERATOR_STATUS = "COOPERATOR_STATUS";
	public static final CodeValueDef COOPERATOR_STATUS_ACTIVE = new CodeValueDef(COOPERATOR_STATUS, "ACTIVE", "Active", null);
	public static final CodeValueDef COOPERATOR_STATUS_INACTIVE = new CodeValueDef(COOPERATOR_STATUS, "INACTIVE", "Inactive", null);

	/* Dataviews */
	public static final String DATAVIEW_CATEGORY = "DATAVIEW_CATEGORY";
	public static final CodeValueDef DATAVIEW_CATEGORY_LOOKUPS = new CodeValueDef(DATAVIEW_CATEGORY, "Lookups", "Lookups", null);
	public static final CodeValueDef DATAVIEW_CATEGORY_CLIENT = new CodeValueDef(DATAVIEW_CATEGORY, "Client", "Client dataview category", null);
	public static final String DATAVIEW_DATABASE_AREA = "DATAVIEW_DATABASE_AREA";
	public static final CodeValueDef DATAVIEW_DATABASE_AREA_LOOKUPS = new CodeValueDef(DATAVIEW_DATABASE_AREA, "Lookup Table", "Lookup Table", null);;
	public static final CodeValueDef DATAVIEW_DATABASE_AREA_COOPERATOR = new CodeValueDef(DATAVIEW_DATABASE_AREA, "Cooperator", "Cooperator area", null);
	public static final CodeValueDef DATAVIEW_DATABASE_AREA_ACCESSION = new CodeValueDef(DATAVIEW_DATABASE_AREA, "Accession", "Accession area", null);

	public static final String MANAGEMENT_TYPE = "MANAGEMENT_TYPE";
	public static final CodeValueDef MANAGEMENT_TYPE_TEMPORARY = new CodeValueDef(MANAGEMENT_TYPE, "TEMPORARY", "Temporary collection", null);
	public static final CodeValueDef MANAGEMENT_TYPE_ACTIVE = new CodeValueDef(MANAGEMENT_TYPE, "ACTIVE", "Active collection", null);
	public static final CodeValueDef MANAGEMENT_TYPE_DISTRIBUTION = new CodeValueDef(MANAGEMENT_TYPE, "DISTRIBUTION", "For distribution", null);
	public static final CodeValueDef MANAGEMENT_TYPE_BASE = new CodeValueDef(MANAGEMENT_TYPE, "BASE", "Base collection", null);
	public static final CodeValueDef MANAGEMENT_TYPE_BACKUP = new CodeValueDef(MANAGEMENT_TYPE, "BACKUP", "Safety backup", null);
	public static final CodeValueDef MANAGEMENT_TYPE_ARCHIVED = new CodeValueDef(MANAGEMENT_TYPE, "ARCHIVED", "Archived collection", null);
	public static final CodeValueDef MANAGEMENT_TYPE_SYSTEM = new CodeValueDef(MANAGEMENT_TYPE, "SYSTEM", "System", null);

	public static final String ACCESSION_ACTION = "ACCESSION_ACTION";
	public static final CodeValueDef ACCESSION_ACTION_ACCNUMBERD = new CodeValueDef(ACCESSION_ACTION, "ACCNUMBERD", "Accessioned", "Germplasm accepted into the collection and given an accession number.");

	public static final String ACCESSION_MLS_STATUS = "ACCESSION_MLS_STATUS";
	public static final CodeValueDef ACCESSION_MLS_STATUS_N = new CodeValueDef(ACCESSION_MLS_STATUS, "N", "Not in MLS", "Not available under the MLS");
	public static final CodeValueDef ACCESSION_MLS_STATUS_Y = new CodeValueDef(ACCESSION_MLS_STATUS, "Y", "In MLS", "Available under the MLS");
	public static final CodeValueDef ACCESSION_MLS_STATUS_ANNEX1 = new CodeValueDef(ACCESSION_MLS_STATUS, "ANNEX1", "In MLS (Annex I)", "The PGRFA belongs to a crop listed in Annex I and is under the management and control of a Contracting Party to the Treaty and declared to be in the public domain");
	public static final CodeValueDef ACCESSION_MLS_STATUS_ARTICLE15 = new CodeValueDef(ACCESSION_MLS_STATUS, "ARTICLE15", "In MLS (Article 15)", "The sample is in a collection subject to an agreement concluded under Article 15 of the Treaty");
	public static final CodeValueDef ACCESSION_MLS_STATUS_SMTA_SOURCE = new CodeValueDef(ACCESSION_MLS_STATUS, "SMTA_SOURCE", "In MLS (Received with SMTA)", "The holder received the sample with SMTA");
	public static final CodeValueDef ACCESSION_MLS_STATUS_MLS_DEVELOP = new CodeValueDef(ACCESSION_MLS_STATUS, "MLS_DEVELOP", "In MLS (Under development)", "The PGRFA is derived from, and distinct from, material previously received from the MLS, is still under development and not yet ready for commercialization, and may be made available at the discretion of the developer");

	public static final String ACCESSION_CURATION_TYPE = "ACCESSION_CURATION_TYPE";
	public static final CodeValueDef ACCESSION_CURATION_TYPE_FULL = new CodeValueDef(ACCESSION_CURATION_TYPE, "FULL", "Fully curated", "Accession is conserved using the full set of storage, monitoring, testing and management standards.");
	public static final CodeValueDef ACCESSION_CURATION_TYPE_PARTIAL = new CodeValueDef(ACCESSION_CURATION_TYPE, "PARTIAL", "Partially curated", "Accession is conserved using only a subset of the actions applied to fully curated accessions.");
	public static final CodeValueDef ACCESSION_CURATION_TYPE_ARCHIVED = new CodeValueDef(ACCESSION_CURATION_TYPE, "ARCHIVED", "Archived", "Accession is stored in the genebank under optimal conditions for long-term survival, but without monitoring or distribution.");
	public static final CodeValueDef ACCESSION_CURATION_TYPE_HISTORICAL = new CodeValueDef(ACCESSION_CURATION_TYPE, "HISTORICAL", "Historical", "Accession no longer physically exists in the genebank.");

	public static final String ANNOTATION_TYPE = "ANNOTATION_TYPE";
	public static final CodeValueDef ANNOTATION_TYPE_RECEIVED = new CodeValueDef(ANNOTATION_TYPE, "RECEIVED", "The taxonomic name of the accession when it was received", null);
	public static final CodeValueDef ANNOTATION_TYPE_RE_IDENT = new CodeValueDef(ANNOTATION_TYPE, "RE-IDENT", "Taxonomic Re-Identification", null);

	public static final String ORDER_INTENDED_USE = "ORDER_INTENDED_USE";
	public static final CodeValueDef ORDER_INTENDED_USE_OTHER = new CodeValueDef(ORDER_INTENDED_USE, "OTHER", "Other", "Does not fit in the other intended use categories - see note");

	public static final String ORDER_REQUEST_TYPE = "ORDER_REQUEST_TYPE";
	public static final CodeValueDef ORDER_REQUEST_TYPE_VIABILITYTEST = new CodeValueDef(ORDER_REQUEST_TYPE, "GR", "Germination", "Germination/viability testing.");

	public static final String MTA_TYPE = "MTA_TYPE";
	public static final CodeValueDef MTA_TYPE_SMTA_SIGNED = new CodeValueDef(MTA_TYPE, "SMTA_SIGNED", "Signed SMTA", "The SMTA is sent to the recipient for physical signature and the material is shipped when the signed document is received by the Provider.");
	public static final CodeValueDef MTA_TYPE_SMTA_CLICK = new CodeValueDef(MTA_TYPE, "SMTA_CLICK", "Click-wrap SMTA", "The SMTA is prepared by the provider and makes it available to the recipient for acceptance by electronic means.");
	public static final CodeValueDef MTA_TYPE_SMTA_SHRINK = new CodeValueDef(MTA_TYPE, "SMTA_SHRINK", "Shrink-wrap SMTA", "The document is shipped along with the material. By accepting the parcel, the recipient accepts the terms of the agreement. No signature is required.");
	
	public static final String GERMINATION_CATEGORY = "GERMINATION_CATEGORY";

	public static final String GEOREFERENCE_DATUM = "GEOREFERENCE_DATUM";
	public static final CodeValueDef GEOREFERENCE_DATUM_WGS84 = new CodeValueDef(GEOREFERENCE_DATUM, "WGS84", "WGS84", null);

	public static final String VIABILITY_EQUIPMENT = "VIABILITY_EQUIPMENT";

	public static final String UNIT_OF_LIGHTPOTENCY = "UNIT_OF_LIGHTPOTENCY";
	public static final String UNIT_OF_TEMPERATURE = "UNIT_OF_TEMPERATURE";
	public static final CodeValueDef UNIT_OF_TEMPERATURE_CELSIUS = new CodeValueDef(UNIT_OF_TEMPERATURE, "C", "°C", "Celsius");
	public static final CodeValueDef UNIT_OF_TEMPERATURE_FAHRENHEIT = new CodeValueDef(UNIT_OF_TEMPERATURE, "F", "°F", "Fahrenheit");
	public static final CodeValueDef UNIT_OF_TEMPERATURE_KELVIN = new CodeValueDef(UNIT_OF_TEMPERATURE, "K", "K", "Kelvin");

	/* Genesys (sub-)request */
	public static final String GENESYS_SUBREQUEST_STATUS = "GENESYS_SUBREQUEST_STATUS";
	public static final CodeValueDef GENESYS_SUBREQUEST_STATUS_NOTCONFIRMED = new CodeValueDef(GENESYS_SUBREQUEST_STATUS, "0", "Confirmation pending", "Genebank did not confirm receipt of the request");
	public static final CodeValueDef GENESYS_SUBREQUEST_STATUS_CONFIRMED = new CodeValueDef(GENESYS_SUBREQUEST_STATUS, "1", "Request confirmed", "Genebank confirmed receipt of the request");
	public static final CodeValueDef GENESYS_SUBREQUEST_STATUS_SENT = new CodeValueDef(GENESYS_SUBREQUEST_STATUS, "2", "Request completed", "Genebank completed the request");
	public static final CodeValueDef GENESYS_SUBREQUEST_STATUS_PROCESSING = new CodeValueDef(GENESYS_SUBREQUEST_STATUS, "3", "Request is being processed", "The genebank is processing the request");
	public static final CodeValueDef GENESYS_SUBREQUEST_STATUS_REJECTED = new CodeValueDef(GENESYS_SUBREQUEST_STATUS, "4", "Request rejected", "Genebank rejected the request completely");

	public static final String GENESYS_SUBREQUEST_PURPOSETYPE = "GENESYS_SUBREQUEST_PURPOSETYPE";
	public static final CodeValueDef GENESYS_SUBREQUEST_PURPOSETYPE_OTHER = new CodeValueDef(GENESYS_SUBREQUEST_PURPOSETYPE, "0", "Other", "Elaborated in request notes");
	public static final CodeValueDef GENESYS_SUBREQUEST_PURPOSETYPE_RESEARCH = new CodeValueDef(GENESYS_SUBREQUEST_PURPOSETYPE, "1", "Research", "Research for food and agriculture");

	// Accession pedigree
	public static final String PEDIGREE_CROSS = "PEDIGREE_CROSS";

	// Trait
	public static final String CROP_TRAIT_DATA_TYPE = "CROP_TRAIT_DATA_TYPE";
	public static final String DATATYPE_CHAR = "CHAR";
	public static final CodeValueDef CROP_TRAIT_DATA_TYPE_CHAR = new CodeValueDef(CROP_TRAIT_DATA_TYPE, DATATYPE_CHAR, "Text", "Observation is recorded as text");
	public static final String DATATYPE_NUMERIC = "NUMERIC";
	public static final CodeValueDef CROP_TRAIT_DATA_TYPE_NUMERIC = new CodeValueDef(CROP_TRAIT_DATA_TYPE, DATATYPE_NUMERIC, "Numeric", "Quantitative measurement of trait");

	public static final String CONTAINER_TYPE = "CONTAINER_TYPE";
	
	public static final String MATERIEL_TYPE = "MATERIEL_TYPE";
	public static final CodeValueDef MATERIEL_TYPE_INVITRO_MEDIUM = new CodeValueDef(MATERIEL_TYPE, "INVITRO_MEDIUM", "Invitro medium", "Invitro medium type");

	public static final String METHOD_STUDY_TYPE = "METHOD_STUDY_TYPE";

	public static final String INVENTORY_EXTRA_TYPE = "INVENTORY_EXTRA_TYPE";
	public static final CodeValueDef INVENTORY_EXTRA_TYPE_SEED = new CodeValueDef(INVENTORY_EXTRA_TYPE, SeedInventoryExtra.EXTRA_TYPE, "Seed", "Seed extra");
	public static final CodeValueDef INVENTORY_EXTRA_TYPE_TISSUECULTURE = new CodeValueDef(INVENTORY_EXTRA_TYPE, TissueCultureExtra.EXTRA_TYPE, "Tissue culture", "Tissue culture extra");


	/**
	 * Get the list of code values required for GGCE
	 * 
	 * @return List of code values
	 */
	public static List<CodeValueDef> listCommunityCodeValues() {
		List<CodeValueDef> communityCodes = Lists.newArrayList();

		ReflectionUtils.doWithFields(CommunityCodeValues.class, field -> {
			if (Modifier.isStatic(field.getModifiers())) {
				if (field.getType() == CodeValueDef.class) {
					communityCodes.add((CodeValueDef) field.get(CommunityCodeValues.class));
				}
			}
		});

		return communityCodes;
	}

	public static final class CodeValueDef {
		public final String groupName;
		public final String value;
		public final String title;
		public final String description;

		public CodeValueDef(String groupName, String value, String title, String description) {
			this.groupName = groupName;
			this.value = value;
			this.title = title;
			this.description = description;
		}

		public boolean is(String actionCode) {
			return value.equals(actionCode);
		}
	}
}