Revision ffd6058e
Added by Andreas Müller over 4 years ago
cdm-pesi/src/main/java/eu/etaxonomy/cdm/io/pesi/indexFungorum/IndexFungorumSpeciesImport.java | ||
---|---|---|
36 | 36 |
import eu.etaxonomy.cdm.model.taxon.TaxonBase; |
37 | 37 |
import eu.etaxonomy.cdm.strategy.parser.NonViralNameParserImpl; |
38 | 38 |
|
39 |
|
|
40 | 39 |
/** |
41 | 40 |
* @author a.mueller |
42 | 41 |
* @since 27.02.2012 |
43 | 42 |
*/ |
44 | 43 |
@Component |
45 | 44 |
public class IndexFungorumSpeciesImport extends IndexFungorumImportBase { |
46 |
private static final Logger logger = Logger.getLogger(IndexFungorumSpeciesImport.class); |
|
45 |
|
|
46 |
private static final long serialVersionUID = -1148034079632876980L; |
|
47 |
private static final Logger logger = Logger.getLogger(IndexFungorumSpeciesImport.class); |
|
47 | 48 |
|
48 | 49 |
private static final String pluralString = "species"; |
49 | 50 |
private static final String dbTableName = "[tblPESIfungi-IFdata]"; |
50 | 51 |
|
51 |
|
|
52 | 52 |
public IndexFungorumSpeciesImport(){ |
53 | 53 |
super(pluralString, dbTableName, null); |
54 |
|
|
55 | 54 |
} |
56 | 55 |
|
57 |
|
|
58 |
|
|
59 |
|
|
60 | 56 |
@Override |
61 | 57 |
protected String getIdQuery() { |
62 | 58 |
String result = " SELECT PreferredNameIFnumber FROM " + getTableName() + |
... | ... | |
64 | 60 |
return result; |
65 | 61 |
} |
66 | 62 |
|
67 |
|
|
68 |
|
|
69 |
|
|
70 |
/* (non-Javadoc) |
|
71 |
* @see eu.etaxonomy.cdm.io.berlinModel.in.BerlinModelImportBase#getRecordQuery(eu.etaxonomy.cdm.io.berlinModel.in.BerlinModelImportConfigurator) |
|
72 |
*/ |
|
73 | 63 |
@Override |
74 | 64 |
protected String getRecordQuery(IndexFungorumImportConfigurator config) { |
75 | 65 |
String strRecordQuery = |
... | ... | |
80 | 70 |
""; |
81 | 71 |
return strRecordQuery; |
82 | 72 |
} |
73 |
|
|
83 | 74 |
@Override |
84 | 75 |
protected void doInvoke(IndexFungorumImportState state){ |
85 | 76 |
System.out.println("start make " + getPluralString() + " ..."); |
86 | 77 |
super.doInvoke(state); |
87 |
|
|
88 |
|
|
89 |
|
|
90 |
|
|
91 | 78 |
} |
92 | 79 |
|
93 | 80 |
@Override |
94 |
public boolean doPartition(ResultSetPartitioner partitioner, IndexFungorumImportState state) { |
|
81 |
public boolean doPartition(@SuppressWarnings("rawtypes") ResultSetPartitioner partitioner, |
|
82 |
IndexFungorumImportState state) { |
|
83 |
|
|
95 | 84 |
boolean success = true; |
96 | 85 |
Reference sourceReference = state.getRelatedObject(NAMESPACE_REFERENCE, SOURCE_REFERENCE, Reference.class); |
97 | 86 |
ResultSet rs = partitioner.getResultSet(); |
... | ... | |
143 | 132 |
if (name.isInfraSpecific()){ |
144 | 133 |
state.getInfraspecificTaxaUUIDs().add(uuidTaxon); |
145 | 134 |
} |
146 |
|
|
147 | 135 |
} |
148 |
|
|
149 |
|
|
150 | 136 |
} catch (Exception e) { |
151 | 137 |
e.printStackTrace(); |
152 | 138 |
logger.error(e.getMessage()); |
... | ... | |
156 | 142 |
return success; |
157 | 143 |
} |
158 | 144 |
|
159 |
|
|
160 |
|
|
161 |
|
|
162 |
|
|
163 |
|
|
164 |
|
|
165 | 145 |
private Taxon getParentTaxon(IndexFungorumImportState state, ResultSet rs) throws SQLException { |
166 | 146 |
Integer genusId = rs.getInt("PreferredNameFDCnumber"); |
167 | 147 |
|
... | ... | |
172 | 152 |
return taxon; |
173 | 153 |
} |
174 | 154 |
|
175 |
|
|
176 | 155 |
@Override |
177 | 156 |
public Map<Object, Map<String, ? extends CdmBase>> getRelatedObjectsForPartition(ResultSet rs, IndexFungorumImportState state) { |
178 | 157 |
String nameSpace; |
... | ... | |
192 | 171 |
nameSpace = NAMESPACE_GENERA; |
193 | 172 |
cdmClass = TaxonBase.class; |
194 | 173 |
idSet = taxonIdSet; |
195 |
Map<String, TaxonBase> taxonMap = (Map<String, TaxonBase>)getCommonService().getSourcedObjectsByIdInSource(cdmClass, idSet, nameSpace); |
|
174 |
@SuppressWarnings({ "unchecked", "rawtypes" }) |
|
175 |
Map<String, TaxonBase> taxonMap = (Map<String, TaxonBase>)getCommonService().getSourcedObjectsByIdInSource(cdmClass, idSet, nameSpace); |
|
196 | 176 |
result.put(nameSpace, taxonMap); |
197 | 177 |
|
198 |
|
|
199 | 178 |
//sourceReference |
200 | 179 |
Reference sourceReference = getReferenceService().find(PesiTransformer.uuidSourceRefIndexFungorum); |
201 | 180 |
Map<String, Reference> referenceMap = new HashMap<String, Reference>(); |
... | ... | |
217 | 196 |
protected boolean isIgnore(IndexFungorumImportState state){ |
218 | 197 |
return ! state.getConfig().isDoTaxa(); |
219 | 198 |
} |
220 |
|
|
221 |
|
|
222 |
|
|
223 |
|
|
224 |
|
|
225 | 199 |
} |
Also available in: Unified diff
ref #2826 cleanup IF import