Revision e106b9a0
Added by Katja Luther over 14 years ago
cdmlib-io/src/main/java/eu/etaxonomy/cdm/io/jaxb/JaxbImport.java | ||
---|---|---|
32 | 32 |
import eu.etaxonomy.cdm.model.common.LanguageStringBase; |
33 | 33 |
import eu.etaxonomy.cdm.model.common.ReferencedEntityBase; |
34 | 34 |
import eu.etaxonomy.cdm.model.common.TermVocabulary; |
35 |
import eu.etaxonomy.cdm.model.common.User; |
|
35 | 36 |
import eu.etaxonomy.cdm.model.common.VersionableEntity; |
36 | 37 |
import eu.etaxonomy.cdm.model.description.DescriptionBase; |
37 | 38 |
import eu.etaxonomy.cdm.model.description.FeatureTree; |
... | ... | |
114 | 115 |
Collection<TaxonBase> taxonBases; |
115 | 116 |
List<? extends AgentBase> agents; |
116 | 117 |
List<DefinedTermBase> terms; |
118 |
List<User> users; |
|
117 | 119 |
List<ReferenceBase> references; |
118 | 120 |
List<TaxonNameBase> taxonomicNames; |
119 | 121 |
List<DescriptionBase> descriptions; |
... | ... | |
141 | 143 |
|
142 | 144 |
if ((jaxbImpConfig.isDoTermVocabularies() == true) |
143 | 145 |
&& (termVocabularies = dataSet.getTermVocabularies()).size() > 0) { |
144 |
txStatus = startTransaction(); |
|
146 |
//txStatus = startTransaction();
|
|
145 | 147 |
ret &= saveTermVocabularies(termVocabularies); |
146 |
commitTransaction(txStatus); |
|
148 |
|
|
147 | 149 |
} |
148 | 150 |
|
149 | 151 |
if ((jaxbImpConfig.isDoTerms() == true) |
150 | 152 |
&& (terms = dataSet.getTerms()).size() > 0) { |
151 | 153 |
//txStatus = startTransaction(); |
152 | 154 |
ret &= saveTerms(terms); |
155 |
|
|
153 | 156 |
//commitTransaction(txStatus); |
154 | 157 |
} |
155 | 158 |
|
... | ... | |
168 | 171 |
// ret = false; |
169 | 172 |
// } |
170 | 173 |
// commitTransaction(txStatus); |
171 |
|
|
174 |
try { |
|
175 |
if (jaxbImpConfig.isDoUser() == true) { |
|
176 |
if ((users = dataSet.getUsers()).size() > 0) { |
|
177 |
logger.error("Agents: " + users.size()); |
|
178 |
getUserService().saveAll(users); |
|
179 |
|
|
180 |
} |
|
181 |
} |
|
182 |
} catch (Exception ex) { |
|
183 |
logger.error("Error saving agents"); |
|
184 |
ret = false; |
|
185 |
} |
|
172 | 186 |
|
173 | 187 |
//txStatus = startTransaction(); |
174 | 188 |
try { |
175 | 189 |
if (jaxbImpConfig.isDoAuthors() == true) { |
176 | 190 |
if ((agents = dataSet.getAgents()).size() > 0) { |
177 |
logger.info("Agents: " + agents.size());
|
|
191 |
logger.error("Agents: " + agents.size());
|
|
178 | 192 |
getAgentService().saveAgentAll(agents); |
193 |
|
|
179 | 194 |
} |
180 | 195 |
} |
181 | 196 |
} catch (Exception ex) { |
... | ... | |
185 | 200 |
//commitTransaction(txStatus); |
186 | 201 |
|
187 | 202 |
|
188 |
//txStatus = startTransaction();
|
|
203 |
txStatus = startTransaction(); |
|
189 | 204 |
try { |
190 | 205 |
if (jaxbImpConfig.getDoReferences() != IImportConfigurator.DO_REFERENCES.NONE) { |
191 | 206 |
if ((references = dataSet.getReferences()).size() > 0) { |
192 | 207 |
logger.info("References: " + references.size()); |
193 | 208 |
getReferenceService().saveReferenceAll(references); |
209 |
|
|
194 | 210 |
} |
195 | 211 |
} |
196 | 212 |
} catch (Exception ex) { |
... | ... | |
206 | 222 |
if ((taxonomicNames = dataSet.getTaxonomicNames()).size() > 0) { |
207 | 223 |
logger.info("Taxonomic names: " + taxonomicNames.size()); |
208 | 224 |
getNameService().saveTaxonNameAll(taxonomicNames); |
225 |
|
|
209 | 226 |
} |
210 | 227 |
} |
211 | 228 |
} catch (Exception ex) { |
... | ... | |
221 | 238 |
if ((homotypicalGroups = dataSet.getHomotypicalGroups()).size() > 0) { |
222 | 239 |
logger.info("Homotypical groups: " + homotypicalGroups.size()); |
223 | 240 |
getNameService().saveAllHomotypicalGroups(homotypicalGroups); |
241 |
|
|
224 | 242 |
} |
225 | 243 |
} |
226 | 244 |
} catch (Exception ex) { |
... | ... | |
235 | 253 |
try { |
236 | 254 |
if (jaxbImpConfig.isDoTaxa() == true) { |
237 | 255 |
if ((taxonBases = dataSet.getTaxonBases()).size() > 0) { |
238 |
logger.info("Taxon bases: " + taxonBases.size());
|
|
256 |
logger.error("Taxon bases: " + taxonBases.size());
|
|
239 | 257 |
Iterator <TaxonBase> taxBases = taxonBases.iterator(); |
240 | 258 |
while (taxBases.hasNext()){ |
241 |
getTaxonService().save(taxBases.next()); |
|
259 |
getTaxonService().save( taxBases.next());
|
|
242 | 260 |
} |
261 |
|
|
243 | 262 |
//getTaxonService().saveTaxonAll(taxonBases); |
244 | 263 |
} |
245 | 264 |
} |
... | ... | |
255 | 274 |
try { |
256 | 275 |
if (jaxbImpConfig.isDoTypeDesignations() == true) { |
257 | 276 |
if ((typeDesignations = dataSet.getTypeDesignations()).size() > 0) { |
258 |
logger.info("Type Designations: " + typeDesignations.size());
|
|
277 |
logger.error("Type Designations: " + typeDesignations.size());
|
|
259 | 278 |
getNameService().saveTypeDesignationAll(typeDesignations); |
279 |
|
|
260 | 280 |
} |
261 | 281 |
} |
262 | 282 |
} catch (Exception ex) { |
Also available in: Unified diff