Revision b920f5c2
Added by Andreas Müller over 3 years ago
cdm-eflora/src/main/java/eu/etaxonomy/cdm/app/eflora/NepenthaceIpniActivator.java | ||
---|---|---|
33 | 33 |
/** |
34 | 34 |
* @author a.mueller |
35 | 35 |
* @since 27.02.2017 |
36 |
* |
|
37 | 36 |
*/ |
38 | 37 |
public class NepenthaceIpniActivator { |
39 | 38 |
|
... | ... | |
91 | 90 |
|
92 | 91 |
app.commitTransaction(txStatus); |
93 | 92 |
|
94 |
|
|
95 |
|
|
96 | 93 |
//// CSVReader csvReader = new CSVReader(reader); |
97 | 94 |
// |
98 | 95 |
// List<String[]> allLines = csvReader.readAll(); |
... | ... | |
102 | 99 |
// } |
103 | 100 |
} |
104 | 101 |
|
105 |
/** |
|
106 |
* @param app |
|
107 |
* @param ipniSec |
|
108 |
* @param classification |
|
109 |
* @param ipniService |
|
110 |
* @param rank |
|
111 |
* @param namesConfig |
|
112 |
*/ |
|
113 |
private void doSingleImport(CdmApplicationController app, Reference ipniSec, Classification classification, |
|
102 |
private void doSingleImport(CdmApplicationController app, Reference ipniSec, Classification classification, |
|
114 | 103 |
IpniServiceNamesConfigurator namesConfig, ImportDeduplicationHelper<?> deduplicationHelper) { |
115 | 104 |
|
116 |
IpniService ipniService = new IpniService();//(IpniService)app.getBean("ipniService"); |
|
105 |
IpniService ipniService = new IpniService();//(IpniService)app.getBean("ipniService");
|
|
117 | 106 |
|
118 |
Rank rank = null; |
|
119 |
List<IBotanicalName> names = ipniService.getNamesAdvanced(null, "Nepenthes", null, null, null, null, |
|
107 |
Rank rank = null;
|
|
108 |
List<IBotanicalName> names = ipniService.getNamesAdvanced(null, "Nepenthes", null, null, null, null,
|
|
120 | 109 |
null, null, rank, namesConfig, app); |
121 | 110 |
|
122 |
System.out.println(names.size()); |
|
111 |
System.out.println(names.size());
|
|
123 | 112 |
|
124 |
List<TaxonBase> taxaToSave = new ArrayList<>(); |
|
125 |
for (IBotanicalName name : names){ |
|
113 |
List<TaxonBase> taxaToSave = new ArrayList<>();
|
|
114 |
for (IBotanicalName name : names){
|
|
126 | 115 |
// System.out.println(name.getTitleCache()); |
127 |
deduplicationHelper.replaceAuthorNamesAndNomRef(null, name); |
|
128 |
Taxon taxon = Taxon.NewInstance(name, ipniSec); |
|
129 |
classification.addChildTaxon(taxon, null, null); |
|
116 |
deduplicationHelper.replaceAuthorNamesAndNomRef(null, name);
|
|
117 |
Taxon taxon = Taxon.NewInstance(name, ipniSec);
|
|
118 |
classification.addChildTaxon(taxon, null, null);
|
|
130 | 119 |
// app.getTaxonService().saveOrUpdate(taxon); |
131 |
taxaToSave.add(taxon); |
|
132 |
} |
|
133 |
app.getTaxonService().saveOrUpdate(taxaToSave); |
|
134 |
app.getClassificationService().saveOrUpdate(classification); |
|
135 |
} |
|
136 |
|
|
137 |
|
|
138 |
/** |
|
139 |
* @param args |
|
140 |
*/ |
|
141 |
public static void main(String[] args) { |
|
142 |
NepenthaceIpniActivator me = new NepenthaceIpniActivator(); |
|
143 |
me.doImport(cdmDestination); |
|
144 |
System.exit(0); |
|
145 |
} |
|
146 |
|
|
147 |
|
|
148 |
} |
|
120 |
taxaToSave.add(taxon); |
|
121 |
} |
|
122 |
app.getTaxonService().saveOrUpdate(taxaToSave); |
|
123 |
app.getClassificationService().saveOrUpdate(classification); |
|
124 |
} |
|
125 |
|
|
126 |
public static void main(String[] args) { |
|
127 |
NepenthaceIpniActivator me = new NepenthaceIpniActivator(); |
|
128 |
me.doImport(cdmDestination); |
|
129 |
System.exit(0); |
|
130 |
} |
|
131 |
} |
Also available in: Unified diff
cleanup