Revision 401fe405
Added by Andreas Müller over 13 years ago
app-import/src/main/java/eu/etaxonomy/cdm/app/eflora/CentralAfricaEricaceaeActivator.java | ||
---|---|---|
35 | 35 |
import eu.etaxonomy.cdm.model.description.FeatureNode; |
36 | 36 |
import eu.etaxonomy.cdm.model.description.FeatureTree; |
37 | 37 |
import eu.etaxonomy.cdm.model.description.PolytomousKey; |
38 |
import eu.etaxonomy.cdm.model.reference.ReferenceBase;
|
|
38 |
import eu.etaxonomy.cdm.model.reference.Reference; |
|
39 | 39 |
import eu.etaxonomy.cdm.model.reference.ReferenceFactory; |
40 | 40 |
|
41 | 41 |
/** |
... | ... | |
51 | 51 |
static final URI source = EfloraSources.ericacea_local(); |
52 | 52 |
|
53 | 53 |
|
54 |
// static final ICdmDataSource cdmDestination = CdmDestinations.cdm_test_andreasM(); |
|
54 |
// static final ICdmDataSource cdmDestination = CdmDestinations.cdm_test_andreasM3();
|
|
55 | 55 |
// static final ICdmDataSource cdmDestination = CdmDestinations.cdm_flora_central_africa_preview(); |
56 | 56 |
// static final ICdmDataSource cdmDestination = CdmDestinations.cdm_flora_central_africa_production(); |
57 |
// static final ICdmDataSource cdmDestination = CdmDestinations.localH2(); |
|
58 |
static final ICdmDataSource cdmDestination = CdmDestinations.cdm_local_postgres_CdmTest(); |
|
59 |
|
|
60 |
// static final ICdmDataSource cdmDestination = CdmDestinations.cdm_local_postgres_CdmTest(); |
|
57 |
static final ICdmDataSource cdmDestination = CdmDestinations.localH2(); |
|
58 |
// static final ICdmDataSource cdmDestination = CdmDestinations.cdm_local_postgres_CdmTest(); |
|
59 |
// static final ICdmDataSource cdmDestination = CdmDestinations.cdm_test_local_mysql(); |
|
61 | 60 |
|
62 | 61 |
//feature tree uuid |
63 | 62 |
public static final UUID featureTreeUuid = UUID.fromString("051d35ee-22f1-42d8-be07-9e9bfec5bcf7"); |
... | ... | |
82 | 81 |
|
83 | 82 |
private void doImport(ICdmDataSource cdmDestination){ |
84 | 83 |
|
84 |
// CdmUpdater su = CdmUpdater.NewInstance(); |
|
85 |
// |
|
86 |
// try { |
|
87 |
// //su.updateToCurrentVersion(cdmDestination, DefaultProgressMonitor.NewInstance()); |
|
88 |
// } catch (Exception e) { |
|
89 |
// e.printStackTrace(); |
|
90 |
// } |
|
91 |
// if (false){ |
|
92 |
// return; |
|
93 |
// } |
|
94 |
|
|
85 | 95 |
//make Source |
86 | 96 |
CentralAfricaEricaceaeImportConfigurator config= CentralAfricaEricaceaeImportConfigurator.NewInstance(source, cdmDestination); |
87 |
config.setTaxonomicTreeUuid(classificationUuid);
|
|
97 |
config.setClassificationUuid(classificationUuid);
|
|
88 | 98 |
config.setDoTaxa(doTaxa); |
89 | 99 |
config.setCheck(check); |
90 | 100 |
config.setDefaultLanguageUuid(defaultLanguageUuid); |
... | ... | |
108 | 118 |
//check keys |
109 | 119 |
if (doPrintKeys){ |
110 | 120 |
TransactionStatus tx = myImport.getCdmAppController().startTransaction(); |
111 |
List<FeatureTree> keys = myImport.getCdmAppController().getFeatureTreeService().list(PolytomousKey.class, null, null, null, null);
|
|
112 |
for(FeatureTree key : keys){
|
|
113 |
((PolytomousKey)key).print(System.out);
|
|
121 |
List<PolytomousKey> keys = myImport.getCdmAppController().getPolytomousKeyService().list(PolytomousKey.class, null, null, null, null);
|
|
122 |
for(PolytomousKey key : keys){
|
|
123 |
key.print(System.out);
|
|
114 | 124 |
System.out.println(); |
115 | 125 |
} |
116 | 126 |
myImport.getCdmAppController().commitTransaction(tx); |
... | ... | |
123 | 133 |
logger.warn("Deduplicated " + count + " persons."); |
124 | 134 |
count = app.getAgentService().deduplicate(Team.class, null, null); |
125 | 135 |
logger.warn("Deduplicated " + count + " teams."); |
126 |
count = app.getReferenceService().deduplicate(ReferenceBase.class, null, null);
|
|
136 |
count = app.getReferenceService().deduplicate(Reference.class, null, null); |
|
127 | 137 |
logger.warn("Deduplicated " + count + " references."); |
128 |
} |
|
129 | 138 |
} |
130 | 139 |
|
131 |
private ReferenceBase getSourceReference(String string) { |
|
132 |
ReferenceBase result = ReferenceFactory.newGeneric(); |
|
140 |
} |
|
141 |
|
|
142 |
private Reference getSourceReference(String string) { |
|
143 |
Reference result = ReferenceFactory.newGeneric(); |
|
133 | 144 |
result.setTitleCache(string); |
134 | 145 |
return result; |
135 | 146 |
} |
Also available in: Unified diff
merge cdmlib-app-3.0.2 to trunk (app-import)