Project

General

Profile

« Previous | Next » 

Revision e0212247

Added by Niels Hoffmann about 13 years ago

Reverting the RightsTerm -> RightsType change (see #1306). This is a model change and needs updates to the schema. We will transfer this into a branch.

View differences:

.gitattributes
594 594
cdmlib-model/src/main/java/eu/etaxonomy/cdm/model/media/MovieFile.java -text
595 595
cdmlib-model/src/main/java/eu/etaxonomy/cdm/model/media/ReferencedMedia.java -text
596 596
cdmlib-model/src/main/java/eu/etaxonomy/cdm/model/media/Rights.java -text
597
cdmlib-model/src/main/java/eu/etaxonomy/cdm/model/media/RightsType.java -text
597
cdmlib-model/src/main/java/eu/etaxonomy/cdm/model/media/RightsTerm.java -text
598 598
cdmlib-model/src/main/java/eu/etaxonomy/cdm/model/media/package-info.java -text
599 599
cdmlib-model/src/main/java/eu/etaxonomy/cdm/model/molecular/DnaSample.java -text
600 600
cdmlib-model/src/main/java/eu/etaxonomy/cdm/model/molecular/GenBankAccession.java -text
cdmlib-io/src/main/java/eu/etaxonomy/cdm/io/jaxb/DataSet.java
62 62
import eu.etaxonomy.cdm.model.location.TdwgArea;
63 63
import eu.etaxonomy.cdm.model.location.WaterbodyOrCountry;
64 64
import eu.etaxonomy.cdm.model.media.Media;
65
import eu.etaxonomy.cdm.model.media.RightsType;
65
import eu.etaxonomy.cdm.model.media.RightsTerm;
66 66
import eu.etaxonomy.cdm.model.molecular.DnaSample;
67 67
import eu.etaxonomy.cdm.model.molecular.PhylogeneticTree;
68 68
import eu.etaxonomy.cdm.model.name.BacterialName;
......
159 159
    	@XmlElement(name = "PreservationMethod", namespace = "http://etaxonomy.eu/cdm/model/occurrence/1.0", type = PreservationMethod.class),
160 160
        @XmlElement(name = "Rank", namespace = "http://etaxonomy.eu/cdm/model/name/1.0", type = Rank.class),
161 161
    	@XmlElement(name = "ReferenceSystem", namespace = "http://etaxonomy.eu/cdm/model/location/1.0", type = ReferenceSystem.class),
162
    	@XmlElement(name = "RightsType", namespace = "http://etaxonomy.eu/cdm/model/media/1.0", type = RightsType.class),
162
    	@XmlElement(name = "RightsTerm", namespace = "http://etaxonomy.eu/cdm/model/media/1.0", type = RightsTerm.class),
163 163
    	@XmlElement(name = "Scope", namespace = "http://etaxonomy.eu/cdm/model/description/1.0", type = Scope.class),
164 164
    	@XmlElement(name = "Sex", namespace = "http://etaxonomy.eu/cdm/model/description/1.0", type = Sex.class),
165 165
    	@XmlElement(name = "SpecimenTypeDesignationStatus", namespace = "http://etaxonomy.eu/cdm/model/name/1.0", type = SpecimenTypeDesignationStatus.class),
cdmlib-io/src/main/java/eu/etaxonomy/cdm/io/sdd/out/SDDDataSet.java
62 62
import eu.etaxonomy.cdm.model.location.NamedAreaType;
63 63
import eu.etaxonomy.cdm.model.location.ReferenceSystem;
64 64
import eu.etaxonomy.cdm.model.location.WaterbodyOrCountry;
65
import eu.etaxonomy.cdm.model.media.RightsType;
65
import eu.etaxonomy.cdm.model.media.RightsTerm;
66 66
import eu.etaxonomy.cdm.model.molecular.DnaSample;
67 67
import eu.etaxonomy.cdm.model.name.BacterialName;
68 68
import eu.etaxonomy.cdm.model.name.BotanicalName;
......
187 187
    	@XmlElement(name = "PreservationMethod", namespace = "http://etaxonomy.eu/cdm/model/occurrence/1.0", type = PreservationMethod.class),
188 188
        @XmlElement(name = "Rank", namespace = "http://etaxonomy.eu/cdm/model/name/1.0", type = Rank.class),
189 189
    	@XmlElement(name = "ReferenceSystem", namespace = "http://etaxonomy.eu/cdm/model/location/1.0", type = ReferenceSystem.class),
190
    	@XmlElement(name = "RightsType", namespace = "http://etaxonomy.eu/cdm/model/media/1.0", type = RightsType.class),
190
    	@XmlElement(name = "RightsTerm", namespace = "http://etaxonomy.eu/cdm/model/media/1.0", type = RightsTerm.class),
191 191
    	@XmlElement(name = "Scope", namespace = "http://etaxonomy.eu/cdm/model/description/1.0", type = Scope.class),
192 192
    	@XmlElement(name = "Sex", namespace = "http://etaxonomy.eu/cdm/model/description/1.0", type = Sex.class),
193 193
    	@XmlElement(name = "Stage", namespace = "http://etaxonomy.eu/cdm/model/description/1.0", type = Stage.class),
cdmlib-model/src/main/java/eu/etaxonomy/cdm/model/common/DefinedTermBase.java
49 49
import eu.etaxonomy.cdm.model.location.NamedAreaType;
50 50
import eu.etaxonomy.cdm.model.location.ReferenceSystem;
51 51
import eu.etaxonomy.cdm.model.media.Media;
52
import eu.etaxonomy.cdm.model.media.RightsType;
52
import eu.etaxonomy.cdm.model.media.RightsTerm;
53 53
import eu.etaxonomy.cdm.model.name.NomenclaturalCode;
54 54
import eu.etaxonomy.cdm.model.occurrence.DerivationEventType;
55 55
import eu.etaxonomy.cdm.model.occurrence.PreservationMethod;
......
82 82
    NomenclaturalCode.class,
83 83
    PreservationMethod.class,
84 84
    ReferenceSystem.class,
85
    RightsType.class,
85
    RightsTerm.class,
86 86
    StatisticalMeasure.class,
87 87
    TextFormat.class
88 88
})
cdmlib-model/src/main/java/eu/etaxonomy/cdm/model/common/VocabularyEnum.java
31 31
import eu.etaxonomy.cdm.model.location.ReferenceSystem;
32 32
import eu.etaxonomy.cdm.model.location.TdwgArea;
33 33
import eu.etaxonomy.cdm.model.location.WaterbodyOrCountry;
34
import eu.etaxonomy.cdm.model.media.RightsType;
34
import eu.etaxonomy.cdm.model.media.RightsTerm;
35 35
import eu.etaxonomy.cdm.model.name.HybridRelationshipType;
36 36
import eu.etaxonomy.cdm.model.name.NameRelationshipType;
37 37
import eu.etaxonomy.cdm.model.name.NameTypeDesignationStatus;
......
76 76
	PreservationMethod("a7dc20c9-e6b3-459e-8f05-8d6d8fceb465", PreservationMethod.class),
