Project

General

Profile

« Previous | Next » 

Revision 4f360e46

Added by Andreas Müller over 6 years ago

cleanup

View differences:

cdmlib-io/src/main/java/eu/etaxonomy/cdm/io/tcsxml/in/TcsXmlImportConfigurator.java
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
*/
9 9

  
10 10
package eu.etaxonomy.cdm.io.tcsxml.in;
11 11

  
......
33 33
@Component
34 34
public class TcsXmlImportConfigurator extends ImportConfiguratorBase<TcsXmlImportState, URI> implements IImportConfigurator {
35 35
	private static final Logger logger = Logger.getLogger(TcsXmlImportConfigurator.class);
36
	
36

  
37 37
	//TODO
38 38
	private static IInputTransformer defaultTransformer = null;
39 39

  
40
	
40

  
41 41
	private boolean doMetaData = true;
42 42
	private boolean doSpecimen = true;
43
	
43

  
44 44
//	//references
45 45
	private DO_REFERENCES doReferences = DO_REFERENCES.ALL;
46 46
//	//names
......
49 49
//	//taxa
50 50
	private boolean doTaxa = true;
51 51
	private boolean doRelTaxa = true;
52
	
52

  
53 53
	private boolean doGetMissingNames = true;
54 54

  
55
	
56
	
55

  
56

  
57 57
	public boolean isDoGetMissingNames() {
58 58
		return doGetMissingNames;
59 59
	}
......
62 62
		this.doGetMissingNames = doGetMissingNames;
63 63
	}
64 64

  
65
	private Method functionMetaDataDetailed = null; 
65
	private Method functionMetaDataDetailed = null;
66 66
	private ITcsXmlPlaceholderClass placeholderClass;
67
	
67

  
68 68
	//	rdfNamespace
69 69
	Namespace tcsXmlNamespace;
70 70

  
71 71
	protected static Namespace nsTcsXml = Namespace.getNamespace("http://www.tdwg.org/schemas/tcs/1.01");
72
	
72

  
73 73
//	@Autowired
74 74
//	TcsXmlMetaDataImport tcsXmlMetaDataImport;
75 75
//	@Autowired
......
84 84
//	TcsXmlTaxonImport tcsXmlTaxonIO;
85 85
//	@Autowired
86 86
//	TcsXmlTaxonRelationsImport tcsXmlTaxonRelationsIO;
87
	
88
	protected void makeIoClassList(){
87

  
88
	@Override
89
    protected void makeIoClassList(){
89 90
//		ioBeans = new String[]{
90 91
//				"tcsXmlMetaDataImport"
91 92
//				, "tcsXmlSpecimensIO"
......
93 94
//				, "tcsXmlTaxonNameIO"
94 95
//				, "tcsXmlTaxonNameRelationsIO"
95 96
//				, "tcsXmlTaxonIO"
96
//				, "tcsXmlTaxonRelationsIO"	
97
//				, "tcsXmlTaxonRelationsIO"
97 98
//		};
98
		
99

  
99 100
		ioClassList = new Class[]{
100 101
			TcsXmlMetaDataImport.class
101 102
			, TcsXmlSpecimensImport.class
......
105 106
			, TcsXmlTaxonImport.class
106 107
			, TcsXmlTaxonRelationsImport.class
107 108
		};
108
	};
109
	
109
	}
110

  
110 111
	public static TcsXmlImportConfigurator NewInstance(URI uri,
111 112
			ICdmDataSource destination){
112 113
		return new TcsXmlImportConfigurator(uri, destination);
113 114
	}
114
	
115

  
115 116
	/**
116 117
	 * @param berlinModelSource
117 118
	 * @param sourceReference
......
122 123
//		setSource(url);
123 124
//		setDestination(destination);
124 125
	}
125
	
126

  
126 127
	/**
127 128
	 * @param berlinModelSource
128 129
	 * @param sourceReference
......
133 134
		setSource(uri);
134 135
		setDestination(destination);
135 136
	}
136
	
137
	
137

  
138

  
138 139

  
139 140
	/* (non-Javadoc)
140 141
	 * @see eu.etaxonomy.cdm.io.common.IImportConfigurator#getNewState()
141 142
	 */
