/**
* Copyright (C) 2007 EDIT
-* European Distributed Institute of Taxonomy
+* European Distributed Institute of Taxonomy
* http://www.e-taxonomy.eu
-*
+*
* The contents of this file are subject to the Mozilla Public License Version 1.1
* See LICENSE.TXT at the top of this package for the full license terms.
*/
public static ICdmDataSource cdm_test_local_mysql(){
DatabaseTypeEnum dbType = DatabaseTypeEnum.MySQL;
String cdmServer = "127.0.0.1";
- String cdmDB = "cdm_test";
+ String cdmDB = "cdm_test";
String cdmUserName = "root";
return makeDestination(dbType, cdmServer, cdmDB, -1, cdmUserName, null);
}
-
+
public static ICdmDataSource cdm_test_local_faunaEu_mysql(){
DatabaseTypeEnum dbType = DatabaseTypeEnum.MySQL;
String cdmServer = "127.0.0.1";
- String cdmDB = "cdm_test";
+ String cdmDB = "cdm_faunaeu_2014_07";
String cdmUserName = "root";
return makeDestination(dbType, cdmServer, cdmDB, -1, cdmUserName, null);
}
-
+
public static ICdmDataSource cdm_test_local_indexFungorum(){
DatabaseTypeEnum dbType = DatabaseTypeEnum.MySQL;
String cdmServer = "127.0.0.1";
- String cdmDB = "indexFungorum";
+ String cdmDB = "indexFungorum";
String cdmUserName = "root";
return makeDestination(dbType, cdmServer, cdmDB, -1, cdmUserName, null);
}
-
-
+
+
public static ICdmDataSource cdm_test_local_mysql_erms(){
DatabaseTypeEnum dbType = DatabaseTypeEnum.MySQL;
String cdmServer = "127.0.0.1";
- String cdmDB = "erms";
+ String cdmDB = "erms";
String cdmUserName = "root";
return CdmDestinations.makeDestination(dbType, cdmServer, cdmDB, -1, cdmUserName, null);
}
-
+
public static ICdmDataSource cdm_test_local_mysql_erms2(){
DatabaseTypeEnum dbType = DatabaseTypeEnum.MySQL;
String cdmServer = "127.0.0.1";
- String cdmDB = "erms2";
+ String cdmDB = "erms2";
String cdmUserName = "root";
return CdmDestinations.makeDestination(dbType, cdmServer, cdmDB, -1, cdmUserName, null);
}
-
-
+
+
public static ICdmDataSource cdm_test_local_mysql_test(){
DatabaseTypeEnum dbType = DatabaseTypeEnum.MySQL;
String cdmServer = "127.0.0.1";
- String cdmDB = "test";
+ String cdmDB = "test";
String cdmUserName = "edit";
return makeDestination(dbType, cdmServer, cdmDB, -1, cdmUserName, null);
}
String cdmUserName = "edit";
return makeDestination(dbType, cdmServer, cdmDB, -1, cdmUserName, null);
}
-
+
public static ICdmDataSource cdm_portal_test_localhost2(){
DatabaseTypeEnum dbType = DatabaseTypeEnum.MySQL;
String cdmServer = "127.0.0.1";
String cdmUserName = "edit";
return makeDestination(dbType, cdmServer, cdmDB, -1, cdmUserName, null);
}
-
-
+
+
public static ICdmDataSource NULL(){
return null;
}
-
-
+
+
public static ICdmDataSource localH2(){
return CdmDataSource.NewH2EmbeddedInstance("cdm", "sa", "");
}
-
+
public static ICdmDataSource localH2(String database, String username, String filePath){
return CdmDataSource.NewH2EmbeddedInstance(database, "sa", "", filePath, null);
}
-
+
public static ICdmDataSource localH2EuroMed(){
return CdmDataSource.NewH2EmbeddedInstance("euroMed", "sa", "");
}
-
+
public static ICdmDataSource localH2Erms(){
return CdmDataSource.NewH2EmbeddedInstance("erms", "sa", "");
}
public static ICdmDataSource cdm_algaterra_preview(){
DatabaseTypeEnum dbType = DatabaseTypeEnum.MySQL;
String cdmServer = "160.45.63.201";
- String cdmDB = "cdm_edit_algaterra";
+ String cdmDB = "cdm_edit_algaterra";
String cdmUserName = "edit";
return makeDestination(dbType, cdmServer, cdmDB, -1, cdmUserName, null);
}
public static ICdmDataSource cdm_pesi_euroMed(){
DatabaseTypeEnum dbType = DatabaseTypeEnum.MySQL;
String cdmServer = "160.45.63.175";
- String cdmDB = "cdm_pesi_euromed";
+ String cdmDB = "cdm_pesi_euromed";
String cdmUserName = "edit";
return makeDestination(dbType, cdmServer, cdmDB, -1, cdmUserName, null);
}
String cdmUserName = "root";
return makeDestination(dbType, cdmServer, cdmDB, -1, cdmUserName, null);
}
-
+
public static ICdmDataSource cdm_local_euroMed3(){
DatabaseTypeEnum dbType = DatabaseTypeEnum.MySQL;
String cdmServer = "127.0.0.1";
public static ICdmDataSource cdm_pesi_fauna_europaea(){
DatabaseTypeEnum dbType = DatabaseTypeEnum.MySQL;
String cdmServer = "160.45.63.175";
- String cdmDB = "cdm_pesi_fauna_europaea";
+ String cdmDB = "cdm_pesi_fauna_europaea";
String cdmUserName = "edit";
return makeDestination(dbType, cdmServer, cdmDB, -1, cdmUserName, null);
}
-
+
public static ICdmDataSource cdm_pesi_erms(){
DatabaseTypeEnum dbType = DatabaseTypeEnum.MySQL;
String cdmServer = "160.45.63.175";
- String cdmDB = "cdm_pesi_erms";
+ String cdmDB = "cdm_pesi_erms";
String cdmUserName = "edit";
return makeDestination(dbType, cdmServer, cdmDB, -1, cdmUserName, null);
}
-
+
/**
* initializes source
* TODO only supports MySQL and PostgreSQL
- *
+ *
* @param dbType
* @param cdmServer
* @param cdmDB
pwd = AccountStore.readOrStorePassword(cdmServer, cdmDB, cdmUserName, pwd);
ICdmDataSource destination;
if(dbType.equals(DatabaseTypeEnum.MySQL)){
- destination = CdmDataSource.NewMySqlInstance(cdmServer, cdmDB, port, cdmUserName, pwd, null);
+ destination = CdmDataSource.NewMySqlInstance(cdmServer, cdmDB, port, cdmUserName, pwd, null);
} else if(dbType.equals(DatabaseTypeEnum.PostgreSQL)){
- destination = CdmDataSource.NewPostgreSQLInstance(cdmServer, cdmDB, port, cdmUserName, pwd, null);
+ destination = CdmDataSource.NewPostgreSQLInstance(cdmServer, cdmDB, port, cdmUserName, pwd, null);
} else {
//TODO others
throw new RuntimeException("Unsupported DatabaseType");
/**
- * Accepts a string array and tries to find a method returning an ICdmDataSource with
+ * Accepts a string array and tries to find a method returning an ICdmDataSource with
* the name of the given first string in the array
- *
+ *
* @param args
* @return
*/
public static ICdmDataSource chooseDestination(String[] args) {
- if(args == null)
- return null;
-
- if(args.length != 1)
- return null;
-
+ if(args == null) {
+ return null;
+ }
+
+ if(args.length != 1) {
+ return null;
+ }
+
String possibleDestination = args[0];
-
+
Method[] methods = CdmDestinations.class.getMethods();
-
+
for (Method method : methods){
if(method.getName().equals(possibleDestination)){
try {
}
return null;
}
-
+
}
/**\r
* Copyright (C) 2007 EDIT\r
-* European Distributed Institute of Taxonomy \r
+* European Distributed Institute of Taxonomy\r
* http://www.e-taxonomy.eu\r
-* \r
+*\r
* The contents of this file are subject to the Mozilla Public License Version 1.1\r
* See LICENSE.TXT at the top of this package for the full license terms.\r
*/\r
\r
static final Source faunaEuropaeaSource = PesiSources.mfn_faunEu_pesi3();\r
static final ICdmDataSource cdmDestination = CdmDestinations.cdm_test_local_faunaEu_mysql();\r
+ //static final ICdmDataSource cdmDestination = CdmDestinations.cdm_pesi_fauna_europaea();\r
+\r
\r
- \r
static final int limitSave = 5000;\r
\r
// static final CHECK check = CHECK.CHECK_AND_IMPORT;\r
static final NomenclaturalCode nomenclaturalCode = NomenclaturalCode.ICZN;\r
\r
// ****************** ALL *****************************************\r
- \r
+\r
// Fauna Europaea to CDM import\r
static final boolean doAuthors = true;\r
static final boolean doTaxa = true;\r
static final boolean makeFeatureTree = true;\r
// CDM to CDM import\r
static final boolean doHeterotypicSynonymsForBasionyms = true;\r
- \r
+\r
// ************************ NONE **************************************** //\r
- \r
+\r
// Fauna Europaea to CDM import\r
// static final boolean doAuthors = false;\r
// static final boolean doTaxa = false;\r
// static final boolean makeFeatureTree = false;\r
// // CDM to CDM import\r
// static final boolean doHeterotypicSynonymsForBasionyms = false;\r
- \r
- \r
+\r
+\r
/**\r
* @param args\r
*/\r
public static void main(String[] args) {\r
- \r
+\r
ICdmDataSource destination = cdmDestination;\r
System.out.println("Starting import from Fauna Europaea (" + faunaEuropaeaSource.getDatabase() + ") to CDM (" + destination.getDatabase() + ")...");\r
\r
// invoke Fauna Europaea to CDM import\r
- \r
- FaunaEuropaeaImportConfigurator fauEuImportConfigurator = \r
+\r
+ FaunaEuropaeaImportConfigurator fauEuImportConfigurator =\r
FaunaEuropaeaImportConfigurator.NewInstance(faunaEuropaeaSource, destination);\r
- \r
+\r
fauEuImportConfigurator.setDbSchemaValidation(dbSchemaValidation);\r
fauEuImportConfigurator.setNomenclaturalCode(nomenclaturalCode);\r
fauEuImportConfigurator.setCheck(check);\r
fauEuImportConfigurator.setDoHeterotypicSynonyms(doHeterotypicSynonyms);\r
fauEuImportConfigurator.setDoHeterotypicSynonymsForBasionyms(doHeterotypicSynonymsForBasionyms);\r
fauEuImportConfigurator.setSourceRefUuid(PesiTransformer.uuidSourceRefFaunaEuropaea);\r
- \r
- CdmDefaultImport<FaunaEuropaeaImportConfigurator> fauEuImport = \r
+\r
+ CdmDefaultImport<FaunaEuropaeaImportConfigurator> fauEuImport =\r
new CdmDefaultImport<FaunaEuropaeaImportConfigurator>();\r
try {\r
fauEuImport.invoke(fauEuImportConfigurator);\r
}\r
\r
// invoke CDM to CDM import\r
- \r
+\r
// System.out.println("Starting import from CDM to CDM (" + destination.getDatabase() + ")...");\r
-// \r
-// CdmImportConfigurator cdmImportConfigurator = \r
+//\r
+// CdmImportConfigurator cdmImportConfigurator =\r
// CdmImportConfigurator.NewInstance(destination, destination);\r
-// \r
+//\r
// cdmImportConfigurator.setDbSchemaValidation(DbSchemaValidation.VALIDATE);\r
// cdmImportConfigurator.setNomenclaturalCode(nomenclaturalCode);\r
// cdmImportConfigurator.setCheck(check);\r
// cdmImportConfigurator.setDoOccurrence(false);\r
// cdmImportConfigurator.setLimitSave(limitSave);\r
//\r
-// CdmDefaultImport<CdmImportConfigurator> cdmImport = \r
+// CdmDefaultImport<CdmImportConfigurator> cdmImport =\r
// new CdmDefaultImport<CdmImportConfigurator>();\r
// try {\r
// cdmImport.invoke(cdmImportConfigurator);\r
// System.out.println("ERROR in CDM to CDM import");\r
// e.printStackTrace();\r
// }\r
- \r
+\r
//make feature tree\r
- \r
- if (makeFeatureTree == true) {\r
+\r
+ if (makeFeatureTree) {\r
FeatureTree featureTree = FeatureTree.NewInstance(UUID.fromString("ff59b9ad-1fb8-4aa4-a8ba-79d62123d0fb"));\r
FeatureNode root = featureTree.getRoot();\r
\r
\r
app.getFeatureTreeService().saveOrUpdate(featureTree);\r
}\r
- \r
+\r
System.out.println("End importing Fauna Europaea data");\r
}\r
\r
// $Id$\r
/**\r
* Copyright (C) 2009 EDIT\r
-* European Distributed Institute of Taxonomy \r
+* European Distributed Institute of Taxonomy\r
* http://www.e-taxonomy.eu\r
-* \r
+*\r
* The contents of this file are subject to the Mozilla Public License Version 1.1\r
* See LICENSE.TXT at the top of this package for the full license terms.\r
*/\r
//database validation status (create, update, validate ...)\r
static final Source pesiDestination = PesiDestinations.pesi_test_local_CDM_FE2PESI();\r
// static final Source pesiDestination = PesiDestinations.pesi_test_local_CDM_ERMS2PESI();\r
- \r
+\r
static final ICdmDataSource cdmSource = CdmDestinations.cdm_test_local_faunaEu_mysql();\r
// static final ICdmDataSource cdmSource = CdmDestinations.cdm_test_local_mysql();\r
\r
//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\r
static final int nameIdStart = 10000000;\r
- \r
+\r
static final int partitionSize = 2000;\r
- \r
+\r
//check - export\r
static final CHECK check = CHECK.EXPORT_WITHOUT_CHECK;\r
\r
static final boolean deleteAll = true;\r
- \r
+\r
static final IdType idType = IdType.CDM_ID_WITH_EXCEPTIONS;\r
\r
// ****************** ALL *****************************************\r
- \r
+\r
//references\r
static final DO_REFERENCES doReferences = DO_REFERENCES.ALL;\r
- \r
+\r
//taxa\r
static final boolean doTaxa = true;\r
static final boolean doRelTaxa = true;\r
static final boolean doInferredSynonyms = true;\r
static final boolean doPureNames = false; // !!!\r
static final boolean doDescription = true;\r
- \r
+\r
\r
// ************************ NONE **************************************** //\r
- \r
+\r
// //references\r
// static final DO_REFERENCES doReferences = DO_REFERENCES.NONE;\r
-// \r
+//\r
// //taxa\r
// static final boolean doTaxa = false;\r
// static final boolean doRelTaxa = false;\r
// static final boolean doRank = true;\r
// static final boolean doInferredSynonyms = true;\r
// static final boolean doDescription = false;\r
- \r
- \r
+\r
+\r
public boolean doExport(ICdmDataSource source){\r
System.out.println("Start export to PESI ("+ pesiDestination.getDatabase() + ") ...");\r
- \r
+\r
//make PESI Source\r
Source destination = pesiDestination;\r
PesiTransformer transformer = new PesiTransformer(destination);\r
- \r
+\r
PesiExportConfigurator config = PesiExportConfigurator.NewInstance(destination, source, transformer);\r
- \r
+\r
config.setDoTaxa(doTaxa);\r
config.setDoRelTaxa(doRelTaxa);\r
config.setDoOccurrence(doOccurrence);\r
config.setDoInferredSynonyms(doInferredSynonyms);\r
config.setDoPureNames(doPureNames);\r
config.setDoDescription(doDescription);\r
- \r
+\r
config.setCheck(check);\r
config.setLimitSave(partitionSize);\r
config.setIdType(idType);\r
if (deleteAll){\r
destination.update("EXEC sp_deleteAllData");\r
}\r
- \r
+\r
\r
// invoke export\r
CdmDefaultExport<PesiExportConfigurator> pesiExport = new CdmDefaultExport<PesiExportConfigurator>();\r
- \r
+\r
boolean result = pesiExport.invoke(config);\r
- \r
+\r
System.out.println("End export to PESI ("+ destination.getDatabase() + ")..." + (result? "(successful)":"(with errors)"));\r
return result;\r
}\r
- \r
+\r
/**\r
* @param args\r
*/\r
// $Id$\r
/**\r
* Copyright (C) 2009 EDIT\r
-* European Distributed Institute of Taxonomy \r
+* European Distributed Institute of Taxonomy\r
* http://www.e-taxonomy.eu\r
-* \r
+*\r
* The contents of this file are subject to the Mozilla Public License Version 1.1\r
* See LICENSE.TXT at the top of this package for the full license terms.\r
*/\r
\r
//database validation status (create, update, validate ...)\r
static final Source pesiDestination = PesiDestinations.pesi_test_local_CDM_IF2PESI();\r
- \r
+\r
static final ICdmDataSource cdmSource = CdmDestinations.cdm_test_local_indexFungorum();\r
// static final ICdmDataSource cdmSource = CdmDestinations.cdm_test_local_mysql_test();\r
\r
static final int partitionSize = 2000;\r
- \r
+\r
//check - export\r
static final CHECK check = CHECK.EXPORT_WITHOUT_CHECK;\r
\r
static final boolean deleteAll = true;\r
- \r
+\r
static final IdType idType = IdType.CDM_ID;\r
\r
// ****************** ALL *****************************************\r
- \r
+\r
//references\r
static final DO_REFERENCES doReferences = DO_REFERENCES.ALL;\r
- \r
+\r
//taxa\r
static final boolean doTaxa = true;\r
static final boolean doRelTaxa = true;\r
static final boolean doInferredSynonyms = false;\r
static final boolean doPureNames = false; // !!!\r
static final boolean doDescription = true;\r
- \r
+\r
\r
// ************************ NONE **************************************** //\r
- \r
+\r
// //references\r
// static final DO_REFERENCES doReferences = DO_REFERENCES.NONE;\r
-// \r
+//\r
// //taxa\r
// static final boolean doTaxa = false;\r
// static final boolean doRelTaxa = false;\r
// static final boolean doRank = true;\r
// static final boolean doInferredSynonyms = true;\r
// static final boolean doDescription = false;\r
- \r
- \r
+\r
+\r
public boolean doExport(ICdmDataSource source){\r
System.out.println("Start export to PESI ("+ pesiDestination.getDatabase() + ") ...");\r
- \r
+\r
//make PESI Source\r
Source destination = pesiDestination;\r
PesiTransformer transformer = new PesiTransformer(destination);\r
- \r
+\r
PesiExportConfigurator config = PesiExportConfigurator.NewInstance(destination, source, transformer);\r
- \r
+\r
config.setDoTaxa(doTaxa);\r
config.setDoRelTaxa(doRelTaxa);\r
config.setDoOccurrence(doOccurrence);\r
config.setDoInferredSynonyms(doInferredSynonyms);\r
config.setDoPureNames(doPureNames);\r
config.setDoDescription(doDescription);\r
- \r
+\r
config.setCheck(check);\r
config.setLimitSave(partitionSize);\r
config.setIdType(idType);\r
\r
// invoke export\r
CdmDefaultExport<PesiExportConfigurator> pesiExport = new CdmDefaultExport<PesiExportConfigurator>();\r
- boolean result = pesiExport.invoke(config);\r
- \r
+\r
+ boolean result = pesiExport.invoke(config);\r
+\r
System.out.println("End export to PESI ("+ destination.getDatabase() + ")..." + (result? "(successful)":"(with errors)"));\r
return result;\r
}\r
- \r
+\r
/**\r
* @param args\r
*/\r
/**\r
* Copyright (C) 2007 EDIT\r
-* European Distributed Institute of Taxonomy \r
+* European Distributed Institute of Taxonomy\r
* http://www.e-taxonomy.eu\r
-* \r
+*\r
* The contents of this file are subject to the Mozilla Public License Version 1.1\r
* See LICENSE.TXT at the top of this package for the full license terms.\r
*/\r
import eu.etaxonomy.cdm.model.common.Marker;\r
import eu.etaxonomy.cdm.model.common.MarkerType;\r
import eu.etaxonomy.cdm.model.common.OriginalSourceType;\r
-import eu.etaxonomy.cdm.model.common.TimePeriod;\r
import eu.etaxonomy.cdm.model.name.NonViralName;\r
import eu.etaxonomy.cdm.model.reference.Reference;\r
import eu.etaxonomy.cdm.model.reference.ReferenceFactory;\r
*/\r
public abstract class IndexFungorumImportBase extends CdmImportBase<IndexFungorumImportConfigurator, IndexFungorumImportState> implements ICdmIO<IndexFungorumImportState>, IPartitionedIO<IndexFungorumImportState> {\r
private static final Logger logger = Logger.getLogger(IndexFungorumImportBase.class);\r
- \r
+\r
//NAMESPACES\r
protected static final String NAMESPACE_REFERENCE = "reference";\r
protected static final String NAMESPACE_TAXON = "Taxon";\r
protected static final String NAMESPACE_SUPRAGENERIC_NAMES = "SupragenericNames";\r
protected static final String NAMESPACE_GENERA = "Genera";\r
protected static final String NAMESPACE_SPECIES = "Species";\r
- \r
- \r
+\r
+\r
protected static final String INCERTAE_SEDIS = "Incertae sedis";\r
protected static final String FOSSIL_FUNGI = "Fossil Fungi";\r
\r
protected static final String SOURCE_REFERENCE = "SOURCE_REFERENCE";\r
\r
\r
- \r
\r
- private String pluralString;\r
- private String dbTableName;\r
+\r
+ private final String pluralString;\r
+ private final String dbTableName;\r
//TODO needed?\r
- private Class cdmTargetClass;\r
+ private final Class cdmTargetClass;\r
+\r
+\r
\r
- \r
- \r
/**\r
* @param dbTableName\r
- * @param dbTableName2 \r
+ * @param dbTableName2\r
*/\r
public IndexFungorumImportBase(String pluralString, String dbTableName, Class cdmTargetClass) {\r
this.pluralString = pluralString;\r
this.cdmTargetClass = cdmTargetClass;\r
}\r
\r
- protected void doInvoke(IndexFungorumImportState state){\r
- logger.info("start make " + getPluralString() + " ...");\r
+ @Override\r
+ protected void doInvoke(IndexFungorumImportState state){\r
+ System.out.println("start make " + getPluralString() + " ...");\r
IndexFungorumImportConfigurator config = state.getConfig();\r
Source source = config.getSource();\r
- \r
+\r
+\r
String strIdQuery = getIdQuery();\r
+\r
String strRecordQuery = getRecordQuery(config);\r
\r
int recordsPerTransaction = config.getRecordsPerTransaction();\r
state.setUnsuccessfull();\r
return;\r
}\r
- \r
+\r
logger.info("end make " + getPluralString() + " ... " + getSuccessString(true));\r
return;\r
}\r
- \r
\r
\r
- \r
- \r
- public boolean doPartition(ResultSetPartitioner partitioner, IndexFungorumImportState state) {\r
+\r
+\r
+\r
+\r
+\r
+ @Override\r
+ public boolean doPartition(ResultSetPartitioner partitioner, IndexFungorumImportState state) {\r
boolean success = true ;\r
Set objectsToSave = new HashSet<CdmBase>();\r
- \r
+\r
// DbImportMapping<?, ?> mapping = getMapping();\r
// mapping.initialize(state, cdmTargetClass);\r
- \r
+\r
ResultSet rs = partitioner.getResultSet();\r
try{\r
while (rs.next()){\r
logger.error("SQLException:" + e);\r
return false;\r
}\r
- \r
+\r
partitioner.startDoSave();\r
getCommonService().save(objectsToSave);\r
return success;\r
*/\r
protected abstract String getRecordQuery(IndexFungorumImportConfigurator config);\r
\r
+\r
/**\r
* @return\r
*/\r
String result = " SELECT id FROM " + getTableName();\r
return result;\r
}\r
- \r
+\r
/* (non-Javadoc)\r
* @see eu.etaxonomy.cdm.io.berlinModel.in.IPartitionedIO#getPluralString()\r
*/\r
- public String getPluralString(){\r
+ @Override\r
+ public String getPluralString(){\r
return pluralString;\r
}\r
\r
return this.dbTableName;\r
}\r
\r
- \r
+\r
protected boolean resultSetHasColumn(ResultSet rs, String columnName){\r
try {\r
ResultSetMetaData metaData = rs.getMetaData();\r
return false;\r
}\r
}\r
- \r
+\r
protected boolean checkSqlServerColumnExists(Source source, String tableName, String columnName){\r
String strQuery = "SELECT Count(t.id) as n " +\r
" FROM sysobjects AS t " +\r
" INNER JOIN syscolumns AS c ON t.id = c.id " +\r
- " WHERE (t.xtype = 'U') AND " + \r
- " (t.name = '" + tableName + "') AND " + \r
+ " WHERE (t.xtype = 'U') AND " +\r
+ " (t.name = '" + tableName + "') AND " +\r
" (c.name = '" + columnName + "')";\r
- ResultSet rs = source.getResultSet(strQuery) ; \r
+ ResultSet rs = source.getResultSet(strQuery) ;\r
int n;\r
try {\r
rs.next();\r
e.printStackTrace();\r
return false;\r
}\r
- \r
+\r
}\r
- \r
+\r
/**\r
* Returns a map that holds all values of a ResultSet. This is needed if a value needs to\r
* be accessed twice\r
idSet.add(id);\r
}\r
}\r
- \r
+\r
/**\r
* Returns true if i is a multiple of recordsPerTransaction\r
* @param i\r
startTransaction();\r
return (i % recordsPerLoop) == 0;\r
}\r
- \r
+\r
protected void doLogPerLoop(int count, int recordsPerLog, String pluralString){\r
if ((count % recordsPerLog ) == 0 && count!= 0 ){ logger.info(pluralString + " handled: " + (count));}\r
}\r
- \r
+\r
\r
protected void makeAuthorAndPublication(IndexFungorumImportState state, ResultSet rs, NonViralName name) throws SQLException {\r
//authors\r
if (StringUtils.isNotBlank(authorStr)){\r
try {\r
parser.parseAuthors(name, authorStr);\r
- } catch (StringNotParsableException e){ \r
- logger.warn("Authorstring not parsable: " + authorStr);\r
+ } catch (StringNotParsableException e){\r
+ //logger.warn("Authorstring not parsable: " + authorStr);\r
name.setAuthorshipCache(authorStr);\r
}\r
}\r
- \r
+\r
//page\r
String page = rs.getString("PAGE");\r
if (StringUtils.isNotBlank(page)){\r
name.setNomenclaturalMicroReference(page);\r
}\r
- \r
+\r
//Reference\r
Reference<?> ref = ReferenceFactory.newGeneric();\r
boolean hasInReference = false;\r
logger.warn("'AUTHORS' is blank for not empty PUBLISHING_AUTHORS. This is not yet handled.");\r
}\r
}\r
- \r
+\r
//inRef + inRefAuthor\r
if (pubAuthor != null){\r
Reference<?> inRef = ReferenceFactory.newGeneric();\r
ref.setInReference(inRef);\r
hasInReference = true;\r
}\r
- \r
+\r
//refAuthor\r
TeamOrPersonBase<?> refAuthor = CdmBase.deproxy(name.getCombinationAuthorTeam(), TeamOrPersonBase.class);\r
if (refAuthor == null){\r
}\r
}\r
ref.setVolume(volume);\r
- \r
+\r
//year\r
String yearOfPubl = rs.getString("YEAR OF PUBLICATION");\r
String yearOnPubl = rs.getString("YEAR ON PUBLICATION");\r
if (year != null){\r
ref.setDatePublished(TimePeriodParser.parseString(year));\r
}\r
- \r
+\r
//preliminary, set protected titlecache as Generic Cache Generation with in references currently doesn't fully work yet\r
String titleCache = CdmUtils.concat(", ", pubAuthorStr, title);\r
if ( StringUtils.isNotBlank(pubAuthorStr)){\r
titleCache = CdmUtils.concat(": ", titleCache, page);\r
titleCache = CdmUtils.concat(". ", titleCache, year);\r
ref.setTitleCache(titleCache, true);\r
- \r
+\r
//set nom ref\r
if (StringUtils.isNotBlank(titleCache)){\r
name.setNomenclaturalReference(ref);\r
}\r
}\r
- \r
+\r
\r
protected MarkerType getNoLastActionMarkerType(IndexFungorumImportState state) {\r
- return getMarkerType(state, DbLastActionMapper.uuidMarkerTypeHasNoLastAction, \r
+ return getMarkerType(state, DbLastActionMapper.uuidMarkerTypeHasNoLastAction,\r
"has no last action", "No last action information available", "no last action");\r
}\r
\r
String strId = (id == null ? null : String.valueOf(id));\r
IdentifiableSource source = IdentifiableSource.NewInstance(OriginalSourceType.Import, strId, namespace, sourceReference, null);\r
taxon.addSource(source);\r
- \r
+\r
//no last action\r
MarkerType hasNoLastAction = getNoLastActionMarkerType(state);\r
taxon.addMarker(Marker.NewInstance(hasNoLastAction, true));\r
MarkerType missingGUID = getMarkerType(state, PesiTransformer.uuidMarkerGuidIsMissing, "GUID is missing", "GUID is missing", null);\r
return missingGUID;\r
}\r
- \r
+\r
\r
protected Classification getClassification(IndexFungorumImportState state) {\r
Classification result;\r
result = makeTreeMemSave(state, sourceReference);\r
} else {\r
result = getClassificationService().find(classificationUuid);\r
- } \r
+ }\r
return result;\r
}\r
\r
- \r
\r
\r
- \r
+\r
+\r
}\r
// $Id$\r
/**\r
* Copyright (C) 2009 EDIT\r
-* European Distributed Institute of Taxonomy \r
+* European Distributed Institute of Taxonomy\r
* http://www.e-taxonomy.eu\r
-* \r
+*\r
* The contents of this file are subject to the Mozilla Public License Version 1.1\r
* See LICENSE.TXT at the top of this package for the full license terms.\r
*/\r
import org.springframework.stereotype.Component;\r
import org.springframework.transaction.TransactionStatus;\r
\r
+import com.microsoft.sqlserver.jdbc.SQLServerException;\r
+\r
import eu.etaxonomy.cdm.io.berlinModel.BerlinModelTransformer;\r
import eu.etaxonomy.cdm.io.common.DbExportStateBase;\r
import eu.etaxonomy.cdm.io.common.Source;\r
import eu.etaxonomy.cdm.io.common.mapping.out.DbDescriptionElementTaxonMapper;\r
import eu.etaxonomy.cdm.io.common.mapping.out.DbDistributionStatusMapper;\r
import eu.etaxonomy.cdm.io.common.mapping.out.DbExportIgnoreMapper;\r
-import eu.etaxonomy.cdm.io.common.mapping.out.DbExportNotYetImplementedMapper;\r
import eu.etaxonomy.cdm.io.common.mapping.out.DbLanguageMapper;\r
import eu.etaxonomy.cdm.io.common.mapping.out.DbObjectMapper;\r
import eu.etaxonomy.cdm.io.common.mapping.out.DbOriginalNameMapper;\r
import eu.etaxonomy.cdm.model.name.TaxonNameBase;\r
import eu.etaxonomy.cdm.model.taxon.Taxon;\r
import eu.etaxonomy.cdm.model.taxon.TaxonBase;\r
-import eu.etaxonomy.cdm.profiler.ProfilerController;\r
/**\r
* The export class for {@link eu.etaxonomy.cdm.model.description.DescriptionElementBase DescriptionElements}.<p>\r
* Inserts into DataWarehouse database table <code>Note</code>.<p>\r
@Component\r
public class PesiDescriptionExport extends PesiExportBase {\r
private static final Logger logger = Logger.getLogger(PesiDescriptionExport.class);\r
- \r
+\r
private static final Class<? extends CdmBase> standardMethodParameter = DescriptionElementBase.class;\r
\r
private static int modCount = 1000;\r
//decide where to handle them best (configurator, transformer, single method, ...)\r
private static Set<Integer> excludedNoteCategories = new HashSet<Integer>(Arrays.asList(new Integer[]{250,251,252,253,10,11,13}));\r
\r
- \r
+\r
//debugging\r
private static int countDescriptions;\r
private static int countTaxa;\r
private static int countAdditionalSources;\r
private static int countImages;\r
private static int countNotes;\r
- \r
+\r
private static int countCommonName;\r
private static int countOccurrence;\r
private static int countOthers;\r
- \r
+\r
public PesiDescriptionExport() {\r
super();\r
}\r
\r
// Stores whether this invoke was successful or not.\r
boolean success = true;\r
- \r
+\r
// Get specific mappings: (CDM) DescriptionElement -> (PESI) Note\r
PesiExportMapping notesMapping = getNotesMapping();\r
notesMapping.initialize(state);\r
additionalSourceMapping.initialize(state);\r
\r
// Get specific mappings: (CDM) DescriptionElement -> (PESI) Additional taxon source\r
+\r
PesiExportMapping vernacularMapping = getVernacularNamesMapping();\r
vernacularMapping.initialize(state);\r
- \r
+\r
// Get specific mappings: (CDM) DescriptionElement -> (PESI) Additional taxon source\r
PesiExportMapping imageMapping = getImageMapping();\r
imageMapping.initialize(state);\r
- \r
+\r
// Start transaction\r
success &= doPhase01(state, notesMapping, occurrenceMapping, addSourceSourceMapping, additionalSourceMapping, vernacularMapping, imageMapping);\r
\r
// Start transaction\r
success &= doPhase01b(state, notesMapping, occurrenceMapping, addSourceSourceMapping, additionalSourceMapping, vernacularMapping, imageMapping);\r
\r
- \r
+\r
logger.info("PHASE 2...");\r
success &= doPhase02(state);\r
\r
\r
logger.info("*** Finished Making " + pluralString + " ..." + getSuccessString(success));\r
- \r
+\r
if (!success){\r
state.setUnsuccessfull();\r
}\r
}\r
\r
//PHASE 01: Description Elements\r
- private boolean doPhase01(PesiExportState state, PesiExportMapping notesMapping, PesiExportMapping occurrenceMapping, PesiExportMapping addSourceSourceMapping, \r
+ private boolean doPhase01(PesiExportState state, PesiExportMapping notesMapping, PesiExportMapping occurrenceMapping, PesiExportMapping addSourceSourceMapping,\r
PesiExportMapping additionalSourceMapping, PesiExportMapping vernacularMapping, PesiExportMapping imageMapping) throws SQLException {\r
- logger.info("PHASE 1...");\r
+\r
+ System.out.println("PHASE 1 of occurence import");\r
+ logger.info("PHASE 1...");\r
int count = 0;\r
int pastCount = 0;\r
boolean success = true;\r
int limit = state.getConfig().getLimitSave();\r
\r
List<Taxon> taxonList = null;\r
- \r
+\r
TransactionStatus txStatus = startTransaction(true);\r
logger.info("Started new transaction. Fetching some " + pluralString + " (max: " + limit + ") ...");\r
List<String> propPath = Arrays.asList(new String[]{"descriptions.elements.*"});\r
- \r
+\r
logger.debug("Start snapshot, before starting loop");\r
- ProfilerController.memorySnapshot();\r
+ // ProfilerController.memorySnapshot();\r
//taxon descriptions\r
int partitionCount = 0;\r
while ((taxonList = getNextTaxonPartition(Taxon.class, limit, partitionCount++, propPath )) != null ) {\r
\r
logger.info("Fetched " + taxonList.size() + " " + pluralString + ". Exporting...");\r
- \r
+\r
for (Taxon taxon : taxonList) {\r
countTaxa++;\r
doCount(count++, modCount, pluralString);\r
state.setCurrentTaxon(taxon);\r
- success &= handleSingleTaxon(taxon, state, notesMapping, occurrenceMapping, addSourceSourceMapping, \r
- additionalSourceMapping, vernacularMapping, imageMapping); \r
+ success &= handleSingleTaxon(taxon, state, notesMapping, occurrenceMapping, addSourceSourceMapping,\r
+ additionalSourceMapping, vernacularMapping, imageMapping);\r
}\r
taxonList = null;\r
state.setCurrentTaxon(null);\r
txStatus = startTransaction(true);\r
logger.info("Started new transaction. Fetching some " + pluralString + " (max: " + limit + ") for description import ...");\r
}\r
- \r
- \r
+\r
+\r
logger.info("No " + pluralString + " left to fetch.");\r
logger.info("Partition: " + partitionCount);\r
logger.info("Taxa: " + countTaxa);\r
logger.info("Images: " + countImages);\r
logger.info("Notes: " + countNotes);\r
logger.info("Others: " + countOthers);\r
- \r
+\r
// Commit transaction\r
commitTransaction(txStatus);\r
logger.debug("Committed transaction.");\r
return success;\r
}\r
- \r
+\r
//PHASE 01b: Name Descriptions\r
- private boolean doPhase01b(PesiExportState state, PesiExportMapping notesMapping, PesiExportMapping occurrenceMapping, PesiExportMapping addSourceSourceMapping, \r
+ private boolean doPhase01b(PesiExportState state, PesiExportMapping notesMapping, PesiExportMapping occurrenceMapping, PesiExportMapping addSourceSourceMapping,\r
PesiExportMapping additionalSourceMapping, PesiExportMapping vernacularMapping, PesiExportMapping imageMapping) throws SQLException {\r
logger.info("PHASE 1b...");\r
int count = 0;\r
int pastCount = 0;\r
boolean success = true;\r
int limit = state.getConfig().getLimitSave();\r
- \r
+\r
List<TaxonNameDescription> nameDescList = null;\r
- \r
+\r
TransactionStatus txStatus = startTransaction(true);\r
logger.info("Started new transaction. Fetching some name descriptions (max: " + limit + ") ...");\r
List<String> propPath = Arrays.asList(new String[]{"descriptions.elements.*"});\r
- \r
+\r
//name descriptions\r
int partitionCount = 0;\r
while ((nameDescList = getNextNameDescriptionPartition( limit, partitionCount++, propPath )) != null ) {\r
- \r
+\r
logger.info("Fetched " + nameDescList.size() + " name descriptions. Exporting...");\r
- \r
+\r
for (TaxonNameDescription desc : nameDescList) {\r
countTaxa++;\r
doCount(count++, modCount, "name descriptions");\r
boolean isImageGallery = desc.isImageGallery();\r
- \r
+\r
TaxonNameBase<?,?> name = desc.getTaxonName();\r
- \r
+\r
for (DescriptionElementBase element : desc.getElements()){\r
if (isPurePesiName(name)){\r
success &= handleDescriptionElement(state, notesMapping, occurrenceMapping, vernacularMapping, imageMapping,\r
txStatus = startTransaction(true);\r
logger.info("Started new transaction. Fetching some name descriptions (max: " + limit + ") for description import ...");\r
}\r
- \r
+\r
logger.info("No " + pluralString + " left to fetch.");\r
logger.info("Partition: " + partitionCount);\r
logger.info("Taxa: " + countTaxa);\r
logger.info("Images: " + countImages);\r
logger.info("Notes: " + countNotes);\r
logger.info("Others: " + countOthers);\r
- \r
+\r
// Commit transaction\r
commitTransaction(txStatus);\r
logger.debug("Committed transaction.");\r
}\r
\r
private boolean handleSingleTaxon(Taxon taxon, PesiExportState state, PesiExportMapping notesMapping, PesiExportMapping occurrenceMapping,\r
- PesiExportMapping addSourceSourceMapping, PesiExportMapping additionalSourceMapping, \r
+ PesiExportMapping addSourceSourceMapping, PesiExportMapping additionalSourceMapping,\r
PesiExportMapping vernacularMapping, PesiExportMapping imageMapping) throws SQLException {\r
boolean success = true;\r
+\r
+ System.out.println("handle single Taxon");\r
Set<DescriptionBase<?>> descriptions = new HashSet<DescriptionBase<?>>();\r
descriptions.addAll(taxon.getDescriptions());\r
- \r
+\r
for (DescriptionBase<?> desc : descriptions){\r
countDescriptions++;\r
\r
}\r
\r
private boolean handleDescriptionElement(PesiExportState state, PesiExportMapping notesMapping,\r
- PesiExportMapping occurrenceMapping, PesiExportMapping vernacularMapping, PesiExportMapping imageMapping, \r
+ PesiExportMapping occurrenceMapping, PesiExportMapping vernacularMapping, PesiExportMapping imageMapping,\r
PesiExportMapping addSourceSourceMapping, PesiExportMapping additionalSourceMapping, boolean isImageGallery, DescriptionElementBase element) throws SQLException {\r
try {\r
boolean success = true;\r
countOccurrence++;\r
Distribution distribution = CdmBase.deproxy(element, Distribution.class);\r
MarkerType markerType = getUuidMarkerType(PesiTransformer.uuidMarkerTypeHasNoLastAction, state);\r
- \r
+\r
distribution.addMarker(Marker.NewInstance(markerType, true));\r
if (isPesiDistribution(state, distribution)){\r
countDistribution++;\r
- success &=occurrenceMapping.invoke(element);\r
+ try{\r
+ success &=occurrenceMapping.invoke(element);\r
+ }catch(SQLServerException e){\r
+ System.err.println(element.getInDescription().getTitleCache());\r
+ e.printStackTrace();\r
+ }\r
}\r
}else if (isAdditionalTaxonSource(element)){\r
countAdditionalSources++;\r
}else if (isPesiNote(element)){\r
countNotes++;\r
success &= notesMapping.invoke(element);\r
- \r
+\r
}else{\r
countOthers++;\r
String featureTitle = element.getFeature() == null ? "no feature" :element.getFeature().getTitleCache();\r
if (distribution.getStatus() == null){\r
return false;\r
}\r
- \r
+\r
//...this may change in future so we keep the following code\r
Integer key;\r
//area filter\r
// //Macaronesia records should not be exported to PESI\r
// return false;\r
// //TODO exclude Russion areas Rs*, and maybe ohters\r
- \r
- } else\r
- try {\r
+\r
+ } else {\r
+ try {\r
if (state.getTransformer().getKeyByNamedArea(area) == null){\r
String warning = "Area (%s,%s) not available in PESI transformer for taxon %S: ";\r
TaxonBase<?> taxon = state.getCurrentTaxon();\r
logger.warn("Area not available in PESI transformer " + area.getTitleCache());\r
return false;\r
}\r
+ }\r
return true;\r
- \r
-// \r
+\r
+//\r
// //status\r
// PresenceAbsenceTermBase<?> status = distribution.getStatus();\r
// if (status == null){\r
private boolean doPhase02(PesiExportState state) {\r
TransactionStatus txStatus;\r
boolean success = true;\r
- \r
+\r
// Get the limit for objects to save within a single transaction.\r
int limit = state.getConfig().getLimitSave();\r
- \r
+\r
txStatus = startTransaction(true);\r
ExtensionType taxCommentExtensionType = (ExtensionType)getTermService().find(PesiTransformer.taxCommentUuid);\r
ExtensionType fauCommentExtensionType = (ExtensionType)getTermService().find(PesiTransformer.fauCommentUuid);\r
ExtensionType fauExtraCodesExtensionType = (ExtensionType)getTermService().find(PesiTransformer.fauExtraCodesUuid);\r
List<TaxonNameBase> taxonNameList = null;\r
- \r
+\r
int count = 0;\r
int pastCount = 0;\r
Connection connection = state.getConfig().getDestination().getConnection();\r
for (Extension extension : extensions) {\r
if (extension.getType().equals(taxCommentExtensionType)) {\r
String taxComment = extension.getValue();\r
- invokeNotes(taxComment, \r
- PesiTransformer.getNoteCategoryFk(PesiTransformer.taxCommentUuid), \r
+ invokeNotes(taxComment,\r
+ PesiTransformer.getNoteCategoryFk(PesiTransformer.taxCommentUuid),\r
PesiTransformer.getNoteCategoryCache(PesiTransformer.taxCommentUuid),\r
null, null, getTaxonKey(taxonName, state),connection);\r
} else if (extension.getType().equals(fauCommentExtensionType)) {\r
String fauComment = extension.getValue();\r
- invokeNotes(fauComment, \r
- PesiTransformer.getNoteCategoryFk(PesiTransformer.fauCommentUuid), \r
+ invokeNotes(fauComment,\r
+ PesiTransformer.getNoteCategoryFk(PesiTransformer.fauCommentUuid),\r
PesiTransformer.getNoteCategoryCache(PesiTransformer.fauCommentUuid),\r
null, null, getTaxonKey(taxonName, state),connection);\r
} else if (extension.getType().equals(fauExtraCodesExtensionType)) {\r
String fauExtraCodes = extension.getValue();\r
- invokeNotes(fauExtraCodes, \r
- PesiTransformer.getNoteCategoryFk(PesiTransformer.fauExtraCodesUuid), \r
+ invokeNotes(fauExtraCodes,\r
+ PesiTransformer.getNoteCategoryFk(PesiTransformer.fauExtraCodesUuid),\r
PesiTransformer.getNoteCategoryCache(PesiTransformer.fauExtraCodesUuid),\r
null, null, getTaxonKey(taxonName, state),connection);\r
}\r
}\r
- \r
+\r
doCount(count++, modCount, pluralString);\r
}\r
\r
* @param object2\r
*/\r
private void invokeNotes(String note, Integer noteCategoryFk,\r
- String noteCategoryCache, Integer languageFk, String languageCache, \r
+ String noteCategoryCache, Integer languageFk, String languageCache,\r
Integer taxonFk, Connection connection) {\r
- String notesSql = "UPDATE Note SET Note_1 = ?, NoteCategoryFk = ?, NoteCategoryCache = ?, LanguageFk = ?, LanguageCache = ? WHERE TaxonFk = ?"; \r
+ String notesSql = "UPDATE Note SET Note_1 = ?, NoteCategoryFk = ?, NoteCategoryCache = ?, LanguageFk = ?, LanguageCache = ? WHERE TaxonFk = ?";\r
try {\r
PreparedStatement notesStmt = connection.prepareStatement(notesSql);\r
- \r
+\r
if (note != null) {\r
notesStmt.setString(1, note);\r
} else {\r
notesStmt.setObject(1, null);\r
}\r
- \r
+\r
if (noteCategoryFk != null) {\r
notesStmt.setInt(2, noteCategoryFk);\r
} else {\r
notesStmt.setObject(2, null);\r
}\r
- \r
+\r
if (noteCategoryCache != null) {\r
notesStmt.setString(3, noteCategoryCache);\r
} else {\r
notesStmt.setObject(3, null);\r
}\r
- \r
+\r
if (languageFk != null) {\r
notesStmt.setInt(4, languageFk);\r
} else {\r
notesStmt.setObject(4, null);\r
}\r
- \r
+\r
if (languageCache != null) {\r
notesStmt.setString(5, languageCache);\r
} else {\r
notesStmt.setObject(5, null);\r
}\r
- \r
+\r
if (taxonFk != null) {\r
notesStmt.setInt(6, taxonFk);\r
} else {\r
notesStmt.setObject(6, null);\r
}\r
- \r
+\r
notesStmt.executeUpdate();\r
} catch (SQLException e) {\r
logger.error("Note could not be created: " + note);\r
* @return Whether the delete operation was successful or not.\r
*/\r
protected boolean doDelete(PesiExportState state) {\r
- PesiExportConfigurator pesiConfig = (PesiExportConfigurator) state.getConfig();\r
- \r
+ PesiExportConfigurator pesiConfig = state.getConfig();\r
+\r
String sql;\r
Source destination = pesiConfig.getDestination();\r
\r
}\r
return result;\r
}\r
- \r
+\r
/**\r
* Returns the <code>NoteCategoryCache</code> attribute.\r
* @param descriptionElement The {@link DescriptionElementBase DescriptionElement}.\r
private static String getNoteCategoryCache(DescriptionElementBase descriptionElement, PesiExportState state) {\r
return state.getTransformer().getCacheByFeature(descriptionElement.getFeature());\r
}\r
- \r
- \r
+\r
+\r
\r
\r
/**\r
* Returns the <code>LanguageCache</code> attribute.\r
* @param descriptionElement The {@link DescriptionElementBase DescriptionElement}.\r
* @return The <code>LanguageCache</code> attribute.\r
- * @throws UndefinedTransformerMethodException \r
+ * @throws UndefinedTransformerMethodException\r
* @see MethodMapper\r
*/\r
@SuppressWarnings("unused")\r
} else {\r
logger.debug("Given descriptionElement does not support languages. Hence LanguageCache could not be determined: " + descriptionElement.getUuid());\r
}\r
- \r
+\r
if (multilanguageText != null) {\r
Set<Language> languages = multilanguageText.keySet();\r
\r
// private static String getRegion(DescriptionElementBase descriptionElement) {\r
// String result = null;\r
// DescriptionBase<?> inDescription = descriptionElement.getInDescription();\r
-// \r
+//\r
// // Area information are associated to TaxonDescriptions and Distributions.\r
// if (descriptionElement.isInstanceOf(Distribution.class)) {\r
// Distribution distribution = CdmBase.deproxy(descriptionElement, Distribution.class);\r
// return result;\r
// }\r
\r
- \r
+\r
/**\r
* Returns the TaxonFk for a given TaxonName or Taxon.\r
* @param state The {@link DbExportStateBase DbExportState}.\r
TaxonBase<?> entity = state.getCurrentTaxon();\r
return state.getDbId(entity);\r
}\r
- \r
+\r
/**\r
* Returns the TaxonFk for a given TaxonName.\r
* @param taxonName The {@link TaxonNameBase TaxonName}.\r
private static Integer getTaxonKey(TaxonNameBase<?,?> taxonName, DbExportStateBase<?, PesiTransformer> state) {\r
return state.getDbId(taxonName);\r
}\r
- \r
+\r
/**\r
* Returns the <code>FullName</code> attribute.\r
* @param taxonName The {@link NonViralName NonViralName}.\r
*/\r
@SuppressWarnings("unused")\r
private static String getTaxonFullNameCache(DescriptionElementBase deb, PesiExportState state) {\r
- \r
+\r
TaxonBase<?> taxon = state.getCurrentTaxon();\r
TaxonNameBase<?,?> taxonName = taxon.getName();\r
NonViralName<?> nvn = CdmBase.deproxy(taxonName, NonViralName.class);\r
*/\r
private PesiExportMapping getNotesMapping() {\r
PesiExportMapping mapping = new PesiExportMapping(dbNoteTableName);\r
- \r
+\r
mapping.addMapper(IdMapper.NewInstance("NoteId"));\r
mapping.addMapper(DbTextDataMapper.NewInstance(Language.ENGLISH(), "Note_1"));\r
//TODO\r
mapping.addMapper(MethodMapper.NewInstance("Note_2", this, DescriptionElementBase.class));\r
mapping.addMapper(MethodMapper.NewInstance("NoteCategoryFk", this, DescriptionElementBase.class ));\r
- \r
+\r
mapping.addMapper(MethodMapper.NewInstance("NoteCategoryCache", this, DescriptionElementBase.class, PesiExportState.class ));\r
mapping.addMapper(MethodMapper.NewInstance("LanguageFk", this));\r
mapping.addMapper(MethodMapper.NewInstance("LanguageCache", this, DescriptionElementBase.class, PesiExportState.class));\r
- \r
+\r
// mapping.addMapper(MethodMapper.NewInstance("Region", this));\r
mapping.addMapper(DbDescriptionElementTaxonMapper.NewInstance("taxonFk"));\r
- mapping.addMapper(ExpertsAndLastActionMapper.NewInstance());\r
+ // mapping.addMapper(ExpertsAndLastActionMapper.NewInstance());\r
mapping.addCollectionMapping(getNoteSourceMapping());\r
return mapping;\r
}\r
- \r
+\r
private CollectionExportMapping<PesiExportState, PesiExportConfigurator,PesiTransformer> getNoteSourceMapping() {\r
String tableName = "NoteSource";\r
String collectionAttribute = "sources";\r
mapping.addMapper(DbStringMapper.NewInstance("CitationMicroReference", "SourceDetail"));\r
return mapping;\r
}\r
- \r
+\r
\r
/**\r
* Returns the CDM to PESI specific export mappings for occurrences.\r
*/\r
private PesiExportMapping getOccurrenceMapping() {\r
PesiExportMapping mapping = new PesiExportMapping(dbOccurrenceTableName);\r
- \r
+\r
mapping.addMapper(IdMapper.NewInstance("OccurrenceId"));\r
mapping.addMapper(DbDescriptionElementTaxonMapper.NewInstance("taxonFk"));\r
- mapping.addMapper(DbDescriptionElementTaxonMapper.NewInstance("TaxonFullNameCache", true, true, null)); \r
- \r
+ mapping.addMapper(DbDescriptionElementTaxonMapper.NewInstance("TaxonFullNameCache", true, true, null));\r
+\r
mapping.addMapper(DbAreaMapper.NewInstance(Distribution.class, "Area", "AreaFk", ! IS_CACHE));\r
mapping.addMapper(DbAreaMapper.NewInstance(Distribution.class, "Area", "AreaNameCache", IS_CACHE));\r
mapping.addMapper(DbDistributionStatusMapper.NewInstance("OccurrenceStatusFk", ! IS_CACHE));\r
mapping.addMapper(DbDistributionStatusMapper.NewInstance("OccurrenceStatusCache", IS_CACHE));\r
- \r
+\r
// Use Occurrence source instead\r
mapping.addMapper(DbExportIgnoreMapper.NewInstance("SourceFk", "Use OccurrenceSource table for sources instead"));\r
mapping.addMapper(DbExportIgnoreMapper.NewInstance("SourceNameCache", "Use OccurrenceSource table for sources instead"));\r
- \r
+\r
mapping.addMapper(DbAnnotationMapper.NewInstance(null, "Notes"));\r
- mapping.addMapper(ExpertsAndLastActionMapper.NewInstance());\r
+ // mapping.addMapper(ExpertsAndLastActionMapper.NewInstance());\r
mapping.addCollectionMapping(getOccurrenceSourceMapping());\r
- \r
+\r
return mapping;\r
}\r
\r
\r
return mapping;\r
}\r
- \r
+\r
\r
/**\r
* Returns the CDM to PESI specific export mappings for additional taxon sources to create a new\r
*/\r
private PesiExportMapping getAddTaxonSourceSourceMapping() {\r
PesiExportMapping sourceMapping = new PesiExportMapping(PesiSourceExport.dbTableName);\r
- \r
+\r
sourceMapping.addMapper(IdMapper.NewInstance("SourceId"));\r
sourceMapping.addMapper(DbConstantMapper.NewInstance("SourceCategoryFk", Types.INTEGER, PesiTransformer.REF_UNRESOLVED));\r
sourceMapping.addMapper(DbConstantMapper.NewInstance("SourceCategoryCache", Types.VARCHAR, PesiTransformer.REF_STR_UNRESOLVED));\r
- \r
+\r
// sourceMapping.addMapper(MethodMapper.NewInstance("NomRefCache", PesiSourceExport.class, "getNomRefCache", Reference.class));\r
- \r
+\r
sourceMapping.addMapper(DbTextDataMapper.NewInstance(Language.ENGLISH(), "NomRefCache"));\r
- \r
+\r
return sourceMapping;\r
}\r
\r
- \r
+\r
/**\r
* Returns the CDM to PESI specific export mappings for additional taxon sources.\r
* @see #{@link PesiDescriptionExport#getAddTaxonSourceSourceMapping()}\r
* @return The {@link PesiExportMapping PesiExportMapping}.\r
*/\r
private PesiExportMapping getAdditionalTaxonSourceMapping() {\r
- \r
+\r
PesiExportMapping mapping = new PesiExportMapping(dbAdditionalSourceTableName);\r
- \r
+\r
mapping.addMapper(MethodMapper.NewInstance("TaxonFk", this, DescriptionElementBase.class, PesiExportState.class));\r
- \r
+\r
mapping.addMapper(IdMapper.NewInstance("SourceFk"));\r
mapping.addMapper(DbTextDataMapper.NewInstance(Language.ENGLISH(), "SourceNameCache"));\r
- \r
+\r
mapping.addMapper(DbConstantMapper.NewInstance("SourceUseFk", Types.INTEGER, PesiTransformer.NOMENCLATURAL_REFERENCE));\r
mapping.addMapper(DbConstantMapper.NewInstance("SourceUseCache", Types.VARCHAR, PesiTransformer.STR_NOMENCLATURAL_REFERENCE));\r
- \r
+\r
mapping.addMapper(DbExportIgnoreMapper.NewInstance("SourceDetail", "SourceDetails not available for additional sources"));\r
- \r
+\r
return mapping;\r
}\r
- \r
+\r
/**\r
* Returns the CDM to PESI specific export mappings for common names.\r
* @return The {@link PesiExportMapping PesiExportMapping}.\r
*/\r
private PesiExportMapping getVernacularNamesMapping() {\r
PesiExportMapping mapping = new PesiExportMapping(dbVernacularTableName);\r
- \r
+\r
mapping.addMapper(IdMapper.NewInstance("CommonNameId"));\r
mapping.addMapper(DbDescriptionElementTaxonMapper.NewInstance("taxonFk"));\r
- \r
+\r
mapping.addMapper(DbStringMapper.NewInstance("Name", "CommonName"));\r
mapping.addMapper(DbAreaMapper.NewInstance(CommonTaxonName.class, "Area", "Region", IS_CACHE));\r
- \r
+\r
mapping.addMapper(DbLanguageMapper.NewInstance(CommonTaxonName.class, "Language", "LanguageFk", ! IS_CACHE));\r
mapping.addMapper(DbLanguageMapper.NewInstance(CommonTaxonName.class, "Language", "LanguageCache", IS_CACHE));\r
- \r
+\r
mapping.addMapper(DbSingleSourceMapper.NewInstance("SourceFk", of ( DbSingleSourceMapper.EXCLUDE.WITH_ID) , ! IS_CACHE));\r
mapping.addMapper(DbSingleSourceMapper.NewInstance("SourceNameCache", of ( DbSingleSourceMapper.EXCLUDE.WITH_ID) , IS_CACHE));\r
- mapping.addMapper(ExpertsAndLastActionMapper.NewInstance());\r
+ //mapping.addMapper(ExpertsAndLastActionMapper.NewInstance());\r
return mapping;\r
\r
}\r
- \r
+\r
private PesiExportMapping getImageMapping() {\r
PesiExportMapping mapping = new PesiExportMapping(dbImageTableName);\r
mapping.addMapper(DbDescriptionElementTaxonMapper.NewInstance("taxonFk"));\r
- \r
+\r
//TODO xxx\r
- \r
+\r
return mapping;\r
}\r
\r
// $Id$\r
/**\r
* Copyright (C) 2009 EDIT\r
-* European Distributed Institute of Taxonomy \r
+* European Distributed Institute of Taxonomy\r
* http://www.e-taxonomy.eu\r
-* \r
+*\r
* The contents of this file are subject to the Mozilla Public License Version 1.1\r
* See LICENSE.TXT at the top of this package for the full license terms.\r
*/\r
public class PesiExportState extends DbExportStateBase<PesiExportConfigurator, PesiTransformer>{\r
@SuppressWarnings("unused")\r
private static final Logger logger = Logger.getLogger(PesiExportState.class);\r
- \r
+\r
private static List<Integer> processedSourceList = new ArrayList<Integer>();\r
- \r
+\r
private IdentifiableEntity<?> currentToObject;\r
private IdentifiableEntity<?> currentFromObject;\r
private TaxonBase<?> currentTaxon;\r
private boolean sourceForAdditionalSourceCreated = false;\r
- \r
- private Map<UUID, MarkerType> markerTypeMap = new HashMap<UUID, MarkerType>();\r
- public static final UUID uuidUserDefinedMarkerTypeVocabulary = UUID.fromString("5f02a261-fd7d-4fce-bbe4-21472de8cd51");\r
- \r
+\r
+ private final Map<UUID, MarkerType> markerTypeMap = new HashMap<UUID, MarkerType>();\r
+ private final Map<String,Integer> treeIndexKingdomMap = new HashMap<String,Integer>();\r
+ /**\r
+ * @return the treeIndexKingdomMap\r
+ */\r
+ public Map<String,Integer> getTreeIndexKingdomMap() {\r
+ return treeIndexKingdomMap;\r
+ }\r
+\r
+\r
+ public static final UUID uuidUserDefinedMarkerTypeVocabulary = UUID.fromString("5f02a261-fd7d-4fce-bbe4-21472de8cd51");\r
+\r
@Autowired\r
//@Qualifier("termService")\r
private ITermService termService;\r
public PesiExportState(PesiExportConfigurator config) {\r
super(config);\r
}\r
- \r
+\r
\r
/**\r
* Stores the Datawarehouse.id to a specific CDM object originally.\r
public Integer getDbId(CdmBase cdmBase) {\r
return (Integer)getCurrentIO().getDbId(cdmBase, this);\r
}\r
- \r
+\r
private ITermService getTermService(){\r
return this.termService;\r
}\r
- \r
+\r
/**\r
* Returns whether the given Source object was processed before or not.\r
* @param\r
return false;\r
}\r
}\r
- \r
+\r
/**\r
* Adds given Source to the list of processed Sources.\r
*/\r
if (! processedSourceList.contains(sourceId)) {\r
processedSourceList.add(sourceId);\r
}\r
- \r
+\r
return true;\r
}\r
\r
}\r
\r
public void putMarkerType(MarkerType markerType) {\r
- \r
+\r
markerTypeMap.put(markerType.getUuid(), markerType);\r
- \r
+\r
}\r
\r
\r
log4j.logger.org.hibernate.engine.StatefulPersistenceContext.ProxyWarnLog=error
+
### No warnings as thrown by SQLServer
log4j.logger.org.hibernate.cfg = warn