77 77
	DeterminationModifier("fe87ea8d-6e0a-4e5d-b0da-0ab8ea67ca77", DeterminationModifier.class),
78 78
	StatisticalMeasure("066cc62e-7213-495e-a020-97a1233bc037", StatisticalMeasure.class),
79
	RightsType("8627c526-73af-44d9-902c-11c1f11b60b4", RightsType.class),
79
	RightsTerm("8627c526-73af-44d9-902c-11c1f11b60b4", RightsTerm.class),
80 80
	NameTypeDesignationStatus("ab60e738-4d09-4c24-a1b3-9466b01f9f55", NameTypeDesignationStatus.class),
81 81
	ExtensionType("117cc307-5bd4-4b10-9b2f-2e14051b3b20",ExtensionType.class),
82 82
	ReferenceSystem("ec6376e5-0c9c-4f5c-848b-b288e6c17a86",ReferenceSystem.class),
cdmlib-model/src/main/java/eu/etaxonomy/cdm/model/media/Rights.java
63 63
	@XmlIDREF
64 64
	@XmlSchemaType(name = "IDREF")
65 65
	@ManyToOne(fetch = FetchType.LAZY)
66
	private RightsType type;
66
	private RightsTerm type;
67 67
	
68 68
	// owner etc as defined by the rightstype
