Project

General

Profile

Revision 8031e671

ID8031e671dcc298b8f5d0af296a9db7ac2dcb7421
Parent 67d683a7
Child 70368530

Added by Andreas Müller over 2 years ago

ref #6618 add class Character and attributes structure and property

View differences:

cdmlib-model/src/main/java/eu/etaxonomy/cdm/model/description/Character.java
1
/**
2
* Copyright (C) 2017 EDIT
3
* European Distributed Institute of Taxonomy
4
* http://www.e-taxonomy.eu
5
*
6
* The contents of this file are subject to the Mozilla Public License Version 1.1
7
* See LICENSE.TXT at the top of this package for the full license terms.
8
*/
9
package eu.etaxonomy.cdm.model.description;
10

  
11
import java.util.List;
12

  
13
import javax.persistence.Entity;
14
import javax.persistence.FetchType;
15
import javax.persistence.ManyToOne;
16
import javax.xml.bind.annotation.XmlAccessType;
17
import javax.xml.bind.annotation.XmlAccessorType;
18
import javax.xml.bind.annotation.XmlElement;
19
import javax.xml.bind.annotation.XmlIDREF;
20
import javax.xml.bind.annotation.XmlRootElement;
21
import javax.xml.bind.annotation.XmlSchemaType;
22
import javax.xml.bind.annotation.XmlType;
23

  
24
import org.apache.log4j.Logger;
25
import org.hibernate.annotations.Cascade;
26
import org.hibernate.annotations.CascadeType;
27
import org.hibernate.envers.Audited;
28
import org.hibernate.search.annotations.IndexedEmbedded;
29

  
30
import eu.etaxonomy.cdm.model.common.Language;
31

  
32
/**
33
 * A subclass of the Feature class that is meant for handling
34
 * Features/Characters for desriptions in the narrow sense of describing
35
 * an object.
36
 *
37
 * @author a.mueller
38
 * @date 04.05.2017
39
 *
40
 * @deprecated This class is still experimental. It may be changed
41
 * or even deleted in future without notice.
42
 */
43

  
44
@XmlAccessorType(XmlAccessType.PROPERTY)
45
@XmlType(name="Feature", factoryMethod="NewInstance", propOrder = {
46
        "structure",
47
        "property"
48
})
49
@XmlRootElement(name = "Feature")
50
@Entity
51
@Audited
52
@Deprecated
53
public class Character extends Feature {
54

  
55
    private static final long serialVersionUID = -5631282599057455256L;
56
    @SuppressWarnings("unused")
57
    private static final Logger logger = Logger.getLogger(Feature.class);
58

  
59

  
60
    @XmlElement(name = "Structure")
61
    @XmlIDREF
62
    @XmlSchemaType(name = "IDREF")
63
    @ManyToOne(fetch = FetchType.LAZY)
64
    @IndexedEmbedded
65
    @Cascade({CascadeType.SAVE_UPDATE,CascadeType.MERGE})
66
    private FeatureNode structure;
67

  
68
    @XmlElement(name = "Property")
69
    @XmlIDREF
70
    @XmlSchemaType(name = "IDREF")
71
    @ManyToOne(fetch = FetchType.LAZY)
72
    @IndexedEmbedded
73
    @Cascade({CascadeType.SAVE_UPDATE,CascadeType.MERGE})
74
    private FeatureNode property;
75

  
76
/* ***************** CONSTRUCTOR AND FACTORY METHODS **********************************/
77

  
78

  
79
    /**
80
     * Creates a new empty feature instance.
81
     *
82
     * @see #NewInstance(String, String, String)
83
     */
84
    public static Character NewInstance() {
85
        return new Character();
86
    }
87

  
88
    /**
89
     * Creates a new feature instance with a description (in the {@link Language#DEFAULT() default language}),
90
     * a label and a label abbreviation.
91
     *
92
     * @param   term         the string (in the default language) describing the
93
     *                       new feature to be created
94
     * @param   label        the string identifying the new feature to be created
95
     * @param   labelAbbrev  the string identifying (in abbreviated form) the
96
     *                       new feature to be created
97
     * @see                  #readCsvLine(List, Language)
98
     * @see                  #NewInstance()
99
     */
100
    public static Character NewInstance(FeatureNode structure, FeatureNode property){
101
        return new Character(structure, property, null, null, null);
102
    }
103

  
104
    public static Character NewInstance(FeatureNode structure, FeatureNode property, String term, String label, String labelAbbrev){
105
        return new Character(structure, property, term, label, labelAbbrev);
106
    }
107

  
108

  
109
    //for hibernate use only
110
    @Deprecated
111
    protected Character() {
112
        super();
113
    }
114

  
115

  
116
    /**
117
     * Class constructor: creates a new feature instance with a description (in the {@link Language#DEFAULT() default language}),
118
     * a label and a label abbreviation.
119
     *
120
     * @param   term         the string (in the default language) describing the
121
     *                       new feature to be created
122
     * @param   label        the string identifying the new feature to be created
123
     * @param   labelAbbrev  the string identifying (in abbreviated form) the
124
     *                       new feature to be created
125
     * @see                  #Feature()
126
     */
127
    protected Character(FeatureNode structure, FeatureNode property, String term, String label, String labelAbbrev) {
128
        super(term, label, labelAbbrev);
129
        this.structure = structure;
130
        this.property = property;
131
    }
132
}
cdmlib-persistence/src/main/java/eu/etaxonomy/cdm/database/update/v41_47/SchemaUpdater_41_47.java
133 133
        step = ColumnAdder.NewDateTimeInstance(stepName, tableName, newColumnName, INCLUDE_AUDIT, !NOT_NULL);
