Revision ffd6058e
Added by Andreas Müller over 4 years ago
cdm-pesi/src/main/java/eu/etaxonomy/cdm/io/pesi/indexFungorum/IndexFungorumGeneraImport.java | ||
---|---|---|
39 | 39 |
*/ |
40 | 40 |
@Component |
41 | 41 |
public class IndexFungorumGeneraImport extends IndexFungorumImportBase { |
42 |
private static final Logger logger = Logger.getLogger(IndexFungorumGeneraImport.class); |
|
42 |
|
|
43 |
private static final long serialVersionUID = -265928225339065992L; |
|
44 |
private static final Logger logger = Logger.getLogger(IndexFungorumGeneraImport.class); |
|
43 | 45 |
|
44 | 46 |
private static final String pluralString = "genera"; |
45 | 47 |
private static final String dbTableName = "tblGenera"; |
... | ... | |
48 | 50 |
super(pluralString, dbTableName, null); |
49 | 51 |
} |
50 | 52 |
|
51 |
|
|
52 |
|
|
53 | 53 |
@Override |
54 | 54 |
protected String getIdQuery() { |
55 | 55 |
String result = " SELECT [RECORD NUMBER] FROM " + getTableName() + |
... | ... | |
57 | 57 |
return result; |
58 | 58 |
} |
59 | 59 |
|
60 |
/* (non-Javadoc) |
|
61 |
* @see eu.etaxonomy.cdm.io.berlinModel.in.BerlinModelImportBase#getRecordQuery(eu.etaxonomy.cdm.io.berlinModel.in.BerlinModelImportConfigurator) |
|
62 |
*/ |
|
63 | 60 |
@Override |
64 | 61 |
protected String getRecordQuery(IndexFungorumImportConfigurator config) { |
65 | 62 |
String strRecordQuery = |
... | ... | |
70 | 67 |
return strRecordQuery; |
71 | 68 |
} |
72 | 69 |
|
73 |
|
|
74 |
|
|
75 |
|
|
76 | 70 |
@Override |
77 |
public boolean doPartition(ResultSetPartitioner partitioner, IndexFungorumImportState state) { |
|
78 |
boolean success =true; |
|
71 |
public boolean doPartition(@SuppressWarnings("rawtypes") ResultSetPartitioner partitioner, |
|
72 |
IndexFungorumImportState state) { |
|
73 |
|
|
74 |
boolean success =true; |
|
79 | 75 |
Reference sourceReference = state.getRelatedObject(NAMESPACE_REFERENCE, SOURCE_REFERENCE, Reference.class); |
80 | 76 |
ResultSet rs = partitioner.getResultSet(); |
81 | 77 |
Classification classification = getClassification(state); |
... | ... | |
87 | 83 |
|
88 | 84 |
Double id = (Double)rs.getObject("RECORD NUMBER"); |
89 | 85 |
|
90 |
|
|
91 | 86 |
String preferredName = rs.getString("NAME OF FUNGUS"); |
92 | 87 |
if (StringUtils.isBlank(preferredName)){ |
93 | 88 |
logger.warn("Preferred name is blank. This case is not yet handled by IF import. RECORD NUMBER" + id); |
... | ... | |
112 | 107 |
} |
113 | 108 |
getTaxonService().saveOrUpdate(taxon); |
114 | 109 |
} |
115 |
|
|
116 |
|
|
117 | 110 |
} catch (Exception e) { |
118 | 111 |
e.printStackTrace(); |
119 | 112 |
logger.error(e.getMessage()); |
... | ... | |
136 | 129 |
return taxon; |
137 | 130 |
} |
138 | 131 |
|
139 |
|
|
140 | 132 |
private String getParentNameString(ResultSet rs) throws SQLException { |
141 | 133 |
String parentName = rs.getString("Family name"); |
142 | 134 |
if (parentName == null){ |
... | ... | |
164 | 156 |
return parentName; |
165 | 157 |
} |
166 | 158 |
|
167 |
|
|
168 | 159 |
@Override |
169 | 160 |
public Map<Object, Map<String, ? extends CdmBase>> getRelatedObjectsForPartition(ResultSet rs, IndexFungorumImportState state) { |
170 | 161 |
String nameSpace; |
... | ... | |
201 | 192 |
return result; |
202 | 193 |
} |
203 | 194 |
|
204 |
|
|
205 | 195 |
@Override |
206 | 196 |
protected boolean doCheck(IndexFungorumImportState state){ |
207 | 197 |
return true; |
... | ... | |
211 | 201 |
protected boolean isIgnore(IndexFungorumImportState state){ |
212 | 202 |
return ! state.getConfig().isDoTaxa(); |
213 | 203 |
} |
214 |
|
|
215 |
|
|
216 |
|
|
217 |
|
|
218 |
|
|
219 | 204 |
} |
Also available in: Unified diff
ref #2826 cleanup IF import