Project

General

Profile

« Previous | Next » 

Revision 3057e969

Added by Andreas Müller about 9 years ago

remove globis reference import old version

View differences:

.gitattributes
142 142
app-import/src/main/java/eu/etaxonomy/cdm/io/globis/GlobisImportConfigurator.java -text
143 143
app-import/src/main/java/eu/etaxonomy/cdm/io/globis/GlobisImportState.java -text
144 144
app-import/src/main/java/eu/etaxonomy/cdm/io/globis/GlobisReferenceImport.java -text
145
app-import/src/main/java/eu/etaxonomy/cdm/io/globis/GlobisReferenceImport_Mapping_OLD.java -text
146 145
app-import/src/main/java/eu/etaxonomy/cdm/io/globis/GlobisSpecTaxImport.java -text
147 146
app-import/src/main/java/eu/etaxonomy/cdm/io/globis/GlobisTransformer.java -text
148 147
app-import/src/main/java/eu/etaxonomy/cdm/io/globis/validation/GlobisCurrentSpeciesImportValidator.java -text
app-import/src/main/java/eu/etaxonomy/cdm/io/globis/GlobisReferenceImport_Mapping_OLD.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.io.globis;
11

  
12
import java.sql.ResultSet;
13
import java.sql.SQLException;
14
import java.util.HashMap;
15
import java.util.Map;
16

  
17
import org.apache.log4j.Logger;
18
import org.springframework.stereotype.Component;
19

  
20
import eu.etaxonomy.cdm.io.common.IImportConfigurator;
21
import eu.etaxonomy.cdm.io.common.IOValidator;
22
import eu.etaxonomy.cdm.io.common.mapping.DbIgnoreMapper;
23
import eu.etaxonomy.cdm.io.common.mapping.DbImportExtensionMapper;
24
import eu.etaxonomy.cdm.io.common.mapping.DbImportMapping;
25
import eu.etaxonomy.cdm.io.common.mapping.DbImportObjectCreationMapper;
26
import eu.etaxonomy.cdm.io.common.mapping.DbImportStringMapper;
27
import eu.etaxonomy.cdm.io.common.mapping.DbNotYetImplementedMapper;
28
import eu.etaxonomy.cdm.io.common.mapping.IMappingImport;
29
import eu.etaxonomy.cdm.io.globis.validation.GlobisReferenceImportValidator;
30
import eu.etaxonomy.cdm.model.common.CdmBase;
31
import eu.etaxonomy.cdm.model.reference.Reference;
32
import eu.etaxonomy.cdm.model.reference.ReferenceFactory;
33

  
34

  
35
/**
36
 * @author a.mueller
37
 * @created 20.02.2010
38
 * @version 1.0
39
 */
