X-Git-Url: https://dev.e-taxonomy.eu/gitweb/cdmlib.git/blobdiff_plain/136a3660a354877d35e9007204645501afc1aa30..05109aeb4d2caabb4b8753f0c0f25a4ec153de8c:/cdmlib-model/src/main/java/eu/etaxonomy/cdm/model/common/ExtensionType.java diff --git a/cdmlib-model/src/main/java/eu/etaxonomy/cdm/model/common/ExtensionType.java b/cdmlib-model/src/main/java/eu/etaxonomy/cdm/model/common/ExtensionType.java index e62a84acfb..3ad38b0ebd 100644 --- a/cdmlib-model/src/main/java/eu/etaxonomy/cdm/model/common/ExtensionType.java +++ b/cdmlib-model/src/main/java/eu/etaxonomy/cdm/model/common/ExtensionType.java @@ -11,6 +11,7 @@ package eu.etaxonomy.cdm.model.common; import java.util.HashMap; +import java.util.List; import java.util.Map; import java.util.UUID; @@ -21,6 +22,9 @@ import javax.xml.bind.annotation.XmlType; import org.apache.log4j.Logger; import org.hibernate.envers.Audited; +import org.hibernate.search.annotations.Indexed; + +import eu.etaxonomy.cdm.model.description.Feature; /** * Extension types similar to dynamically defined attributes. These are not data @@ -33,6 +37,7 @@ import org.hibernate.envers.Audited; @XmlAccessorType(XmlAccessType.FIELD) @XmlType(name = "ExtensionType") @Entity +@Indexed(index = "eu.etaxonomy.cdm.model.common.DefinedTermBase") @Audited public class ExtensionType extends DefinedTermBase { private static final long serialVersionUID = -7761963794004133427L; @@ -42,20 +47,59 @@ public class ExtensionType extends DefinedTermBase { private static final UUID uuidXmlFragment = UUID.fromString("ea109c1c-e69b-4e6d-9079-1941b9ee2991"); private static final UUID uuidRdfFragment = UUID.fromString("f3684e25-dcad-4c1e-a5d8-16cddf1c4f5b"); private static final UUID uuidDoi = UUID.fromString("f079aacc-ab08-4cc4-90a0-6d3958fb0dbf"); - private static final UUID uuid2ndNomRef = UUID.fromString("46a98bfa-f11a-47fe-a6c5-50c7e8289b3d"); +// private static final UUID uuid2ndNomRef = UUID.fromString("46a98bfa-f11a-47fe-a6c5-50c7e8289b3d"); private static final UUID uuid3rdHybridParent = UUID.fromString("5e552b24-5a2d-498d-a4f4-ccd8e5bc2bae"); private static final UUID uuidAreaOfInterest = UUID.fromString("cefa478e-604f-4db4-8afc-25e06c28ec69"); private static final UUID uuidNomStandard = UUID.fromString("4a6cbbe9-8d79-4d15-b316-2ff1adeff526"); private static final UUID uuidAbbreviation = UUID.fromString("5837e34e-b0f5-4736-8083-ff5eaecd8c43"); private static final UUID uuidOrder = UUID.fromString("ecb7770d-a295-49ee-a88f-e9e137a7cabb"); private static final UUID uuidInformalCategory = UUID.fromString("11bbc52f-a085-43d3-9f9b-cbe0d1eb9a91"); + private static final UUID uuidUrl = UUID.fromString("d769fa9f-51ee-4e11-8152-b5ce72b7f413"); protected static Map termMap = null; + /** + * Creates a new empty extension type instance. + * + * @see #NewInstance(String, String, String) + */ + public static ExtensionType NewInstance() { + return new ExtensionType(); + } + + /** + * Creates a new extension type instance with a description (in the {@link Language#DEFAULT() default language}), + * a label and a label abbreviation. + * + * @param term the string (in the default language) describing the + * new extension type to be created + * @param label the string identifying the new extension type to be created + * @param labelAbbrev the string identifying (in abbreviated form) the + * new extension type to be created + * @see #readCsvLine(List, Language) + * @see #NewInstance() + */ + public static ExtensionType NewInstance(String term, String label, String labelAbbrev){ + return new ExtensionType(term, label, labelAbbrev); + } + + //public only for Term Loader + @Deprecated public ExtensionType() { - super(); } - public ExtensionType(String term, String label, String labelAbbrev) { + + /** + * Class constructor: creates a new extension type instance with a description (in the {@link Language#DEFAULT() default language}), + * a label and a label abbreviation. + * + * @param term the string (in the default language) describing the + * new extension type to be created + * @param label the string identifying the new extension type to be created + * @param labelAbbrev the string identifying (in abbreviated form) the + * new extension type to be created + * @see #ExtensionType() + */ + protected ExtensionType(String term, String label, String labelAbbrev) { super(term, label, labelAbbrev); } @@ -81,9 +125,9 @@ public class ExtensionType extends DefinedTermBase { } - public static final ExtensionType SECOND_NOM_REF(){ - return getTermByUuid(uuid2ndNomRef); - } +// public static final ExtensionType SECOND_NOM_REF(){ +// return getTermByUuid(uuid2ndNomRef); +// } public static final ExtensionType THIRD_HYBRID_PARENT(){ @@ -109,13 +153,17 @@ public class ExtensionType extends DefinedTermBase { public static final ExtensionType INFORMAL_CATEGORY(){ return getTermByUuid(uuidInformalCategory); } + + public static final ExtensionType URL(){ + return getTermByUuid(uuidUrl); + } @Override protected void setDefaultTerms(TermVocabulary termVocabulary) { termMap = new HashMap(); for (ExtensionType term : termVocabulary.getTerms()){ - termMap.put(term.getUuid(), (ExtensionType)term); + termMap.put(term.getUuid(), term); } }