69 69
	@XmlElement(name = "Agent")
......
105 105
		super(text, language);
106 106
	}
107 107

  
108
	public RightsType getType(){
108
	public RightsTerm getType(){
109 109
		return this.type;
110 110
	}
111 111
	
112
	public void setType(RightsType type){
112
	public void setType(RightsTerm type){
113 113
		this.type = type;
114 114
	}
115 115

  
cdmlib-model/src/main/java/eu/etaxonomy/cdm/model/media/RightsTerm.java
1
/**
2
* Copyright (C) 2007 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

  
10
package eu.etaxonomy.cdm.model.media;
11

  
12
import java.util.HashMap;
13
import java.util.Map;
14
import java.util.UUID;
15

  
16
import javax.persistence.Entity;
17
import javax.xml.bind.annotation.XmlAccessType;
18
import javax.xml.bind.annotation.XmlAccessorType;
19
import javax.xml.bind.annotation.XmlRootElement;
20
import javax.xml.bind.annotation.XmlType;
21

  
22
import org.apache.log4j.Logger;
23
import org.hibernate.envers.Audited;
24
import org.hibernate.search.annotations.Indexed;
25

  
26
import eu.etaxonomy.cdm.model.common.DefinedTermBase;
27
import eu.etaxonomy.cdm.model.common.TermVocabulary;
28

  
29
/**
30
 * @author m.doering
31
 * @version 1.0
32
 * @created 08-Nov-2007 13:06:50
33
 */
34
@XmlAccessorType(XmlAccessType.FIELD)
35
@XmlType(name = "RightsTerm")
36
@XmlRootElement(name = "RightsTerm")
37
@Entity
38
@Indexed(index = "eu.etaxonomy.cdm.model.common.DefinedTermBase")
39
@Audited
40
public class RightsTerm extends DefinedTermBase<RightsTerm> {
41
	private static final long serialVersionUID = -5823263624000932116L;
42
	private static final Logger logger = Logger.getLogger(RightsTerm.class);
43

  
44
	protected static Map<UUID, RightsTerm> termMap = null;		
45

  
46
	
47
	/**
48
	 * Factory method
49
	 * @return
50
	 */
51
	public static RightsTerm NewInstance(){
52
		logger.debug("NewInstance");
53
		return new RightsTerm();
54
	}
55

  
56
	/**
57
	 * Factory method
58
	 * @return
59
	 */
60
	public static RightsTerm NewInstance(String text, String label, String labelAbbrev){
61
		return new RightsTerm(text, label, labelAbbrev);
62
	}
63
	
64
	/**
65
	 * Default Constructor
66
	 */
67
	public RightsTerm() {
68
	}
69

  
70
	/**
71
	 * Constructor
72
	 */
73
	public RightsTerm(String term, String label, String labelAbbrev) {
74
		super(term, label, labelAbbrev);
75
	}
76

  
77
	
78

  
79
// ************************************* MTEHODS ***************************************************/	
80
	
81
	/* (non-Javadoc)
82
	 * @see eu.etaxonomy.cdm.model.common.DefinedTermBase#resetTerms()
83
	 */
84
	@Override
85
	public void resetTerms(){
86
		termMap = null;
87
	}
88
	
89
	protected static RightsTerm getTermByUuid(UUID uuid){
90
		if (termMap == null){
91
			return null;  //better return null then initialize the termMap in an unwanted way 
92
		}
93
		return (RightsTerm)termMap.get(uuid);
94
	}
95
	
96
	/**
97
	 * http://purl.org/dc/terms/accessRights
98
	 */
99
	public static final RightsTerm ACCESS_RIGHTS(){
100
		return getTermByUuid(uuidAccessRights);
101
	}
102

  
103
	public static final RightsTerm COPYRIGHT(){
104
		return getTermByUuid(uuidCopyright);
105
	}
106

  
107
	public static final RightsTerm LICENSE(){
108
		return getTermByUuid(uuidLicense);
109
	}
110
	
111
	private static final UUID uuidLicense = UUID.fromString("67c0d47e-8985-1014-8845-c84599f9992c");
112
	private static final UUID uuidCopyright = UUID.fromString("d1ef838e-b195-4f28-b8eb-0d3be080bd37");
113
	private static final UUID uuidAccessRights = UUID.fromString("a50b4def-b3ac-4508-b50a-e0f249e3a1d7");
114

  
115

  
116
	@Override
117
	protected void setDefaultTerms(TermVocabulary<RightsTerm> termVocabulary) {
118
		termMap = new HashMap<UUID, RightsTerm>();
119
		for (RightsTerm term : termVocabulary.getTerms()){
120
			termMap.put(term.getUuid(), (RightsTerm)term);
121
		}	
122
	}
123

  
124
}
cdmlib-model/src/main/java/eu/etaxonomy/cdm/model/media/RightsType.java
1
/**
2
* Copyright (C) 2007 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

  
10
package eu.etaxonomy.cdm.model.media;
11

  
12
import java.util.HashMap;
13
import java.util.Map;
14
import java.util.UUID;
15

  
16
import javax.persistence.Entity;
17
import javax.xml.bind.annotation.XmlAccessType;
18
import javax.xml.bind.annotation.XmlAccessorType;
19
import javax.xml.bind.annotation.XmlRootElement;
20
import javax.xml.bind.annotation.XmlType;
21

  
22
import org.apache.log4j.Logger;
23
import org.hibernate.envers.Audited;
24
import org.hibernate.search.annotations.Indexed;
25

  
26
import eu.etaxonomy.cdm.model.common.DefinedTermBase;
27
import eu.etaxonomy.cdm.model.common.TermVocabulary;
28

  
29
/**
30
 * @author m.doering
31
 * @version 1.0
32
 * @created 08-Nov-2007 13:06:50
33
 */
34
@XmlAccessorType(XmlAccessType.FIELD)
35
@XmlType(name = "RightsType")
36
@XmlRootElement(name = "RightsType")
37
@Entity
38
@Indexed(index = "eu.etaxonomy.cdm.model.common.DefinedTermBase")
39
@Audited
40
public class RightsType extends DefinedTermBase<RightsType> {
41
	private static final long serialVersionUID = -5823263624000932116L;
42
	private static final Logger logger = Logger.getLogger(RightsType.class);
43

  
44
	protected static Map<UUID, RightsType> termMap = null;		
45

  
46
	
47
	/**
48
	 * Factory method
49
	 * @return
50
	 */
51
	public static RightsType NewInstance(){
52
		logger.debug("NewInstance");
53
		return new RightsType();
54
	}
55

  
56
	/**
57
	 * Factory method
58
	 * @return
59
	 */
60
	public static RightsType NewInstance(String text, String label, String labelAbbrev){
61
		return new RightsType(text, label, labelAbbrev);
62
	}
63
	
64
	/**
65
	 * Default Constructor
66
	 */
67
	public RightsType() {
68
	}
69

  
70
	/**
71
	 * Constructor
72
	 */
73
	public RightsType(String term, String label, String labelAbbrev) {
74
		super(term, label, labelAbbrev);
75
	}
76

  
77
	
78

  
79
// ************************************* MTEHODS ***************************************************/	
80
	
81
	/* (non-Javadoc)
82
	 * @see eu.etaxonomy.cdm.model.common.DefinedTermBase#resetTerms()
83
	 */
84
	@Override
85
	public void resetTerms(){
86
		termMap = null;
87
	}
88
	
89
	protected static RightsType getTermByUuid(UUID uuid){
90
		if (termMap == null){
91
			return null;  //better return null then initialize the termMap in an unwanted way 
92
		}
93
		return (RightsType)termMap.get(uuid);
94
	}
95
	
96
	/**
97
	 * http://purl.org/dc/terms/accessRights
98
	 */
99
	public static final RightsType ACCESS_RIGHTS(){
100
		return getTermByUuid(uuidAccessRights);
101
	}
102

  
103
	public static final RightsType COPYRIGHT(){
104
		return getTermByUuid(uuidCopyright);
105
	}
106

  
107
	public static final RightsType LICENSE(){
108
		return getTermByUuid(uuidLicense);
109
	}
110
	
111
	private static final UUID uuidLicense = UUID.fromString("67c0d47e-8985-1014-8845-c84599f9992c");
112
	private static final UUID uuidCopyright = UUID.fromString("d1ef838e-b195-4f28-b8eb-0d3be080bd37");
113
	private static final UUID uuidAccessRights = UUID.fromString("a50b4def-b3ac-4508-b50a-e0f249e3a1d7");
114

  
115

  
116
	@Override
117
	protected void setDefaultTerms(TermVocabulary<RightsType> termVocabulary) {
118
		termMap = new HashMap<UUID, RightsType>();
119
		for (RightsType term : termVocabulary.getTerms()){
120
			termMap.put(term.getUuid(), (RightsType)term);
121
		}	
122
	}
123

  
124
}
cdmlib-persistence/src/main/java/eu/etaxonomy/cdm/persistence/dao/hibernate/common/DefinedTermDaoImpl.java
51 51
import eu.etaxonomy.cdm.model.location.TdwgArea;
52 52
import eu.etaxonomy.cdm.model.location.WaterbodyOrCountry;
53 53
import eu.etaxonomy.cdm.model.media.Media;
54
import eu.etaxonomy.cdm.model.media.RightsType;
54
import eu.etaxonomy.cdm.model.media.RightsTerm;
55 55
import eu.etaxonomy.cdm.model.name.HybridRelationshipType;
56 56
import eu.etaxonomy.cdm.model.name.NameRelationshipType;
57 57
import eu.etaxonomy.cdm.model.name.NameTypeDesignationStatus;
......
102 102
		indexedClasses[19] = ReferenceSystem.class;
103 103
		indexedClasses[20] = TdwgArea.class;
104 104
		indexedClasses[21] = WaterbodyOrCountry.class;
105
		indexedClasses[22] = RightsType.class;
105
		indexedClasses[22] = RightsTerm.class;
106 106
		indexedClasses[23] = HybridRelationshipType.class;
107 107
		indexedClasses[24] = NameRelationshipType.class;
108 108
		indexedClasses[25] = NameTypeDesignationStatus.class;
cdmlib-persistence/src/test/java/eu/etaxonomy/cdm/persistence/dao/hibernate/common/CdmGenericDaoImplTest.java
106 106
import eu.etaxonomy.cdm.model.media.MovieFile;
107 107
import eu.etaxonomy.cdm.model.media.ReferencedMedia;
108 108
import eu.etaxonomy.cdm.model.media.Rights;
109
import eu.etaxonomy.cdm.model.media.RightsType;
109
import eu.etaxonomy.cdm.model.media.RightsTerm;
110 110
import eu.etaxonomy.cdm.model.molecular.DnaSample;
111 111
import eu.etaxonomy.cdm.model.molecular.GenBankAccession;
112 112
import eu.etaxonomy.cdm.model.molecular.Locus;
......
406 406
				MovieFile.class, 
407 407
				ReferencedMedia.class, 
408 408
				Rights.class, 
409
				RightsType.class, 
409
				RightsTerm.class, 
410 410
				DnaSample.class, 
411 411
				GenBankAccession.class, 
412 412
				Locus.class, 

Also available in: Unified diff