Project

General

Profile

« Previous | Next » 

Revision 2f628c0c

Added by Andreas Müller over 4 years ago

cleanup

View differences:

cdm-pesi/src/main/java/eu/etaxonomy/cdm/app/pesi/ErmsImportActivator.java
59 59

  
60 60
// ***************** ALL ************************************************//
61 61

  
62
	static final DO_REFERENCES doReferences = DO_REFERENCES.NONE;
62
	static final DO_REFERENCES doReferences = DO_REFERENCES.ALL;
63 63
	static final boolean doTaxa = true;
64 64
	static final boolean doRelTaxa = doTaxa; //should always run with doTaxa because dependent on state from doTaxa
65 65
	static final boolean doSourceUse = true;
......
84 84
	private static DbSchemaValidation hbm2dll = (doReferences ==  DO_REFERENCES.ALL)? DbSchemaValidation.CREATE:DbSchemaValidation.VALIDATE;
85 85

  
86 86
	private void doImport(Source source, ICdmDataSource destination, DbSchemaValidation hbm2dll){
87
		System.out.println("Start import from ("+ ermsSource.getDatabase() + ") to " + cdmDestination.getDatabase() + " ..." );
87
		System.out.println("Start import from ("+ ermsSource.getDatabase() + ") to " + destination.getDatabase() + " ..." );
88 88

  
89 89
		//make ERMS Source
90 90

  
......
126 126
//			app = ermsImport.getCdmAppController();
127 127
//			app.getFeatureTreeService().saveOrUpdate(tree);
128 128
		}
129
		System.out.println("End import from ("+ source.getDatabase() + ") to "+cdmDestination.getDatabase() + "...");
129
		System.out.println("End import from ("+ source.getDatabase() + ") to " + destination.getDatabase() + "...");
130 130
	}
131 131

  
132 132
	public static void main(String[] args) {
cdm-pesi/src/main/java/eu/etaxonomy/cdm/app/pesi/PesiExportActivatorERMS.java
62 62

  
63 63
	static boolean doPureNames = false;  //ERMS has no pure names
64 64

  
65
	//check - export
66
	static final CHECK check = CHECK.EXPORT_WITHOUT_CHECK;
65
    //check - export
66
    static final CHECK check = CHECK.EXPORT_WITHOUT_CHECK;
67 67

  
68
	//Taxon names can't be mapped to their CDM ids as PESI Taxon table mainly holds taxa and there IDs. We ad nameIdStart to the TaxonName id to get a unique id
69
	static final int nameIdStart = 10000000;
70
	static final IdType idType = IdType.CDM_ID_WITH_EXCEPTIONS;
68
    //Taxon names can't be mapped to their CDM ids as PESI Taxon table mainly holds taxa and there IDs. We ad nameIdStart to the TaxonName id to get a unique id
69
    static final int nameIdStart = 10000000;
70
    static final IdType idType = IdType.CDM_ID_WITH_EXCEPTIONS;
71 71

  
72
	static final int partitionSize = 1000;
72
    static final int partitionSize = 1000;
73 73

  
74 74
	public boolean 	doExport(ICdmDataSource source, Source destination){
75 75
		System.out.println("Start export from " + source.getDatabase() + " to PESI ("+ pesiDestination.getDatabase() + ") ...");
cdm-pesi/src/main/java/eu/etaxonomy/cdm/app/pesi/PesiSources.java
62 62
		String userName = "WebUser";
63 63
		return  ImportUtils.makeSource(dbms, strServer, strDB, port, userName, null);
64 64
	}
65
	public static Source faunaEu_old(){
66
		//	Fauna Europaea
67
		String dbms = Source.SQL_SERVER_2008;
68
		String strServer = "BGBM42";               // "192.168.1.36";
69
		String strDB = "FaunaEu_1_3";
70
		int port = 1433;
71
		String userName = "WebUser";
72
		return  ImportUtils.makeSource(dbms, strServer, strDB, port, userName, null);
73
	}
74 65

  
75 66
	public static Source PESI_ERMS(){
76 67
		//	BerlinModel - Pesi-ERMS
cdm-pesi/src/main/java/eu/etaxonomy/cdm/io/pesi/erms/ErmsTaxonImport.java
341 341
			logger.warn("Set name cache: " +  displayName + "; id =" + meId);
342 342
		}
343 343
        if (!taxonName.getNameCache().equals(displayName)){
344
            logger.warn("Computed name cache differs.\n Computed   : " + taxonName.getNameCache()+"\n DisplayName: " +displayName);
344
            int pos = CdmUtils.diffIndex(taxonName.getNameCache(), displayName);
345
            logger.warn("Computed name cache differs at "+pos+".\n Computed   : " + taxonName.getNameCache()+"\n DisplayName: " +displayName);
345 346
            taxonName.setNameCache(displayName, true);
346 347
        }
347 348
		taxonName.getTitleCache();
348 349
        return taxonName;
349 350
    }