134 134
        stepList.add(step);
135 135

  
136
        //#6618 Add structure column to DefinedTermBase (Character)
137
        stepName = "Add structure column to DefinedTermBase (Character)";
138
        tableName = "DefinedTermBase";
139
        newColumnName = "structure_id";
140
        referencedTable = "FeatureNode";
141
        step = ColumnAdder.NewIntegerInstance(stepName, tableName, newColumnName, INCLUDE_AUDIT, !NOT_NULL, referencedTable);
142
        stepList.add(step);
143

  
144
        //#6618 Add property column to DefinedTermBase (Character)
145
        stepName = "Add property column to DefinedTermBase (Character)";
146
        tableName = "DefinedTermBase";
147
        newColumnName = "property_id";
148
        referencedTable = "FeatureNode";
149
        step = ColumnAdder.NewIntegerInstance(stepName, tableName, newColumnName, INCLUDE_AUDIT, !NOT_NULL, referencedTable);
150
        stepList.add(step);
151

  
152

  
136 153
        //#6535 update termtype for CdmMetaData (int => string)
137 154

  
138 155
        //ModelUpdateResult
cdmlib-persistence/src/main/resources/eu/etaxonomy/cdm/hibernate.cfg.xml
95 95
      <mapping class="eu.etaxonomy.cdm.model.description.DescriptionElementSource"/>
96 96
      <mapping class="eu.etaxonomy.cdm.model.description.Distribution"/>
97 97
      <mapping class="eu.etaxonomy.cdm.model.description.Feature"/>
98
      <mapping class="eu.etaxonomy.cdm.model.description.Character"/>
98 99
      <mapping class="eu.etaxonomy.cdm.model.description.FeatureNode"/>
99 100
      <mapping class="eu.etaxonomy.cdm.model.description.FeatureTree"/>
100 101
      <mapping class="eu.etaxonomy.cdm.model.description.KeyStatement"/>
cdmlib-test/src/main/resources/dbscripts/001-cdm.h2.sql
946 946
    LEVEL_ID INTEGER,
947 947
    POINTAPPROXIMATION_REFERENCESYSTEM_ID INTEGER,
948 948
    SHAPE_ID INTEGER,
949
    TYPE_ID INTEGER
949
    TYPE_ID INTEGER,
950
	STRUCTURE_ID INTEGER,
951
	PROPERTY_ID INTEGER,
