Project

General

Profile

« Previous | Next » 

Revision fa63b6b4

Added by Andreas Müller over 5 years ago

cleanup

View differences:

cdmlib-io/src/main/java/eu/etaxonomy/cdm/io/common/ResultSetPartitioner.java
170 170
	 * @return
171 171
	 * @throws SQLException
172 172
	 */
173
	public boolean nextPartition() throws SQLException{
173
    public boolean nextPartition() throws SQLException{
174 174
		boolean result = false;
175 175
		ResultSetMetaData metaData = idResultSet.getMetaData();
176 176
		int nOfIdColumns = metaData.getColumnCount();
177 177
		currentPartition++;
178
		currentIdLists = new List[nOfIdColumns];
178
		currentIdLists = new ArrayList[nOfIdColumns];
179 179
		currentIdListType = new int[nOfIdColumns];
180 180

  
181 181
		for (int col = 0; col< currentIdLists.length; col++){
cdmlib-io/src/main/java/eu/etaxonomy/cdm/io/common/mapping/DbImportAnnotationMapper.java
1 1
/**
2 2
* Copyright (C) 2007 EDIT
3
* European Distributed Institute of Taxonomy 
3
* European Distributed Institute of Taxonomy
4 4
* http://www.e-taxonomy.eu
5
* 
5
*
6 6
* The contents of this file are subject to the Mozilla Public License Version 1.1
7 7
* See LICENSE.TXT at the top of this package for the full license terms.
8 8
*/
......
13 13
import java.sql.SQLException;
14 14
import java.util.UUID;
15 15

  
16
import org.apache.commons.lang3.StringUtils;
16 17
import org.apache.log4j.Logger;
17 18

  
18 19
import eu.etaxonomy.cdm.api.service.ITermService;
19 20
import eu.etaxonomy.cdm.api.service.IVocabularyService;
20
import eu.etaxonomy.cdm.common.CdmUtils;
21 21
import eu.etaxonomy.cdm.io.common.CdmImportBase;
22 22
import eu.etaxonomy.cdm.io.common.DbImportStateBase;
23 23
import eu.etaxonomy.cdm.model.common.AnnotatableEntity;
24 24
import eu.etaxonomy.cdm.model.common.Annotation;
25 25
import eu.etaxonomy.cdm.model.common.AnnotationType;
26 26
import eu.etaxonomy.cdm.model.common.CdmBase;
27
import eu.etaxonomy.cdm.model.common.DefinedTermBase;
27 28
import eu.etaxonomy.cdm.model.common.Language;
28 29
import eu.etaxonomy.cdm.model.common.TermVocabulary;
29 30

  
......
33 34
 * as it does not map to a single attribute
34 35
 * @author a.mueller
35 36
 * @since 01.03.2010
36
 * @version 1.0
37 37
 */
38 38
public class DbImportAnnotationMapper extends DbSingleAttributeImportMapperBase<DbImportStateBase<?,?>, AnnotatableEntity> implements IDbImportMapper<DbImportStateBase<?,?>,AnnotatableEntity>{
39 39
	private static final Logger logger = Logger.getLogger(DbImportAnnotationMapper.class);
40
	
40

  
41 41
	/**
42 42
	 * FIXME Warning: the annotation type creation is not yet implemented
43 43
	 * @param dbAttributeString
......
52 52
		AnnotationType annotationType = null;
53 53
		return new DbImportAnnotationMapper(dbAttributeString, language, annotationType);
54 54
	}
55
	
55

  
56 56
	/**
57 57
	 * * FIXME Warning: the annotation type creation is not yet implemented
58 58
	 * @param dbAttributeString
......
66 66
		AnnotationType annotationType = null;
67 67
		return new DbImportAnnotationMapper(dbAttributeString, language, annotationType);
68 68
	}
69
	
69

  
70 70
	/**
71 71
	 * @param dbAttributeString
72 72
	 * @param annotationType
......
76 76
		Language language = null;
77 77
		return NewInstance(dbAttributeString, annotationType, language);
78 78
	}
79
	
79

  
80 80
	/**
81 81
	 * @param dbAttributeString
82 82
	 * @param annotationType
......
84 84
	 * @return
85 85
	 */
86 86
	public static DbImportAnnotationMapper NewInstance(String dbAttributeString, AnnotationType annotationType, Language language){
87
//		String label = null;
88
//		String text = null;
89
//		String labelAbbrev = null;
90
//		UUID uuid = null;
91 87
		return new DbImportAnnotationMapper(dbAttributeString, language, annotationType);
92 88
	}
93 89

  
94
	
90

  
95 91
	private AnnotationType annotationType;
96 92
	private Language language;
97 93

  
......
108 104
		this.annotationType = annotationType;
109 105
	}
110 106

  
111

  
112
	/* (non-Javadoc)
113
	 * @see eu.etaxonomy.cdm.io.common.mapping.DbSingleAttributeImportMapperBase#initialize(eu.etaxonomy.cdm.io.common.DbImportStateBase, java.lang.Class)
114
	 */
115 107
	@Override
116 108
	public void initialize(DbImportStateBase<?,?> state, Class<? extends CdmBase> destinationClass) {
117 109
		importMapperHelper.initialize(state, destinationClass);
118 110
	}
119
	
111

  
120 112
//	/**
121 113
//	 * @param service
122 114
//	 * @param state
......
136 128
//			//do nothing
137 129
//		}
138 130
//	}
139
	
140 131

  
141
	/* (non-Javadoc)
142
	 * @see eu.etaxonomy.cdm.io.common.mapping.DbSingleAttributeImportMapperBase#invoke(java.sql.ResultSet, eu.etaxonomy.cdm.model.common.CdmBase)
143
	 */
144 132
	@Override
145 133
	public AnnotatableEntity invoke(ResultSet rs, AnnotatableEntity annotatableEntity) throws SQLException {
146 134
		if (ignore){
......
149 137
		String dbValue = rs.getString(getSourceAttribute());
150 138
		return doInvoke(annotatableEntity, dbValue);
151 139
	}
152
	
153
	/* (non-Javadoc)
154
	 * @see eu.etaxonomy.cdm.io.common.mapping.DbSingleAttributeImportMapperBase#doInvoke(eu.etaxonomy.cdm.model.common.CdmBase, java.lang.Object)
155
	 */
140

  
156 141
	@Override
157 142
	protected AnnotatableEntity doInvoke(AnnotatableEntity annotatableEntity, Object dbValue){
158 143
		String strAnnotation = (String)dbValue;
......
165 150
		return annotatableEntity;
166 151
	}
167 152

  
168

  
169
	
170
	
171 153
	/**
172 154
	 * @param service
173 155
	 * @param uuid
......
185 167
			//set vocabulary //TODO allow user defined vocabularies
186 168
			UUID uuidAnnotationTypeVocabulary = UUID.fromString("ca04609b-1ba0-4d31-9c2e-aa8eb2f4e62d");
187 169
			IVocabularyService vocService = currentImport.getVocabularyService();
188
			TermVocabulary voc = vocService.find(uuidAnnotationTypeVocabulary);
170
			@SuppressWarnings("unchecked")
171
            TermVocabulary<DefinedTermBase<?>> voc = vocService.find(uuidAnnotationTypeVocabulary);
189 172
			if (voc != null){
190 173
				voc.addTerm(annotationType);
191 174
			}else{
......
201 184
	/* (non-Javadoc)
202 185
	 * @see eu.etaxonomy.cdm.io.common.CdmSingleAttributeMapperBase#getTypeClass()
203 186
	 */
204
	public Class<String> getTypeClass(){
187
	@Override
188
    public Class<String> getTypeClass(){
205 189
		return String.class;
206 190
	}
207 191

  
208 192

  
209 193

  
210
	
194

  
211 195

  
212 196
}
cdmlib-io/src/main/java/eu/etaxonomy/cdm/io/common/mapping/DbImportMapping.java
1 1
/**
2 2
* Copyright (C) 2007 EDIT
3
* European Distributed Institute of Taxonomy 
3
* European Distributed Institute of Taxonomy
4 4
* http://www.e-taxonomy.eu
5
* 
5
*
6 6
* The contents of this file are subject to the Mozilla Public License Version 1.1
7 7
* See LICENSE.TXT at the top of this package for the full license terms.
8 8
*/
......
23 23
/**
24 24
 * @author a.mueller
25 25
 * @since 12.05.2009
26
 * @version 1.0
27 26
 */
28 27
public class DbImportMapping<STATE extends DbImportStateBase, CONFIG extends IImportConfigurator> extends CdmIoMapping {
29 28
	private static final Logger logger = Logger.getLogger(DbImportMapping.class);
30
	
31
	private boolean isInitialized = false;;
29

  
30
	private boolean isInitialized = false;
32 31
	private Class<? extends CdmBase> destinationClass;
33 32
	private DbImportMapping<STATE, CONFIG> secondPathMapping;
34 33
	private boolean blankToNull = false;
35
	
34

  
36 35
	public DbImportMapping(){
37 36
//		this.dbTableName = tableName;
38 37
	}
39
	
40
	public boolean initialize(DbImportStateBase state, Class<? extends CdmBase> destinationClass){
38

  
39
	public boolean initialize(DbImportStateBase<?,?> state, Class<? extends CdmBase> destinationClass){
41 40
		if (!isInitialized){
42 41
			//	this.dbTableName = tableName;
43 42
			this.destinationClass = destinationClass;
44 43
			for (CdmMapperBase mapper: this.mapperList){
45 44
				if (mapper instanceof IDbImportMapper){
46
					((IDbImportMapper) mapper).initialize(state, destinationClass);
45
					((IDbImportMapper<DbImportStateBase<?,?>,? extends CdmBase>) mapper ).initialize(state, destinationClass);
47 46
				}else{
48 47
					logger.warn("Mapper type " + mapper.getClass().getSimpleName() + " not yet implemented for DB import mapping");
49 48
				}
......
56 55
		return true;
57 56
	}
58 57

  
59
	public void addMapper(CdmAttributeMapperBase mapper){
58
	@Override
59
    public void addMapper(CdmAttributeMapperBase mapper){
60 60
		super.addMapper(mapper);
61 61
		if (mapper instanceof DbStringMapper){
62 62
			((DbStringMapper)mapper).setBlankToNull(isBlankToNull());
63 63
		}
64 64
	}
65
	
65

  
66 66
	/**
67 67
	 * Invokes the second path mapping if one has been defined
68 68
	 * @param rs
......
72 72
	 */
73 73
	public boolean invoke(ResultSet rs, Set<CdmBase> objectsToSave) throws SQLException{
74 74
		return invoke(rs, objectsToSave, false);
75
	}	
76
	
75
	}
76

  
77 77
	/**
78 78
	 * Invokes the mapping. If secondPath is true, the secondPath mapping is invoked if it exists.
79 79
	 * @param rs
......
91 91
			//		try {
92 92
			for (CdmMapperBase mapper : this.mapperList){
93 93
				if (mapper instanceof IDbImportMapper){
94
					IDbImportMapper<DbImportStateBase<?,?>,CdmBase> dbMapper = (IDbImportMapper)mapper;
94
					@SuppressWarnings("unchecked")
95
                    IDbImportMapper<DbImportStateBase<?,?>,CdmBase> dbMapper = (IDbImportMapper<DbImportStateBase<?,?>,CdmBase>)mapper;
95 96
					try {
96 97
						objectToSave = dbMapper.invoke(rs, objectToSave);
97 98
					} catch (Exception e) {
98 99
						result = false;
99
						logger.error("Error occurred in mapping.invoke of mapper " + this.toString());
100
						logger.error("Error occurred in mapping.invoke of mapper " + dbMapper.toString());
100 101
						e.printStackTrace();
101 102
						continue;
102 103
					}
......
112 113
			return result;
113 114
	}
114 115
	}
115
	
116
	public void setSecondPathMapping(DbImportMapping secondPathMapping){
116

  
117
	public void setSecondPathMapping(DbImportMapping<STATE, CONFIG> secondPathMapping){
117 118
		this.secondPathMapping = secondPathMapping;
118 119
	}
119 120

  
......
147 148
//		this.dbTableName = dbTableName;
148 149
//	}
149 150
//
150
//	
151
//
151 152
//	protected List<CdmAttributeMapperBase> getAttributeMapperList(){
152 153
//		List<CdmAttributeMapperBase> list = this.mapperList;
153 154
//		return list;
154 155
//	}
155
	
156
	
156

  
157

  
157 158
}
cdmlib-io/src/main/java/eu/etaxonomy/cdm/io/common/mapping/DbImportObjectCreationMapper.java
1 1
/**
2 2
* Copyright (C) 2007 EDIT
3
* European Distributed Institute of Taxonomy 
3
* European Distributed Institute of Taxonomy
4 4
* http://www.e-taxonomy.eu
5
* 
5
*
6 6
* The contents of this file are subject to the Mozilla Public License Version 1.1
7 7
* See LICENSE.TXT at the top of this package for the full license terms.
8 8
*/
......
20 20
/**
21 21
 * @author a.mueller
22 22
 * @since 12.05.2009
23
 * @version 1.0
24 23
 */
25 24
public class DbImportObjectCreationMapper<ANNOTATABLE extends AnnotatableEntity, STATE extends DbImportStateBase<?,?>> extends DbImportObjectCreationMapperBase<ANNOTATABLE, STATE> {
26 25
	@SuppressWarnings("unused")
27 26
	private static final Logger logger = Logger.getLogger(DbImportObjectCreationMapper.class);
28
	
27

  
29 28
//******************************** FACTORY METHOD ***************************************************/
30
	
29

  
31 30
	public static DbImportObjectCreationMapper<?,?> NewInstance(IMappingImport mappingImport, String dbIdAttribute, String namespace){
32
		return new DbImportObjectCreationMapper(mappingImport, dbIdAttribute, namespace);
31
		return new DbImportObjectCreationMapper<>(mappingImport, dbIdAttribute, namespace);
33 32
	}
34
	
33

  
35 34
//******************************* ATTRIBUTES ***************************************/
36 35
	private IMappingImport<ANNOTATABLE, STATE> mappingImport;
37
		
38
	
36

  
37

  
39 38
//********************************* CONSTRUCTOR ****************************************/
40 39
	/**
41 40
	 * @param mappingImport
......
47 46

  
48 47
//************************************ METHODS *******************************************/
49 48

  
50

  
51
	/* (non-Javadoc)
52
	 * @see eu.etaxonomy.cdm.io.common.mapping.DbImportObjectCreationMapperBase#doInvoke(java.sql.ResultSet, eu.etaxonomy.cdm.model.common.VersionableEntity)
53
	 */
54 49
	@Override
55 50
	protected ANNOTATABLE doInvoke(ResultSet rs, ANNOTATABLE createdObject) throws SQLException {
56 51
		// do nothing
57 52
		return createdObject;
58 53
	}
59
	
60
	/* (non-Javadoc)
61
	 * @see eu.etaxonomy.cdm.io.common.mapping.DbImportObjectCreationMapperBase#createObject(java.sql.ResultSet)
62
	 */
54

  
63 55
	@Override
64 56
	protected ANNOTATABLE createObject(ResultSet rs) throws SQLException {
65 57
		ANNOTATABLE result = mappingImport.createObject(rs, importMapperHelper.getState());
66 58
		return result;
67 59
	}
68

  
69

  
70 60
}
cdmlib-io/src/main/java/eu/etaxonomy/cdm/io/common/mapping/DbImportObjectCreationMapperBase.java
53 53

  
54 54
//************************************ METHODS *******************************************/
55 55

  
56
	/* (non-Javadoc)
57
	 * @see eu.etaxonomy.cdm.io.common.mapping.IDbImportMapper#invoke(java.sql.ResultSet, eu.etaxonomy.cdm.model.common.CdmBase)
58
	 */
59 56
	@Override
60 57
    public CREATE invoke(ResultSet rs, CREATE noObject) throws SQLException {
61 58
		CREATE result = createObject(rs);
......
91 88
				return;
92 89
			}
93 90
			IOriginalSource source;
94
			ISourceable sourceable = (ISourceable)cdmBase;
91
			ISourceable sourceable = (ISourceable<?>)cdmBase;
95 92
			Object id = rs.getObject(dbIdAttribute);
96 93
			String strId = String.valueOf(id);
97 94
			String idNamespace = this.objectToCreateNamespace;
......
111 108
		}
112 109
	}
113 110

  
114

  
115

  
116

  
117 111
	/**
118 112
	 * Returns the transformer from the configuration
119 113
	 * @return
cdmlib-io/src/main/java/eu/etaxonomy/cdm/io/common/mapping/DbImportStringMapper.java
1 1
/**
2 2
* Copyright (C) 2007 EDIT
3
* European Distributed Institute of Taxonomy 
3
* European Distributed Institute of Taxonomy
4 4
* http://www.e-taxonomy.eu
5
* 
5
*
6 6
* The contents of this file are subject to the Mozilla Public License Version 1.1
7 7
* See LICENSE.TXT at the top of this package for the full license terms.
8 8
*/
......
19 19
/**
20 20
 * @author a.mueller
21 21
 * @since 24.02.2010
22
 * @version 1.0
23 22
 */
24 23
public class DbImportStringMapper extends DbSingleAttributeImportMapperBase<DbImportStateBase<?,?>, CdmBase>{
25 24

  
26 25
	@SuppressWarnings("unused")
27 26
	private static final Logger logger = Logger.getLogger(DbImportStringMapper.class);
28
	
27

  
29 28
	/**
30 29
	 * @param dbAttributString
31 30
	 * @param cdmAttributeString
......
36 35
		Object defaultValue = null;
37 36
		return DbImportStringMapper.NewInstance(dbAttributeString, cdmAttributeString, defaultValue, obligatory);
38 37
	}
39
	
40
	
38

  
41 39
	/**
42 40
	 * @param cdmAttributeString
43 41
	 * @param dbAttributString
......
57 55
		return new  DbImportStringMapper(dbAttributeString, cdmAttributeString, defaultValue, obligatory);
58 56
	}
59 57

  
60
	
61
	
62 58
	/**
63 59
	 * @param cdmAttributeString
64 60
	 * @param dbAttributString
......
68 64
		super(dbAttributeString, cdmAttributeString, defaultValue, obligatory);
69 65
	}
70 66

  
71
	/* (non-Javadoc)
72
	 * @see eu.etaxonomy.cdm.io.common.mapping.DbSingleAttributeImportMapperBase#doInvoke(eu.etaxonomy.cdm.model.common.CdmBase)
73
	 */
74 67
	@Override
75 68
	protected CdmBase doInvoke(CdmBase cdmBase, Object value) throws SQLException {
76 69
		return super.doInvoke(cdmBase, value);
77 70
	}
78 71

  
79 72

  
80
	/* (non-Javadoc)
81
	 * @see eu.etaxonomy.cdm.io.common.CdmSingleAttributeMapperBase#getTypeClass()
82
	 */
83 73
	@Override
84 74
	public Class getTypeClass() {
85 75
		return String.class;
86 76
	}
87
	
88 77

  
89 78
}
cdmlib-io/src/main/java/eu/etaxonomy/cdm/io/common/mapping/DbImportSynonymMapper.java
122 122
		}
123 123
		Taxon taxon = checkTaxonType(toObject, "Accepted taxon", toId);
124 124

  
125

  
126 125
		if (fromObject.isInstanceOf(Synonym.class)){
127 126
			SynonymType relType = SynonymType.SYNONYM_OF();
128 127
			Synonym synonym = CdmBase.deproxy(fromObject, Synonym.class);
129 128
			taxon.addSynonym(synonym, relType); //citation and micro citation not in use anymore as we do not have synonym relationships anymore
130
		}else if (fromObject.isInstanceOf(Taxon.class)  && this.useTaxonRelationship){
129
		}else if (fromObject.isInstanceOf(Taxon.class) && this.useTaxonRelationship){
131 130
			TaxonRelationshipType type = relType;
132 131
			Taxon synonymTaxon = CdmBase.deproxy(fromObject, Taxon.class);
133 132
			synonymTaxon.addTaxonRelation(taxon, type, citation, microCitation);
cdmlib-io/src/main/java/eu/etaxonomy/cdm/io/common/mapping/DbImportTaxIncludedInMapper.java
40 40
	public static DbImportTaxIncludedInMapper<?> NewInstance(String dbChildAttribute, String dbChildNamespace, String dbParentAttribute, String parentNamespace, String dbAlternativeParentAttribute, String alternativeParentNamespace, String dbTreeAttribute){
41 41
		String citationNamespace = null;
42 42
		String citationAttribute = null;
43
		return new DbImportTaxIncludedInMapper(dbChildAttribute, dbChildNamespace, dbParentAttribute, parentNamespace, dbAlternativeParentAttribute, alternativeParentNamespace, dbTreeAttribute, citationAttribute, citationNamespace);
43
		return new DbImportTaxIncludedInMapper<>(dbChildAttribute, dbChildNamespace, dbParentAttribute, parentNamespace, dbAlternativeParentAttribute, alternativeParentNamespace, dbTreeAttribute, citationAttribute, citationNamespace);
44 44
	}
45 45

  
46 46
//******************************* ATTRIBUTES ***************************************/
......
80 80

  
81 81
//************************************ METHODS *******************************************/
82 82

  
83

  
84
	/* (non-Javadoc)
85
	 * @see eu.etaxonomy.cdm.io.common.mapping.IDbImportMapper#invoke(java.sql.ResultSet, eu.etaxonomy.cdm.model.common.CdmBase)
86
	 */
87 83
	@Override
88 84
    public CdmBase invoke(ResultSet rs, CdmBase cdmBase) throws SQLException {
89 85
		STATE state = getState();
cdmlib-io/src/main/java/eu/etaxonomy/cdm/io/common/mapping/DbSingleAttributeImportMapperBase.java
25 25
/**
26 26
 * @author a.mueller
27 27
 * @since 12.05.2009
28
 * @version 1.0
29 28
 */
30 29
public abstract class DbSingleAttributeImportMapperBase<STATE extends DbImportStateBase<?,?>, CDM_BASE extends CdmBase> extends CdmSingleAttributeMapperBase implements IDbImportMapper<STATE, CDM_BASE>  {
31 30
	private static final Logger logger = Logger.getLogger(DbSingleAttributeImportMapperBase.class);
32 31

  
33
	protected DbImportMapperBase<STATE> importMapperHelper = new DbImportMapperBase<STATE>();
32
	protected DbImportMapperBase<STATE> importMapperHelper = new DbImportMapperBase<>();
34 33
//	private Integer precision = null;
35 34
	protected boolean obligatory = true;
36
	protected boolean ignore = false;;
35
	protected boolean ignore = false;
37 36

  
38 37
	protected Method destinationMethod = null;
39 38
	protected Class<?> targetClass;
......
179 178
		return result;
180 179
	}
181 180

  
182

  
183
	/* (non-Javadoc)
184
	 * @see eu.etaxonomy.cdm.io.berlinModel.out.mapper.IDbExportMapper#invoke(eu.etaxonomy.cdm.model.common.CdmBase)
185
	 */
186 181
	@Override
187 182
    public CDM_BASE invoke(ResultSet rs, CDM_BASE cdmBase) throws SQLException {
188 183
		if (ignore){
cdmlib-io/src/main/java/eu/etaxonomy/cdm/io/common/mapping/IDbImportMapper.java
1 1
/**
2 2
 * Copyright (C) 2007 EDIT
3
 * European Distributed Institute of Taxonomy 
3
 * European Distributed Institute of Taxonomy
4 4
 * http://www.e-taxonomy.eu
5
 * 
5
 *
6 6
 * The contents of this file are subject to the Mozilla Public License Version 1.1
7 7
 * See LICENSE.TXT at the top of this package for the full license terms.
8 8
 */
......
18 18
/**
19 19
 * @author a.mueller
20 20
 * @since 12.05.2009
21
 * @version 1.0
22 21
 */
23 22
public interface IDbImportMapper<STATE extends DbImportStateBase<?,?>, CDM_BASE extends CdmBase> {
24 23

  
25 24
	public void initialize(STATE state, Class<? extends CdmBase> destinationClass);
26 25

  
27 26
//	public void initialize(T state, String tableName);
28
	
27

  
29 28
	public CDM_BASE invoke(ResultSet rs, CDM_BASE cdmBase) throws SQLException;
30 29

  
31 30
}
cdmlib-model/src/main/java/eu/etaxonomy/cdm/model/common/OrderedTermVocabulary.java
153 153
				result.remove(setObject);
154 154
			}
155 155
		}*/
156
	    SortedSet<T> result = new TreeSet<T>();
156
	    SortedSet<T> result = new TreeSet<>();
157 157
        SortedSet<T> sortedSet = getSortedSetOfTerms();
158 158
        //headSet Returns a view of the portion of this set whose elements are STRICTLY less than toElement
159 159
        result.addAll( sortedSet.headSet(otb));
......
255 255
		super.addTerm(termToBeAdded);
256 256
	}
257 257

  
258
	public void addTermEqualLevel(T termToBeAdded, T equalLevelTerm) throws WrongTermTypeException {
258
	public void addTermEqualLevel(T termToBeAdded, T equalLevelTerm) {
259 259
		int orderInd = equalLevelTerm.orderIndex;
260 260
		termToBeAdded.orderIndex = orderInd;
261 261
		super.addTerm(termToBeAdded);
......
288 288

  
289 289
	@Transient
290 290
	private SortedSet<T> getSortedSetOfTerms(){
291
		SortedSet<T> sortedSet = new TreeSet<T>();
291
		SortedSet<T> sortedSet = new TreeSet<>();
292 292
		for (DefinedTermBase<?> termUnproxied : terms){
293 293
            @SuppressWarnings("unchecked")
294 294
            T term = (T)CdmBase.deproxy(termUnproxied, OrderedTermBase.class);
cdmlib-model/src/main/java/eu/etaxonomy/cdm/model/reference/IWithIsbn.java
10 10

  
11 11
/**
12 12
 * Interface representing all {@link Reference references} which have
13
 * a {@link Reference#getType() type} allowing an authorship.
13
 * a {@link Reference#getType() type} allowing an ISBN.
14 14
 * @author a.mueller
15 15
 * @since 20.11.2018
16 16
 *
cdmlib-model/src/main/java/eu/etaxonomy/cdm/validation/constraint/ReferenceCheckValidator.java
7 7
import eu.etaxonomy.cdm.model.reference.ReferenceType;
8 8
import eu.etaxonomy.cdm.validation.annotation.ReferenceCheck;
9 9

  
10
/**
11
 * @author k.luther
12
 * @since 2011
13
 *
14
 */
10 15
public class ReferenceCheckValidator implements ConstraintValidator<ReferenceCheck, Reference>{
11 16

  
12 17
    @Override
cdmlib-persistence/src/main/java/eu/etaxonomy/cdm/persistence/dao/hibernate/common/OriginalSourceDaoImpl.java
1 1
/**
2 2
* Copyright (C) 2007 EDIT
3
* European Distributed Institute of Taxonomy 
3
* European Distributed Institute of Taxonomy
4 4
* http://www.e-taxonomy.eu
5
* 
5
*
6 6
* The contents of this file are subject to the Mozilla Public License Version 1.1
7 7
* See LICENSE.TXT at the top of this package for the full license terms.
8 8
*/
......
31 31
/**
32 32
 * @author a.mueller
33 33
 * @since 17.07.2008
34
 * @version 1.0
35 34
 */
36 35
@Repository
37 36
public class OriginalSourceDaoImpl extends CdmEntityDaoBase<OriginalSourceBase> implements	IOriginalSourceDao {
......
39 38
	private static final Logger logger = Logger.getLogger(OriginalSourceDaoImpl.class);
40 39

  
41 40
	public OriginalSourceDaoImpl() {
42
		super(OriginalSourceBase.class); 
41
		super(OriginalSourceBase.class);
43 42
	}
44 43

  
45

  
46
	/* (non-Javadoc)
47
	 * @see eu.etaxonomy.cdm.persistence.dao.common.IOriginalSourceDao#findOriginalSourcesByIdInSource(java.lang.Class, java.util.List, java.lang.String)
48
	 */
49
	public Map<String, ISourceable> findOriginalSourcesByIdInSource(Class clazz, Set<String> idInSourceSet, String idNamespace) {
44
	@Override
45
    public Map<String, ISourceable> findOriginalSourcesByIdInSource(Class clazz, Set<String> idInSourceSet, String idNamespace) {
50 46
		Session session = getSession();
51 47
		String idInSourceString = "";
52 48
		for (String idInSource : idInSourceSet){
......
57 53
		Query q = session.createQuery(
58 54
                "SELECT source.idInSource, c FROM " + clazz.getSimpleName() + " AS c " +
59 55
                "INNER JOIN c.sources AS source " +
60
                "WHERE source.idInSource IN ( " + idInSourceString + " )" + 
56
                "WHERE source.idInSource IN ( " + idInSourceString + " )" +
61 57
                	" AND source.idNamespace = :idNamespace"
62 58
            );
63 59
		q.setString("idNamespace", idNamespace);
64
		//TODO integrate reference in where 
65
		
66
		Map<String, ISourceable> result = new HashMap<String, ISourceable>();
67
		
60
		//TODO integrate reference in where
61

  
62
		Map<String, ISourceable> result = new HashMap<>();
63

  
68 64
		List<Object[]> list = q.list();
69 65
		for (Object[] pair : list){
70 66
			result.put((String)pair[0], (ISourceable)pair[1]);
71 67
		}
72
		
68

  
73 69
		return result;
74 70
	}
75
	
76
	
77
	/* (non-Javadoc)
78
	 * @see eu.etaxonomy.cdm.persistence.dao.common.IOriginalSourceDao#findOriginalSourceByIdInSource(java.lang.Class, java.lang.String, java.lang.String)
79
	 */
80
	public List<IdentifiableEntity> findOriginalSourceByIdInSource(Class clazz, String idInSource, String idNamespace) {
71

  
72
	@Override
73
    public List<IdentifiableEntity> findOriginalSourceByIdInSource(Class clazz, String idInSource, String idNamespace) {
81 74
		Session session = getSession();
82 75
		Query q = session.createQuery(
83 76
                "Select c from " + clazz.getSimpleName() + " as c " +
84 77
                "inner join c.sources as source " +
85
                "where source.idInSource = :idInSource " + 
78
                "where source.idInSource = :idInSource " +
86 79
                	" AND source.idNamespace = :idNamespace"
87 80
            );
88 81
		q.setString("idInSource", idInSource);
89 82
		q.setString("idNamespace", idNamespace);
90
		//TODO integrate reference in where 
83
		//TODO integrate reference in where
91 84
		List<IdentifiableEntity> results = q.list();
92
		
85

  
93 86
		return results;
94 87
	}
95
	
96
	/* (non-Javadoc)
97
	 * @see eu.etaxonomy.cdm.persistence.dao.common.IOriginalSourceDao#findOriginalSourceByIdInSource(java.lang.String, java.lang.String)
98
	 */
99
	public List<OriginalSourceBase> findOriginalSourceByIdInSource(String idInSource, String idNamespace) {
88

  
89
	@Override
90
    public List<OriginalSourceBase> findOriginalSourceByIdInSource(String idInSource, String idNamespace) {
100 91
		Session session = getSession();
101 92
		Criteria crit = session.createCriteria(type);
102 93
		crit.add(Restrictions.eq("idInSource", idInSource));
......
107 98
		}
108 99
		crit.addOrder(Order.desc("created"));
109 100
		List<OriginalSourceBase> results = crit.list();
110
		
101

  
111 102
		return results;
112 103
	}
113

  
114

  
115 104
}

Also available in: Unified diff