350 351

  
351

  
352 352
    @SuppressWarnings("unused")  //used by MethodMapper
353 353
    private static TaxonBase<?> testTitleCache(ResultSet rs, ErmsImportState state) throws SQLException{
354 354
        TaxonBase<?> taxon = (TaxonBase<?>)state.getRelatedObject(DbImportStateBase.CURRENT_OBJECT_NAMESPACE, DbImportStateBase.CURRENT_OBJECT_ID);
cdm-pesi/src/main/java/eu/etaxonomy/cdm/io/pesi/out/PesiExportBase.java
380 380
	 * @param taxonBase
381 381
	 * @return
382 382
	 */
383
	protected static boolean isPesiTaxon(TaxonBase taxonBase, boolean excludeMisappliedNames) {
383
	protected static boolean isPesiTaxon(TaxonBase<?> taxonBase, boolean excludeMisappliedNames) {
384 384
		if (taxonBase == null){
385 385
		    return false;
386 386
		}
......
614 614
            // Sources from TaxonName
615 615
            TaxonName taxonName = CdmBase.deproxy(identifiableEntity, TaxonName.class);
616 616
            Set<IdentifiableSource> testSources = identifiableEntity.getSources();
617
            sources = filterPesiSources(identifiableEntity.getSources());
617
            sources = filterPesiSources(testSources);
618 618

  
619 619
            if (sources.size() == 0 && testSources.size()>0){
620 620
                IdentifiableSource source = testSources.iterator().next();
......
627 627
            // name has no PESI source, take sources from TaxonBase
628 628
            if (sources == null || sources.isEmpty()) {
629 629
                Set<TaxonBase> taxa = taxonName.getTaxonBases();
630
                for (TaxonBase taxonBase: taxa){
630
                for (TaxonBase<?> taxonBase: taxa){
631 631
                    sources.addAll(filterPesiSources(taxonBase.getSources()));
632 632
                }
633 633
            }
cdm-pesi/src/main/java/eu/etaxonomy/cdm/io/pesi/out/PesiSourceExport.java
94 94
		try{
95 95
			logger.info("*** Started Making " + pluralString + " ...");
96 96

  
97
			PesiExportConfigurator pesiExportConfigurator = state.getConfig();
98

  
99 97
			// Get the limit for objects to save within a single transaction.
100 98
			int limit = modCount;//pesiExportConfigurator.getLimitSave();
101 99

  
......
117 115
			TransactionStatus txStatus = null;
118 116
			List<Reference> list = null;
119 117

  
120
//			logger.error("PHASE 1...");
118
//			logger.warn("PHASE 1...");
121 119
			// Start transaction
122 120
			txStatus = startTransaction(true);
123 121
			logger.info("Started new transaction. Fetching some " + pluralString + " (max: " + limit + ") ...");
cdm-pesi/src/main/java/eu/etaxonomy/cdm/io/pesi/out/PesiTransformer.java
601 601
	private final Map<Integer, String> areaCacheMap = new HashMap<>();
602 602
	private final Map<Integer, String> languageCacheMap  = new HashMap<>();
603 603
	private static final Map<String,Integer> languageCodeToKeyMap = new HashMap<>();
604

  
604 605
	private final Map<Integer, String> featureCacheMap  = new HashMap<>();
605 606
	private final Map<Integer, String> nameStatusCacheMap  = new HashMap<>();
606 607
	private final Map<Integer, String> qualityStatusCacheMap  = new HashMap<>();
cdm-pesi/src/main/resources/log4j.properties
57 57

  
58 58
### ***HIBERNATE ************ ###
59 59
log4j.logger.org.hibernate=warn
60
log4j.logger.org.hibernate.engine.StatefulPersistenceContext.ProxyWarnLog=error
60
log4j.logger.org.hibernate.engine.internal.StatefulPersistenceContext=error
61

  
61 62
log4j.logger.org.hibernate.orm.deprecation = error
62 63

  
63 64

  

Also available in: Unified diff