950 952
);
951 953
-- 2084 +/- SELECT COUNT(*) FROM PUBLIC.DEFINEDTERMBASE;
952 954
CREATE CACHED TABLE PUBLIC.DEFINEDTERMBASE_AUD(
......
984 986
    SUPPORTSQUANTITATIVEDATA BOOLEAN,
985 987
    SUPPORTSTAXONINTERACTION BOOLEAN,
986 988
    SUPPORTSTEXTDATA BOOLEAN,
989
    SYMMETRICAL BOOLEAN,
990
    TRANSITIVE BOOLEAN,
987 991
    ISTECHNICAL BOOLEAN,
988 992
    ABSENCETERM BOOLEAN NOT NULL,
989 993
    DEFAULTCOLOR VARCHAR(255),
......
993 997
    VALIDPERIOD_END VARCHAR(255),
994 998
    VALIDPERIOD_FREETEXT VARCHAR(255),
995 999
    VALIDPERIOD_START VARCHAR(255),
996
    LEVEL_ID INTEGER,
1000
    ISO3166_A2 VARCHAR(2),
1001
 	LEVEL_ID INTEGER,
997 1002
    POINTAPPROXIMATION_REFERENCESYSTEM_ID INTEGER,
998 1003
    SHAPE_ID INTEGER,
999 1004
    TYPE_ID INTEGER,
1000
    ISO3166_A2 VARCHAR(2),
1001
    SYMMETRICAL BOOLEAN,
1002
    TRANSITIVE BOOLEAN
1005
    STRUCTURE_ID INTEGER,
1006
	PROPERTY_ID INTEGER,
1003 1007
);
1004 1008
-- 2084 +/- SELECT COUNT(*) FROM PUBLIC.DEFINEDTERMBASE_AUD;
1005 1009
CREATE CACHED TABLE PUBLIC.DEFINEDTERMBASE_ANNOTATION(
cdmlib-test/src/main/resources/eu/etaxonomy/cdm/database/schema/dataset.dtd
804 804
    UPDATED CDATA #IMPLIED
805 805
    TERMTYPE CDATA #IMPLIED
806 806
    URI CDATA #IMPLIED
807
    TITLECACHE CDATA #IMPLIED
808
    PROTECTEDTITLECACHE CDATA #IMPLIED
807 809
    RANKCLASS CDATA #IMPLIED
808 810
    ORDERINDEX CDATA #IMPLIED
809 811
    IDINVOCABULARY CDATA #IMPLIED
......
835 837
    POINTAPPROXIMATION_REFERENCESYSTEM_ID CDATA #IMPLIED
836 838
    SHAPE_ID CDATA #IMPLIED
837 839
    TYPE_ID CDATA #IMPLIED
838
    TITLECACHE CDATA #IMPLIED
839
    PROTECTEDTITLECACHE CDATA #IMPLIED
840
    STRUCTURE_ID CDATA #IMPLIED
840 841
>
841 842

  
842 843
<!ELEMENT DEFINEDTERMBASE_AUD EMPTY>
......
850 851
    UPDATED CDATA #IMPLIED
851 852
    TERMTYPE CDATA #IMPLIED
852 853
    URI CDATA #IMPLIED
854
    TITLECACHE CDATA #IMPLIED
855
    PROTECTEDTITLECACHE CDATA #IMPLIED
853 856
    RANKCLASS CDATA #IMPLIED
854 857
    CREATEDBY_ID CDATA #IMPLIED
855 858
    UPDATEDBY_ID CDATA #IMPLIED
......
861 864
    ISO639_1 CDATA #IMPLIED
862 865
    ABSENCETERM CDATA #IMPLIED
863 866
    ISTECHNICAL CDATA #IMPLIED
867
    SYMMETRICAL CDATA #IMPLIED
868
    TRANSITIVE CDATA #IMPLIED
864 869
    DEFAULTCOLOR CDATA #IMPLIED
865 870
    SUPPORTSCOMMONTAXONNAME CDATA #IMPLIED
866 871
    SUPPORTSDISTRIBUTION CDATA #IMPLIED
......
874 879
    POINTAPPROXIMATION_LONGITUDE CDATA #IMPLIED
875 880
    VALIDPERIOD_END CDATA #IMPLIED
876 881
    VALIDPERIOD_START CDATA #IMPLIED
882
    ISO3166_A2 CDATA #IMPLIED
877 883
    LEVEL_ID CDATA #IMPLIED
878 884
    POINTAPPROXIMATION_REFERENCESYSTEM_ID CDATA #IMPLIED
879 885
    SHAPE_ID CDATA #IMPLIED
880 886
    TYPE_ID CDATA #IMPLIED
881
    SYMMETRICAL CDATA #IMPLIED
882
    TRANSITIVE CDATA #IMPLIED
883
    ISO3166_A2 CDATA #IMPLIED
884
    TITLECACHE CDATA #IMPLIED
885
    PROTECTEDTITLECACHE CDATA #IMPLIED
887
    TYPE_ID CDATA #IMPLIED
888
    STRUCTURE_ID CDATA #IMPLIED
886 889
>
887 890

  
888 891
<!ELEMENT DEFINEDTERMBASE_CONTINENT EMPTY>
cdmlib-test/src/test/resources/eu/etaxonomy/cdm/hibernate.cfg.xml
95 95
      <mapping class="eu.etaxonomy.cdm.model.description.DescriptionElementSource"/>
96 96
      <mapping class="eu.etaxonomy.cdm.model.description.Distribution"/>
97 97
      <mapping class="eu.etaxonomy.cdm.model.description.Feature"/>
98
      <mapping class="eu.etaxonomy.cdm.model.description.Character"/>
98 99
      <mapping class="eu.etaxonomy.cdm.model.description.FeatureNode"/>
99 100
      <mapping class="eu.etaxonomy.cdm.model.description.FeatureTree"/>
100 101
      <mapping class="eu.etaxonomy.cdm.model.description.KeyStatement"/>

Also available in: Unified diff

Add picture from clipboard (Maximum size: 40 MB)