142
	public TcsXmlImportState getNewState() {
143
	@Override
144
    public TcsXmlImportState getNewState() {
143 145
		return new TcsXmlImportState(this);
144 146
	}
145 147

  
146 148
	/* (non-Javadoc)
147 149
	 * @see eu.etaxonomy.cdm.io.common.ImportConfiguratorBase#getSource()
148 150
	 */
149
	public URI getSource() {
150
		return (URI)super.getSource();
151
	@Override
152
    public URI getSource() {
153
		return super.getSource();
151 154
	}
152
	
155

  
153 156
	/**
154 157
	 * @param file
155 158
	 */
156
	public void setSource(URI uri) {
159
	@Override
160
    public void setSource(URI uri) {
157 161
		super.setSource(uri);
158 162
	}
159
	
163

  
160 164
	/**
161 165
	 * @return
162 166
	 */
......
178 182
		}
179 183
		return null;
180 184
	}
181
	
185

  
182 186
	private boolean makeNamespaces(Element root){
183 187
		tcsXmlNamespace = root.getNamespace();
184
		if (tcsXmlNamespace == null 
185
				/**|| tcNamespace == null 
186
				 * || tnNamespace == null 
187
				 * || commonNamespace == null 
188
				 * ||	geoNamespace == null 
188
		if (tcsXmlNamespace == null
189
				/**|| tcNamespace == null
190
				 * || tnNamespace == null
191
				 * || commonNamespace == null
192
				 * ||	geoNamespace == null
189 193
				 * || publicationNamespace == null*/){
190 194
			logger.warn("At least one Namespace is NULL");
191 195
		}
......
211 215
	/* (non-Javadoc)
212 216
	 * @see eu.etaxonomy.cdm.io.common.IImportConfigurator#getSourceNameString()
213 217
	 */
214
	public String getSourceNameString() {
218
	@Override
219
    public String getSourceNameString() {
215 220
		if (this.getSource() == null){
216 221
			return null;
217 222
		}else{
218 223
			return this.getSource().toString();
219 224
		}
220 225
	}
221
	
226

  
222 227
	public Namespace getTcsXmlNamespace() {
223 228
		return tcsXmlNamespace;
224 229
	}
......
226 231
	public void setTcsXmlNamespace(Namespace tcsXmlNamespace) {
227 232
		this.tcsXmlNamespace = tcsXmlNamespace;
228 233
	}
229
	
234

  
230 235

  
231 236
	/**
232 237
	 * @return the funMetaDataDetailed
......
236 241
			functionMetaDataDetailed = getDefaultFunction(TcsXmlMetaDataImport.class, "defaultMetaDataDetailedFunction");
237 242
		}
238 243
		return functionMetaDataDetailed;
239
		
244

  
240 245
	}
241 246

  
242 247
	/**
......
245 250
	public void setFunctionMetaDataDetailed(Method functionMetaDataDetailed) {
246 251
		this.functionMetaDataDetailed = functionMetaDataDetailed;
247 252
	}
248
	
249
	
250
	
251
	
252
	
253

  
254

  
255

  
256

  
257

  
253 258
	public DO_REFERENCES getDoReferences() {
254 259
		return doReferences;
255 260
	}
256 261
	public void setDoReferences(DO_REFERENCES doReferences) {
257 262
		this.doReferences = doReferences;
258 263
	}
259
	
264

  
260 265
	public boolean isDoTaxonNames() {
261 266
		return doTaxonNames;
262 267
	}
......
288 293
	public void setDoRelNames(boolean doRelNames) {
289 294
		this.doRelNames = doRelNames;
290 295
	}
291
	
296

  
292 297
	/**
293 298
	 * @return the doMetaData
294 299
	 */
......
335 340
		this.placeholderClass = placeholderClass;
336 341
	}
337 342

  
338
	
343

  
339 344
}
cdmlib-model/src/main/java/eu/etaxonomy/cdm/model/common/DefinedTerm.java
178 178
	@Override
179 179
	protected void setDefaultTerms(TermVocabulary<DefinedTerm> termVocabulary) {
180 180
		if (termMap == null){
181
			termMap = new HashMap<UUID, DefinedTerm>();
181
			termMap = new HashMap<>();
182 182
		}
183 183
		for (DefinedTerm term : termVocabulary.getTerms()){
184 184
			termMap.put(term.getUuid(), term);
cdmlib-model/src/main/java/eu/etaxonomy/cdm/model/name/Registration.java
45 45
 * A registration represents a nomenclatural act, either a {@link TaxonName taxon name}
46 46
 * registration or a {@link TypeDesignationBase type} registration.
47 47
 * <p>
48
 * The name and all type designations associated with the Registration must share the same citation and citation detail.
49
 *
48
 * The name and all type designations associated with the Registration must share
49
 * the same citation and citation detail.
50 50
 *
51 51
 * @author a.mueller
52 52
 * @date 13.03.2017
53
 *
54 53
 */
55 54

  
56 55
@XmlAccessorType(XmlAccessType.FIELD)
cdmlib-model/src/main/java/eu/etaxonomy/cdm/strategy/match/CacheMatcher.java
59 59

  
60 60

  
61 61
	public List<DoubleResult<String, MatchMode>> getReplaceMatchModes(Matching matching) throws MatchException{
62
		List<DoubleResult<String, MatchMode>> result = new ArrayList<DoubleResult<String,MatchMode>>();
62
		List<DoubleResult<String, MatchMode>> result = new ArrayList<>();
63 63
		List<FieldMatcher> fieldMatchers = matching.getFieldMatchers(true);
64 64
		for (FieldMatcher fieldMatcher : fieldMatchers){
65 65
			String propertyName = fieldMatcher.getPropertyName();
66 66
			if (isReplaceProperty(propertyName)){
67
				result.add(new DoubleResult<String, MatchMode>(propertyName, replaceMatchMode));
67
				result.add(new DoubleResult<>(propertyName, replaceMatchMode));
68 68
			}
69 69
		}
70 70
		return result;
cdmlib-model/src/main/java/eu/etaxonomy/cdm/strategy/match/DefaultMatchStrategy.java
32 32
import eu.etaxonomy.cdm.common.DoubleResult;
33 33
import eu.etaxonomy.cdm.hibernate.HibernateProxyHelper;
34 34
import eu.etaxonomy.cdm.model.common.CdmBase;
35
import eu.etaxonomy.cdm.model.common.TimePeriod;
35 36
import eu.etaxonomy.cdm.strategy.StrategyBase;
36 37
import eu.etaxonomy.cdm.strategy.match.Match.ReplaceMode;
37 38

  
38 39
/**
39 40
 * @author a.mueller
40 41
 * @created 06.08.2009
41
 * @version 1.0
42 42
 */
43 43
public class DefaultMatchStrategy extends StrategyBase implements IMatchStrategy {
44 44
	private static final long serialVersionUID = 5045874493910155162L;
......
76 76
		return matchClass;
77 77
	}
78 78

  
79
	/* (non-Javadoc)
80
	 * @see eu.etaxonomy.cdm.strategy.StrategyBase#getUuid()
81
	 */
82 79
	@Override
83 80
	protected UUID getUuid() {
84 81
		return uuid;
85 82
	}
86 83

  
87
	/* (non-Javadoc)
88
	 * @see eu.etaxonomy.cdm.strategy.match.IMatchStrategy#getMatching()
89
	 */
90 84
	@Override
91 85
    public Matching getMatching() {
92 86
		return matching;
93 87
	}
94 88

  
95
	/* (non-Javadoc)
96
	 * @see eu.etaxonomy.cdm.strategy.match.IMatchStrategy#setMatchMode(java.lang.String, eu.etaxonomy.cdm.strategy.match.MatchMode)
97
	 */
98 89
	@Override
99 90
    public void setMatchMode(String propertyName, MatchMode matchMode)
100 91
			throws MatchException {
......
106 97
		}
107 98
	}
108 99

  
109
	/* (non-Javadoc)
110
	 * @see eu.etaxonomy.cdm.strategy.match.IMatchStrategy#getMatchMode(java.lang.String)
111
	 */
112 100
	@Override
113 101
    public MatchMode getMatchMode(String propertyName) {
114 102
		FieldMatcher fieldMatcher = matching.getFieldMatcher(propertyName);
......
189 177
						String propertyName = replacementMode.getFirstResult();
190 178
						List<MatchMode> replaceMatcherList = replaceMatchers.get(propertyName);
191 179
						if (replaceMatcherList == null){
192
							replaceMatcherList = new ArrayList<MatchMode>();
180
							replaceMatcherList = new ArrayList<>();
193 181
							replaceMatchers.put(propertyName, replaceMatcherList);
194 182
						}
195 183
						replaceMatcherList.add(replacementMode.getSecondResult());
cdmlib-model/src/main/java/eu/etaxonomy/cdm/strategy/match/MatchMode.java
22 22
public enum MatchMode {
23 23
	EQUAL_REQUIRED,  //parameters must be equal and not null
24 24
	EQUAL,			 //parameters must be equal or both null
25
	EQUAL_OR_ONE_NULL,   //parameters must be equal at least one parameter is null
25
	EQUAL_OR_ONE_NULL,   //parameters must be equal or at least one parameter is null
26 26
	EQUAL_OR_SECOND_NULL,
27 27
	IGNORE,			//matches always
28 28
	MATCH_REQUIRED,

Also available in: Unified diff