40
@Component
41
public class GlobisReferenceImport_Mapping_OLD  extends GlobisImportBase<Reference> implements IMappingImport<Reference, GlobisImportState>{
42
	private static final Logger logger = Logger.getLogger(GlobisReferenceImport_Mapping_OLD.class);
43
	
44
	private DbImportMapping mapping;
45
	
46
	
47
	private int modCount = 10000;
48
	private static final String pluralString = "references";
49
	private static final String dbTableName = "Literatur";
50
	private static final Class cdmTargetClass = Reference.class;
51

  
52
	public GlobisReferenceImport_Mapping_OLD(){
53
		super(pluralString, dbTableName, cdmTargetClass);
54
	}
55

  
56

  
57
	
58
	
59
	/* (non-Javadoc)
60
	 * @see eu.etaxonomy.cdm.io.globis.GlobisImportBase#getIdQuery()
61
	 */
62
	@Override
63
	protected String getIdQuery() {
64
		String strRecordQuery = 
65
			" SELECT refID " + 
66
			" FROM " + dbTableName; 
67
		return strRecordQuery;	
68
	}
69

  
70

  
71

  
72

  
73
	/* (non-Javadoc)
74
	 * @see eu.etaxonomy.cdm.io.berlinModel.in.BerlinModelImportBase#getRecordQuery(eu.etaxonomy.cdm.io.berlinModel.in.BerlinModelImportConfigurator)
75
	 */
76
	@Override
77
	protected String getRecordQuery(GlobisImportConfigurator config) {
78
		String strRecordQuery = 
79
			" SELECT * " + 
80
			" FROM " + getTableName() + " l " +
81
			" WHERE ( l.refId IN (" + ID_LIST_TOKEN + ") )";
82
		return strRecordQuery;
83
	}
84

  
85
	/* (non-Javadoc)
86
	 * @see eu.etaxonomy.cdm.io.globis.GlobisImportBase#getMapping()
87
	 */
88
	protected DbImportMapping getMapping() {
89
		if (mapping == null){
90
			mapping = new DbImportMapping();
91
			
92
			mapping.addMapper(DbImportObjectCreationMapper.NewInstance(this, "refID", REFERENCE_NAMESPACE)); //id
93
			mapping.addMapper(DbIgnoreMapper.NewInstance("CountryDummy"));
94
			mapping.addMapper(DbNotYetImplementedMapper.NewInstance("CreatedBy"));
95
			mapping.addMapper(DbNotYetImplementedMapper.NewInstance("DateCreated"));
96
			mapping.addMapper(DbNotYetImplementedMapper.NewInstance("DateModified"));
97
			mapping.addMapper(DbNotYetImplementedMapper.NewInstance("ModifiedBy"));
98
			mapping.addMapper(DbImportStringMapper.NewInstance("RefBookTitle", "title", false));
99
			//mapping.addMapper(DbImportTimePeriodMapper.NewInstance("RefDatePublished", "datePublished", false));
100
			mapping.addMapper(DbNotYetImplementedMapper.NewInstance("RefDatePublished"));
101
//			mapping.addMapper(DbImportExtensionTypeCreationMapper.NewInstance(dbIdAttribute, extensionTypeNamespace, dbTermAttribute, dbLabelAttribute, dbLabelAbbrevAttribute)
102
//			mapping.addMapper(DbImportExtensionMapper.NewInstance("RefEdition", GlobisTransformer.uuidEdition, "Edition", "Edition", "Ed."));
103
//			mapping.addMapper(DbImportExtensionMapper.NewInstance("RefEdition", GlobisTransformer.uuidEditor, "Editor", "Editor", "Editor"));
104
//			mapping.addMapper(DbImportExtensionMapper.NewInstance("RefGeneralKeywords", GlobisTransformer.uuidGeneralKeywords, "General Keywords", "General Keywords", "gen. keyw."));
105
//			mapping.addMapper(DbImportExtensionMapper.NewInstance("RefGeoKeywords", GlobisTransformer.uuidGeoKeywords, "Geographic Keywords", "Geo Keywords", "geo. keyw."));
106
//			mapping.addMapper(DbNotYetImplementedMapper.NewInstance("RefIll only"));
107
//			mapping.addMapper(DbImportStringMapper.NewInstance("ISSN", "issn", false));
108
//			mapping.addMapper(DbImportExtensionMapper.NewInstance("RefLibrary", GlobisTransformer.uuidLibrary, "Library", "Library", "Libr."));
109
			mapping.addMapper(DbNotYetImplementedMapper.NewInstance("RefMarker"));
110
			mapping.addMapper(DbImportStringMapper.NewInstance("RefPages", "pages"));
111
			mapping.addMapper(DbNotYetImplementedMapper.NewInstance("RefPages only"));
112
			
113
			
114
			
115
			Reference ref = null;
116
//			ref.setP
117
			
118
		
119
////			mapping.addMapper(DbImportExtensionMapper.NewInstance("imis_id", GlobisTransformer.IMIS_UUID, "imis", "imis", "imis"));
120
//						
121
//			mapping.addMapper(DbImportTruncatedStringMapper.NewInstance("source_name", "titleCache", "title"));
122
//			mapping.addMapper(DbImportStringMapper.NewInstance("source_abstract", "referenceAbstract"));
123
//			mapping.addMapper(DbImportAnnotationMapper.NewInstance("source_note", AnnotationType.EDITORIAL(), Language.DEFAULT()));
124
//			
125
//			//or as Extension?
126
//			mapping.addMapper(DbImportExtensionMapper.NewInstance("source_link", ExtensionType.URL()));
127
//			
128
//			//not yet implemented
129
//			mapping.addMapper(DbNotYetImplementedMapper.NewInstance("source_type"));
130
//			mapping.addMapper(DbNotYetImplementedMapper.NewInstance("source_orig_fn"));
131

  
132
		}
133
		return mapping;
134
	}
135
	
136
	/* (non-Javadoc)
137
	 * @see eu.etaxonomy.cdm.io.common.mapping.IMappingImport#createObject(java.sql.ResultSet, eu.etaxonomy.cdm.io.common.ImportStateBase)
138
	 */
139
	public Reference createObject(ResultSet rs, GlobisImportState state)
140
			throws SQLException {
141
		Reference ref;
142
		String refType = rs.getString("RefType");
143
		if (refType == null){
144
			ref = ReferenceFactory.newGeneric();
145
		}else if (refType == "book"){
146
			ref = ReferenceFactory.newBook();
147
		}else if (refType == "paper in journal"){
148
			ref = ReferenceFactory.newArticle();
149
		}else if (refType.startsWith("unpublished") ){
150
			ref = ReferenceFactory.newGeneric();
151
		}else if (refType.endsWith("paper in journal")){
152
			ref = ReferenceFactory.newArticle();
153
		}else if (refType == "paper in book"){
154
			ref = ReferenceFactory.newBookSection();
155
		}else if (refType == "paper in journalwebsite"){
156
			ref = ReferenceFactory.newArticle();
157
		}else{
158
			logger.warn("Unknown reference type: " + refType);
159
			ref = ReferenceFactory.newGeneric();
160
		}
161
		return ref;
162
	}
163

  
164
	/* (non-Javadoc)
165
	 * @see eu.etaxonomy.cdm.io.berlinModel.in.IPartitionedIO#getRelatedObjectsForPartition(java.sql.ResultSet)
166
	 */
167
	public Map<Object, Map<String, ? extends CdmBase>> getRelatedObjectsForPartition(ResultSet rs) {
168
		Map<Object, Map<String, ? extends CdmBase>> result = new HashMap<Object, Map<String, ? extends CdmBase>>();
169
		return result;  //not needed
170
	}
171
	
172
	/* (non-Javadoc)
173
	 * @see eu.etaxonomy.cdm.io.common.CdmIoBase#doCheck(eu.etaxonomy.cdm.io.common.IImportConfigurator)
174
	 */
175
	@Override
176
	protected boolean doCheck(GlobisImportState state){
177
		IOValidator<GlobisImportState> validator = new GlobisReferenceImportValidator();
178
		return validator.validate(state);
179
	}
180
	
181
	
182
	/* (non-Javadoc)
183
	 * @see eu.etaxonomy.cdm.io.common.CdmIoBase#isIgnore(eu.etaxonomy.cdm.io.common.IImportConfigurator)
184
	 */
185
	protected boolean isIgnore(GlobisImportState state){
186
		//TODO
187
		return state.getConfig().getDoReferences() != IImportConfigurator.DO_REFERENCES.ALL;
188
	}
189

  
190

  
191

  
192

  
193

  
194
}

Also available in: Unified diff