\r
import eu.etaxonomy.cdm.io.berlinModel.BerlinModelTransformer;\r
import eu.etaxonomy.cdm.io.berlinModel.in.validation.BerlinModelNameStatusImportValidator;\r
-import eu.etaxonomy.cdm.io.common.IImportConfigurator;\r
import eu.etaxonomy.cdm.io.common.IOValidator;\r
import eu.etaxonomy.cdm.io.common.ImportHelper;\r
import eu.etaxonomy.cdm.io.common.ResultSetPartitioner;\r
-import eu.etaxonomy.cdm.model.agent.Person;\r
import eu.etaxonomy.cdm.model.common.CdmBase;\r
import eu.etaxonomy.cdm.model.common.Marker;\r
import eu.etaxonomy.cdm.model.common.MarkerType;\r
\r
/**\r
* @author a.mueller\r
- * @created 20.03.2008\r
+ * @since 20.03.2008\r
*/\r
@Component\r
public class BerlinModelNameStatusImport extends BerlinModelImportBase {\r
\r
private static final long serialVersionUID = 6984893930082868489L;\r
-\r
private static final Logger logger = Logger.getLogger(BerlinModelNameStatusImport.class);\r
\r
private int modCount = 5000;\r
super(dbTableName, pluralString);\r
}\r
\r
-\r
-\r
- /* (non-Javadoc)\r
- * @see eu.etaxonomy.cdm.io.berlinModel.in.BerlinModelImportBase#getIdQuery()\r
- */\r
@Override\r
protected String getIdQuery(BerlinModelImportState state) {\r
String result = " SELECT RIdentifier FROM " + getTableName();\r
return result;\r
}\r
\r
-\r
-\r
- /* (non-Javadoc)\r
- * @see eu.etaxonomy.cdm.io.berlinModel.in.BerlinModelImportBase#getRecordQuery(eu.etaxonomy.cdm.io.berlinModel.in.BerlinModelImportConfigurator)\r
- */\r
@Override\r
protected String getRecordQuery(BerlinModelImportConfigurator config) {\r
String strQuery =\r
}\r
\r
@Override\r
- public boolean doPartition(ResultSetPartitioner partitioner,BerlinModelImportState state) {\r
+ public boolean doPartition(@SuppressWarnings("rawtypes") ResultSetPartitioner partitioner,BerlinModelImportState state) {\r
boolean success = true;\r
String dbAttrName;\r
String cdmAttrName;\r
\r
Set<TaxonName> namesToSave = new HashSet<>();\r
BerlinModelImportConfigurator config = state.getConfig();\r
- Map<String, TaxonName> nameMap = partitioner.getObjectMap(BerlinModelTaxonNameImport.NAMESPACE);\r
+ @SuppressWarnings("unchecked")\r
+ Map<String, TaxonName> nameMap = partitioner.getObjectMap(BerlinModelTaxonNameImport.NAMESPACE);\r
\r
ResultSet rs = partitioner.getResultSet();\r
try {\r
\r
@Override\r
public Map<Object, Map<String, ? extends CdmBase>> getRelatedObjectsForPartition(ResultSet rs, BerlinModelImportState state) {\r
- String nameSpace;\r
- Class<?> cdmClass;\r
+\r
+ String nameSpace;\r
Set<String> idSet;\r
- Map<Object, Map<String, ? extends CdmBase>> result = new HashMap<Object, Map<String, ? extends CdmBase>>();\r
+ Map<Object, Map<String, ? extends CdmBase>> result = new HashMap<>();\r
\r
try{\r
- Set<String> nameIdSet = new HashSet<String>();\r
- Set<String> referenceIdSet = new HashSet<String>();\r
- Set<String> refDetailIdSet = new HashSet<String>();\r
+ Set<String> nameIdSet = new HashSet<>();\r
+ Set<String> referenceIdSet = new HashSet<>();\r
+ Set<String> refDetailIdSet = new HashSet<>();\r
while (rs.next()){\r
handleForeignKey(rs, nameIdSet, "nameFk");\r
handleForeignKey(rs, referenceIdSet, "NomStatusRefFk");\r
\r
//name map\r
nameSpace = BerlinModelTaxonNameImport.NAMESPACE;\r
- cdmClass = TaxonName.class;\r
idSet = nameIdSet;\r
- Map<String, Person> nameMap = (Map<String, Person>)getCommonService().getSourcedObjectsByIdInSource(cdmClass, idSet, nameSpace);\r
+ Map<String, TaxonName> nameMap = getCommonService().getSourcedObjectsByIdInSourceC(TaxonName.class, idSet, nameSpace);\r
result.put(nameSpace, nameMap);\r
\r
//reference map\r
nameSpace = BerlinModelReferenceImport.REFERENCE_NAMESPACE;\r
- cdmClass = Reference.class;\r
idSet = referenceIdSet;\r
- Map<String, Reference> referenceMap = (Map<String, Reference>)getCommonService().getSourcedObjectsByIdInSource(cdmClass, idSet, nameSpace);\r
+ Map<String, Reference> referenceMap = getCommonService().getSourcedObjectsByIdInSourceC(Reference.class, idSet, nameSpace);\r
result.put(nameSpace, referenceMap);\r
\r
//refDetail map\r
nameSpace = BerlinModelRefDetailImport.REFDETAIL_NAMESPACE;\r
- cdmClass = Reference.class;\r
idSet = refDetailIdSet;\r
- Map<String, Reference> refDetailMap= (Map<String, Reference>)getCommonService().getSourcedObjectsByIdInSource(cdmClass, idSet, nameSpace);\r
+ Map<String, Reference> refDetailMap= getCommonService().getSourcedObjectsByIdInSourceC(Reference.class, idSet, nameSpace);\r
result.put(nameSpace, refDetailMap);\r
\r
} catch (SQLException e) {\r
return result;\r
}\r
\r
- private boolean makeReference(IImportConfigurator config, NomenclaturalStatus nomStatus,\r
- int nameId, ResultSet rs, ResultSetPartitioner partitioner)\r
+ private boolean makeReference(BerlinModelImportConfigurator config, NomenclaturalStatus nomStatus,\r
+ int nameId, ResultSet rs, @SuppressWarnings("rawtypes") ResultSetPartitioner partitioner)\r
throws SQLException{\r
\r
- Map<String, Reference> refMap = partitioner.getObjectMap(BerlinModelReferenceImport.REFERENCE_NAMESPACE);\r
- Map<String, Reference> refDetailMap = partitioner.getObjectMap(BerlinModelRefDetailImport.REFDETAIL_NAMESPACE);\r
+ @SuppressWarnings("unchecked")\r
+ Map<String, Reference> refMap = partitioner.getObjectMap(BerlinModelReferenceImport.REFERENCE_NAMESPACE);\r
+ @SuppressWarnings("unchecked")\r
+ Map<String, Reference> refDetailMap = partitioner.getObjectMap(BerlinModelRefDetailImport.REFDETAIL_NAMESPACE);\r
\r
Object nomRefFkObj = rs.getObject("NomStatusRefFk");\r
Object nomRefDetailFkObj = rs.getObject("NomStatusRefDetailFk");\r
return success;\r
}\r
\r
- /* (non-Javadoc)\r
- * @see eu.etaxonomy.cdm.io.common.CdmIoBase#doCheck(eu.etaxonomy.cdm.io.common.IoStateBase)\r
- */\r
@Override\r
protected boolean doCheck(BerlinModelImportState state){\r
IOValidator<BerlinModelImportState> validator = new BerlinModelNameStatusImportValidator();\r
return validator.validate(state);\r
}\r
\r
-\r
- /* (non-Javadoc)\r
- * @see eu.etaxonomy.cdm.io.common.CdmIoBase#isIgnore(eu.etaxonomy.cdm.io.common.IImportConfigurator)\r
- */\r
@Override\r
protected boolean isIgnore(BerlinModelImportState state){\r
return ! state.getConfig().isDoNameStatus();\r
}\r
-\r
-\r
}\r