commit 279b1a0cf12ae0fbecb57accfc0b2d530891f30d
Author: Andreas Müller <a.mueller@bgbm.org>
Date:   Thu Jan 17 22:47:03 2013 +0000

    Latest AlgaTerra Import developments

diff --git a/.gitattributes b/.gitattributes
index e13e4ba7..bee8e6dd 100644
--- a/.gitattributes
+++ b/.gitattributes
@@ -108,6 +108,7 @@ app-import/src/main/java/eu/etaxonomy/cdm/io/algaterra/AlgaTerraImageImportBase.
 app-import/src/main/java/eu/etaxonomy/cdm/io/algaterra/AlgaTerraImportConfigurator.java -text
 app-import/src/main/java/eu/etaxonomy/cdm/io/algaterra/AlgaTerraImportState.java -text
 app-import/src/main/java/eu/etaxonomy/cdm/io/algaterra/AlgaTerraImportTransformer.java -text
+app-import/src/main/java/eu/etaxonomy/cdm/io/algaterra/AlgaTerraPictureImport.java -text
 app-import/src/main/java/eu/etaxonomy/cdm/io/algaterra/AlgaTerraSiteImagesImport.java -text
 app-import/src/main/java/eu/etaxonomy/cdm/io/algaterra/AlgaTerraSpecimenImport.java -text
 app-import/src/main/java/eu/etaxonomy/cdm/io/algaterra/AlgaTerraSpecimenImportBase.java -text
diff --git a/app-import/src/main/java/eu/etaxonomy/cdm/io/algaterra/AlgaTerraEcoFactImport.java b/app-import/src/main/java/eu/etaxonomy/cdm/io/algaterra/AlgaTerraEcoFactImport.java
index 4b5e9639..ac01865c 100644
--- a/app-import/src/main/java/eu/etaxonomy/cdm/io/algaterra/AlgaTerraEcoFactImport.java
+++ b/app-import/src/main/java/eu/etaxonomy/cdm/io/algaterra/AlgaTerraEcoFactImport.java
@@ -23,13 +23,12 @@ import org.springframework.stereotype.Component;
 
 import eu.etaxonomy.cdm.api.facade.DerivedUnitFacade;
 import eu.etaxonomy.cdm.api.facade.DerivedUnitFacade.DerivedUnitType;
-import eu.etaxonomy.cdm.api.facade.DerivedUnitFacadeNotSupportedException;
 import eu.etaxonomy.cdm.io.algaterra.validation.AlgaTerraSpecimenImportValidator;
 import eu.etaxonomy.cdm.io.berlinModel.in.BerlinModelImportConfigurator;
 import eu.etaxonomy.cdm.io.berlinModel.in.BerlinModelImportState;
-import eu.etaxonomy.cdm.io.berlinModel.in.BerlinModelTaxonImport;
 import eu.etaxonomy.cdm.io.common.IOValidator;
 import eu.etaxonomy.cdm.io.common.ResultSetPartitioner;
+import eu.etaxonomy.cdm.io.common.mapping.UndefinedTransformerMethodException;
 import eu.etaxonomy.cdm.model.common.CdmBase;
 import eu.etaxonomy.cdm.model.common.DefinedTermBase;
 import eu.etaxonomy.cdm.model.common.Language;
@@ -39,25 +38,18 @@ import eu.etaxonomy.cdm.model.common.TermVocabulary;
 import eu.etaxonomy.cdm.model.description.CategoricalData;
 import eu.etaxonomy.cdm.model.description.DescriptionBase;
 import eu.etaxonomy.cdm.model.description.Feature;
-import eu.etaxonomy.cdm.model.description.IndividualsAssociation;
 import eu.etaxonomy.cdm.model.description.MeasurementUnit;
 import eu.etaxonomy.cdm.model.description.Modifier;
 import eu.etaxonomy.cdm.model.description.QuantitativeData;
 import eu.etaxonomy.cdm.model.description.State;
 import eu.etaxonomy.cdm.model.description.StatisticalMeasure;
 import eu.etaxonomy.cdm.model.description.StatisticalMeasurementValue;
-import eu.etaxonomy.cdm.model.description.TaxonDescription;
 import eu.etaxonomy.cdm.model.description.TextData;
-import eu.etaxonomy.cdm.model.name.BotanicalName;
-import eu.etaxonomy.cdm.model.name.Rank;
 import eu.etaxonomy.cdm.model.occurrence.Collection;
-import eu.etaxonomy.cdm.model.occurrence.DerivedUnit;
 import eu.etaxonomy.cdm.model.occurrence.DerivedUnitBase;
 import eu.etaxonomy.cdm.model.occurrence.FieldObservation;
 import eu.etaxonomy.cdm.model.occurrence.SpecimenOrObservationBase;
 import eu.etaxonomy.cdm.model.reference.Reference;
-import eu.etaxonomy.cdm.model.taxon.Taxon;
-import eu.etaxonomy.cdm.model.taxon.TaxonBase;
 
 
 /**
@@ -349,13 +341,11 @@ public class AlgaTerraEcoFactImport  extends AlgaTerraSpecimenImportBase {
 
 
 	private UUID getParameterFeatureUuid(AlgaTerraImportState state, String key) {
-		//TODO define some UUIDs in Transformer
-		UUID uuid = state.getParameterFeatureUuid(key);
-		if (uuid == null){
-			uuid = UUID.randomUUID();
-			state.putParameterFeatureUuid(key, uuid);
+		try {
+			return AlgaTerraImportTransformer.getFeatureUuid(key);
+		} catch (UndefinedTransformerMethodException e) {
+			throw new RuntimeException(e);
 		}
-		return uuid;
 	}
 
 
@@ -368,32 +358,9 @@ public class AlgaTerraEcoFactImport  extends AlgaTerraSpecimenImportBase {
 	 */
 	private MeasurementUnit getMeasurementUnit(AlgaTerraImportState state, String unitStr) {
 		if (StringUtils.isNotBlank(unitStr)){
-			UUID uuidMeasurementUnitMgL = UUID.fromString("7ac302c5-3cbd-4334-964a-bf5d11eb9ead");
-			UUID uuidMeasurementUnitMolMol = UUID.fromString("96b78d78-3e49-448f-8100-e7779b71dd53");
-			UUID uuidMeasurementUnitMicroMolSiL = UUID.fromString("2cb8bc85-a4af-42f1-b80b-34c36c9f75d4");
-			UUID uuidMeasurementUnitMicroMolL = UUID.fromString("a631f62e-377e-405c-bd1a-76885b13a72b");
-			UUID uuidMeasurementUnitDegreeC = UUID.fromString("55222aec-d5be-413e-8db7-d9a48c316c6c");
-			UUID uuidMeasurementUnitPercent = UUID.fromString("3ea3110e-f048-4bed-8bfe-33c60f63626f");
-			UUID uuidMeasurementUnitCm = UUID.fromString("3ea3110e-f048-4bed-8bfe-33c60f63626f");
-			UUID uuidMeasurementUnitMicroSiCm = UUID.fromString("3ea3110e-f048-4bed-8bfe-33c60f63626f");
-			
-			
-			if (unitStr.equalsIgnoreCase("mg/L")){
-				return getMeasurementUnit(state, uuidMeasurementUnitMgL, unitStr, unitStr, unitStr, null);
-			}else if (unitStr.equalsIgnoreCase("mol/mol")){
-				return getMeasurementUnit(state, uuidMeasurementUnitMolMol, unitStr, unitStr, unitStr, null);
-			}else if (unitStr.equalsIgnoreCase("\u00B5mol Si/L")){   //µmol Si/L
-				return getMeasurementUnit(state, uuidMeasurementUnitMicroMolSiL, unitStr, unitStr, unitStr, null);
-			}else if (unitStr.equalsIgnoreCase("\u00B5mol/L")){		//µmol/L
-				return getMeasurementUnit(state, uuidMeasurementUnitMicroMolL, unitStr, unitStr, unitStr, null);
-			}else if (unitStr.equalsIgnoreCase("\u00B0C")){               //°C
-				return getMeasurementUnit(state, uuidMeasurementUnitDegreeC, unitStr, unitStr, unitStr, null);
-			}else if (unitStr.equalsIgnoreCase("%")){
-				return getMeasurementUnit(state, uuidMeasurementUnitPercent, unitStr, unitStr, unitStr, null);
-			}else if (unitStr.equalsIgnoreCase("cm")){
-				return getMeasurementUnit(state, uuidMeasurementUnitCm, unitStr, unitStr, unitStr, null);
-			}else if (unitStr.equalsIgnoreCase("\u00B5S/cm")){   //µS/cm
-				return getMeasurementUnit(state, uuidMeasurementUnitMicroSiCm, unitStr, unitStr, unitStr, null);
+			UUID uuid = AlgaTerraImportTransformer.getMeasurementUnitUuid(unitStr);
+			if (uuid != null){
+				return getMeasurementUnit(state, uuid, unitStr, unitStr, unitStr, null);
 			}else{
 				logger.warn("MeasurementUnit was not recognized");
 				return null;
diff --git a/app-import/src/main/java/eu/etaxonomy/cdm/io/algaterra/AlgaTerraImageImportBase.java b/app-import/src/main/java/eu/etaxonomy/cdm/io/algaterra/AlgaTerraImageImportBase.java
index ff15778d..3c2b0237 100644
--- a/app-import/src/main/java/eu/etaxonomy/cdm/io/algaterra/AlgaTerraImageImportBase.java
+++ b/app-import/src/main/java/eu/etaxonomy/cdm/io/algaterra/AlgaTerraImageImportBase.java
@@ -9,47 +9,20 @@
 
 package eu.etaxonomy.cdm.io.algaterra;
 
-import java.net.URI;
-import java.sql.Date;
 import java.sql.ResultSet;
 import java.sql.SQLException;
-import java.util.Map;
-import java.util.Set;
-import java.util.UUID;
 
-import javassist.runtime.Desc;
-
-import org.apache.commons.lang.StringUtils;
 import org.apache.log4j.Logger;
-import org.springframework.transaction.TransactionStatus;
 
-import eu.etaxonomy.cdm.api.facade.DerivedUnitFacade;
-import eu.etaxonomy.cdm.common.media.ImageInfo;
 import eu.etaxonomy.cdm.io.berlinModel.in.BerlinModelImportBase;
-import eu.etaxonomy.cdm.io.berlinModel.in.BerlinModelTaxonNameImport;
 import eu.etaxonomy.cdm.io.common.ResultSetPartitioner;
-import eu.etaxonomy.cdm.io.common.Source;
-import eu.etaxonomy.cdm.model.agent.Team;
 import eu.etaxonomy.cdm.model.common.CdmBase;
 import eu.etaxonomy.cdm.model.common.Language;
-import eu.etaxonomy.cdm.model.common.OrderedTermVocabulary;
-import eu.etaxonomy.cdm.model.common.TimePeriod;
-import eu.etaxonomy.cdm.model.description.DescriptionBase;
 import eu.etaxonomy.cdm.model.description.DescriptionElementBase;
 import eu.etaxonomy.cdm.model.description.Feature;
 import eu.etaxonomy.cdm.model.description.SpecimenDescription;
-import eu.etaxonomy.cdm.model.description.State;
 import eu.etaxonomy.cdm.model.description.TextData;
-import eu.etaxonomy.cdm.model.location.NamedArea;
-import eu.etaxonomy.cdm.model.location.Point;
-import eu.etaxonomy.cdm.model.location.ReferenceSystem;
-import eu.etaxonomy.cdm.model.location.TdwgArea;
-import eu.etaxonomy.cdm.model.location.WaterbodyOrCountry;
 import eu.etaxonomy.cdm.model.media.Media;
-import eu.etaxonomy.cdm.model.name.TaxonNameBase;
-import eu.etaxonomy.cdm.model.occurrence.Collection;
-import eu.etaxonomy.cdm.model.occurrence.DerivedUnit;
-import eu.etaxonomy.cdm.model.occurrence.DerivedUnitBase;
 import eu.etaxonomy.cdm.model.occurrence.SpecimenOrObservationBase;
 import eu.etaxonomy.cdm.model.reference.Reference;
 
diff --git a/app-import/src/main/java/eu/etaxonomy/cdm/io/algaterra/AlgaTerraImportState.java b/app-import/src/main/java/eu/etaxonomy/cdm/io/algaterra/AlgaTerraImportState.java
index b479661b..b1d70cb9 100644
--- a/app-import/src/main/java/eu/etaxonomy/cdm/io/algaterra/AlgaTerraImportState.java
+++ b/app-import/src/main/java/eu/etaxonomy/cdm/io/algaterra/AlgaTerraImportState.java
@@ -29,7 +29,6 @@ public class AlgaTerraImportState extends BerlinModelImportState{
 	private static final Logger logger = Logger.getLogger(AlgaTerraImportState.class);
 
 	private boolean specimenVocabulariesCreated = false;
-	private Map<String, UUID> parameterFeatureUuidMap = new HashMap<String, UUID>(); 
 	
 	public AlgaTerraImportState(AlgaTerraImportConfigurator config) {
 		super(config);
@@ -47,12 +46,5 @@ public class AlgaTerraImportState extends BerlinModelImportState{
 		this.specimenVocabulariesCreated = specimenVocabulariesCreated;
 	}
 
-	public UUID getParameterFeatureUuid(String key) {
-		return parameterFeatureUuidMap.get(key);
-	}
-
-	public void putParameterFeatureUuid(String key, UUID parameterFeatureUuid) {
-		this.parameterFeatureUuidMap.put(key, parameterFeatureUuid);
-	}
 
 }
diff --git a/app-import/src/main/java/eu/etaxonomy/cdm/io/algaterra/AlgaTerraImportTransformer.java b/app-import/src/main/java/eu/etaxonomy/cdm/io/algaterra/AlgaTerraImportTransformer.java
index c8b2877d..2bfcc76b 100644
--- a/app-import/src/main/java/eu/etaxonomy/cdm/io/algaterra/AlgaTerraImportTransformer.java
+++ b/app-import/src/main/java/eu/etaxonomy/cdm/io/algaterra/AlgaTerraImportTransformer.java
@@ -3,7 +3,15 @@
  */
 package eu.etaxonomy.cdm.io.algaterra;
 
+import java.util.UUID;
+
+import org.apache.commons.lang.StringUtils;
+import org.apache.log4j.Logger;
+
 import eu.etaxonomy.cdm.io.berlinModel.BerlinModelTransformer;
+import eu.etaxonomy.cdm.io.common.mapping.UndefinedTransformerMethodException;
+import eu.etaxonomy.cdm.model.description.Feature;
+import eu.etaxonomy.cdm.model.description.MeasurementUnit;
 
 /**
  * @author a.mueller
@@ -11,5 +19,86 @@ import eu.etaxonomy.cdm.io.berlinModel.BerlinModelTransformer;
  *
  */
 public class AlgaTerraImportTransformer extends BerlinModelTransformer {
+	private static final Logger logger = Logger.getLogger(AlgaTerraImportTransformer.class);
+
+	// feature - parameter
+	public static final UUID uuidFeaturePH = UUID.fromString("99354dac-0695-44b3-a0e6-c4d4f5684006");
+	public static final UUID uuidFeatureConductivity = UUID.fromString("7ddb72ef-dd88-4320-848b-1c36de548459");
+	public static final UUID uuidFeatureWaterTemperature = UUID.fromString("4b45fb58-c6d0-486d-82b7-e1355d177859");
+	public static final UUID uuidFeatureSilica = UUID.fromString("435ff3a7-b117-4eda-bdc7-b68b1e2403d9");
+	public static final UUID uuidFeatureNitrate = UUID.fromString("7d527547-2d2f-405a-bc07-f69884acc3dd");
+	public static final UUID uuidFeatureAmmonium = UUID.fromString("1245d380-ab78-4aef-bcdc-c23bd207bb52");
+	public static final UUID uuidFeatureNitrite = UUID.fromString("0012a3eb-abc5-4022-abbe-286658d6a6dc");
+	public static final UUID uuidFeaturePhosphate = UUID.fromString("f60b5fa6-6600-47e4-9c6d-ca341e3a440c");
+	public static final UUID uuidFeatureDIN = UUID.fromString("1f54453b-91ab-4e15-9664-f21aed90bc8c");
+	public static final UUID uuidFeatureNPRation = UUID.fromString("5ee7741b-da0e-4e0e-8362-1d277350f6ad");
+	public static final UUID uuidFeatureSRP = UUID.fromString("94977e8d-8cad-41d3-bb24-1252474fa884");
+	public static final UUID uuidFeatureOxygenSaturation = UUID.fromString("23c0ca33-ad6b-4cd0-96da-98ab3573deb8");
+	public static final UUID uuidFeatureCommunity = UUID.fromString("3ff5b1ab-3999-4b5a-b8f7-01fd2f6c12c7");
+	public static final UUID uuidFeatureCl = UUID.fromString("0eacde9f-d245-4452-aade-28eb849155e8");
+	public static final UUID uuidFeatureOrthoPhosphate = UUID.fromString("00281ea0-5cb4-4b2f-93f1-c59d6e11cb41");
+	public static final UUID uuidFeatureSecchiDepth = UUID.fromString("4282d63f-107a-4818-abfc-0c23b3d0da83");
+
+	public static final UUID uuidMeasurementUnitMgL = UUID.fromString("7ac302c5-3cbd-4334-964a-bf5d11eb9ead");
+	public static final UUID uuidMeasurementUnitMolMol = UUID.fromString("96b78d78-3e49-448f-8100-e7779b71dd53");
+	public static final UUID uuidMeasurementUnitMicroMolSiL = UUID.fromString("2cb8bc85-a4af-42f1-b80b-34c36c9f75d4");
+	public static final UUID uuidMeasurementUnitMicroMolL = UUID.fromString("a631f62e-377e-405c-bd1a-76885b13a72b");
+	public static final UUID uuidMeasurementUnitDegreeC = UUID.fromString("55222aec-d5be-413e-8db7-d9a48c316c6c");
+	public static final UUID uuidMeasurementUnitPercent = UUID.fromString("3ea3110e-f048-4bed-8bfe-33c60f63626f");
+	public static final UUID uuidMeasurementUnitCm = UUID.fromString("3ea3110e-f048-4bed-8bfe-33c60f63626f");
+	public static final UUID uuidMeasurementUnitMicroSiCm = UUID.fromString("3ea3110e-f048-4bed-8bfe-33c60f63626f");
+
+	
+	/* (non-Javadoc)
+	 * @see eu.etaxonomy.cdm.io.common.mapping.IInputTransformer#getFeatureByKey(java.lang.String)
+	 */
+	public Feature getFeatureByKey(String key) throws UndefinedTransformerMethodException {
+		String warning = "getFeatureByKey is not implemented in implementing transformer class";
+		throw new UndefinedTransformerMethodException(warning);
+	}
+
+	/* (non-Javadoc)
+	 * @see eu.etaxonomy.cdm.io.common.mapping.IInputTransformer#getFeatureUuid(java.lang.String)
+	 */
+	public static UUID getFeatureUuid(String key) throws UndefinedTransformerMethodException {
+		if (key == null){ return null;
+		}else if(key.equalsIgnoreCase("pH")){return uuidFeaturePH;
+		}else if(key.equalsIgnoreCase("Conductivity")){return uuidFeatureConductivity;
+		}else if(key.equalsIgnoreCase("Water temperature")){return uuidFeatureWaterTemperature;
+		}else if(key.equalsIgnoreCase("Silica")){return uuidFeatureSilica;
+		}else if(key.equalsIgnoreCase("Nitrate")){return uuidFeatureNitrate;
+		}else if(key.equalsIgnoreCase("Nitrite")){return uuidFeatureNitrite;
+		}else if(key.equalsIgnoreCase("Ammonium")){return uuidFeatureAmmonium;
+		}else if(key.equalsIgnoreCase("Phosphate")){return uuidFeaturePhosphate;
+		}else if(key.equalsIgnoreCase("DIN")){return uuidFeatureDIN;
+		}else if(key.equalsIgnoreCase("N/P-ratio")){return uuidFeatureNPRation;
+		}else if(key.equalsIgnoreCase("SRP")){return uuidFeatureSRP;
+		}else if(key.equalsIgnoreCase("Oxygen saturation")){return uuidFeatureOxygenSaturation;
+		}else if(key.equalsIgnoreCase("Community")){return uuidFeatureCommunity;
+		}else if(key.equalsIgnoreCase("Cl")){return uuidFeatureCl;
+		}else if(key.equalsIgnoreCase("Ortho-phosphate")){return uuidFeatureOrthoPhosphate;
+		}else if(key.equalsIgnoreCase("Secchi depth")){return uuidFeatureSecchiDepth;
+
+		}else{
+			logger.warn("Feature was not recognized: " + key);
+			return null;
+		}
+	}
+
 	
+	public static UUID getMeasurementUnitUuid(String key) {
+		if (key == null){ return null;	
+		}else if (key.equalsIgnoreCase("mg/L")){ return uuidMeasurementUnitMgL;
+		}else if (key.equalsIgnoreCase("mol/mol")){ return uuidMeasurementUnitMolMol;
+		}else if (key.equalsIgnoreCase("\u00B5mol Si/L")){return uuidMeasurementUnitMicroMolSiL;   //µmol Si/L 
+		}else if (key.equalsIgnoreCase("\u00B5mol/L")){	return uuidMeasurementUnitMicroMolL;	//µmol/L
+		}else if (key.equalsIgnoreCase("\u00B0C")){ return uuidMeasurementUnitDegreeC;           //°C
+		}else if (key.equalsIgnoreCase("%")){ return uuidMeasurementUnitPercent;
+		}else if (key.equalsIgnoreCase("cm")){ return uuidMeasurementUnitCm;
+		}else if (key.equalsIgnoreCase("\u00B5S/cm")){ return uuidMeasurementUnitMicroSiCm;   //µS/cm
+		}else{
+			logger.warn("MeasurementUnit was not recognized");
+			return null;
+		}
+	}
 }
diff --git a/app-import/src/main/java/eu/etaxonomy/cdm/io/algaterra/AlgaTerraPictureImport.java b/app-import/src/main/java/eu/etaxonomy/cdm/io/algaterra/AlgaTerraPictureImport.java
new file mode 100644
index 00000000..f5e29f6c
--- /dev/null
+++ b/app-import/src/main/java/eu/etaxonomy/cdm/io/algaterra/AlgaTerraPictureImport.java
@@ -0,0 +1,207 @@
+/**
+* Copyright (C) 2007 EDIT
+* 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.
+*/
+
+package eu.etaxonomy.cdm.io.algaterra;
+
+import java.sql.ResultSet;
+import java.sql.SQLException;
+import java.util.HashMap;
+import java.util.HashSet;
+import java.util.Map;
+import java.util.Set;
+
+import org.apache.log4j.Logger;
+import org.springframework.stereotype.Component;
+
+import eu.etaxonomy.cdm.io.algaterra.validation.AlgaTerraTypeImportValidator;
+import eu.etaxonomy.cdm.io.berlinModel.in.BerlinModelImportConfigurator;
+import eu.etaxonomy.cdm.io.berlinModel.in.BerlinModelImportState;
+import eu.etaxonomy.cdm.io.common.IOValidator;
+import eu.etaxonomy.cdm.io.common.ResultSetPartitioner;
+import eu.etaxonomy.cdm.model.common.CdmBase;
+import eu.etaxonomy.cdm.model.media.Media;
+import eu.etaxonomy.cdm.model.occurrence.DerivedUnitBase;
+import eu.etaxonomy.cdm.model.occurrence.SpecimenOrObservationBase;
+import eu.etaxonomy.cdm.model.taxon.Taxon;
+import eu.etaxonomy.cdm.model.taxon.TaxonBase;
+
+
+/**
+ * @author a.mueller
+ * @created 20.03.2008
+ * @version 1.0
+ */
+@Component
+public class AlgaTerraPictureImport  extends AlgaTerraImageImportBase {
+	private static final Logger logger = Logger.getLogger(AlgaTerraPictureImport.class);
+
+	
+	private static int modCount = 5000;
+	private static final String pluralString = "pictures";
+	private static final String dbTableName = "Picture";  //??  
+	
+	public AlgaTerraPictureImport(){
+		super(dbTableName, pluralString);
+	}
+	
+	
+	/* (non-Javadoc)
+	 * @see eu.etaxonomy.cdm.io.berlinModel.in.BerlinModelImportBase#getIdQuery()
+	 */
+	@Override
+	protected String getIdQuery(BerlinModelImportState state) {
+		String result = " SELECT PictureId "  
+				+ " FROM Picture p " 
+				+ " WHERE p.PictureFile IS NOT NULL "
+				+ " ORDER BY PictureId ";
+		return result;
+	}
+
+	/* (non-Javadoc)
+	 * @see eu.etaxonomy.cdm.io.berlinModel.in.BerlinModelImportBase#getRecordQuery(eu.etaxonomy.cdm.io.berlinModel.in.BerlinModelImportConfigurator)
+	 */
+	@Override
+	protected String getRecordQuery(BerlinModelImportConfigurator config) {
+			String strQuery =    
+						
+				" SELECT p.*, p.PicturePhrase as FigurePhrase, p.PictureFile as fileName " +
+	            " FROM Picture p  " 
+	            + 	" WHERE ( p.PictureID IN (" + ID_LIST_TOKEN + ")    )"  
+	            + " ORDER BY PictureId ";
+            ;
+		return strQuery;
+	}
+
+	/* (non-Javadoc)
+	 * @see eu.etaxonomy.cdm.io.berlinModel.in.IPartitionedIO#doPartition(eu.etaxonomy.cdm.io.berlinModel.in.ResultSetPartitioner, eu.etaxonomy.cdm.io.berlinModel.in.BerlinModelImportState)
+	 */
+	public boolean doPartition(ResultSetPartitioner partitioner, BerlinModelImportState bmState) {
+		boolean success = true;
+		
+		AlgaTerraImportState state = (AlgaTerraImportState)bmState;
+		
+		Set<SpecimenOrObservationBase> specimenToSave = new HashSet<SpecimenOrObservationBase>();
+		Set<TaxonBase> taxaToSave = new HashSet<TaxonBase>();
+		
+		Map<String, DerivedUnitBase> ecoFactMap = (Map<String, DerivedUnitBase>) partitioner.getObjectMap(AlgaTerraSpecimenImportBase.ECO_FACT_DERIVED_UNIT_NAMESPACE);
+		
+		ResultSet rs = partitioner.getResultSet();
+
+		try {
+			
+			int i = 0;
+
+			//for each reference
+            while (rs.next()){
+                
+        		if ((i++ % modCount) == 0 && i!= 1 ){ logger.info(pluralString + " handled: " + (i-1));}
+				
+				int pictureId = rs.getInt("PictureID");
+				
+				
+				//TODO etc. Created, Notes, Copyright, TermsOfUse etc.
+				
+				try {
+					
+//					DerivedUnitBase<?> derivedUnit = ecoFactMap.get(ecoFactFk);
+//					
+//					if (derivedUnit == null){
+//						logger.warn("Could not find eco fact specimen (" + ecoFactFk +") for voucher image " +  figureId);
+//					}else{
+//						
+//					}
+//					
+//					//field observation
+//					Media media = handleSingleImage(rs, derivedUnit, state, partitioner);
+//					
+//					handleTypeImageSpecificFields(rs, media, state);
+//					
+//					specimenToSave.add(derivedUnit); 
+					
+
+				} catch (Exception e) {
+					logger.warn("Exception in " + getTableName() + ": PictureId " + pictureId + ". " + e.getMessage());
+					e.printStackTrace();
+				} 
+                
+            }
+           
+//            logger.warn("Specimen: " + countSpecimen + ", Descriptions: " + countDescriptions );
+
+			logger.warn(pluralString + " to save: " + specimenToSave.size());
+			getOccurrenceService().save(specimenToSave);	
+			getTaxonService().save(taxaToSave);	
+			
+			return success;
+		} catch (SQLException e) {
+			logger.error("SQLException:" +  e);
+			return false;
+		}
+	}
+
+
+
+	private void handleTypeImageSpecificFields(ResultSet rs, Media media, AlgaTerraImportState state) throws SQLException {
+		//TODO
+		
+	}
+
+	
+	/* (non-Javadoc)
+	 * @see eu.etaxonomy.cdm.io.berlinModel.in.IPartitionedIO#getRelatedObjectsForPartition(java.sql.ResultSet)
+	 */
+	public Map<Object, Map<String, ? extends CdmBase>> getRelatedObjectsForPartition(ResultSet rs) {
+		String nameSpace;
+		Class cdmClass;
+		Set<String> idSet;
+		Map<Object, Map<String, ? extends CdmBase>> result = new HashMap<Object, Map<String, ? extends CdmBase>>();
+		
+		try{
+			Set<String>voucherIdSet = new HashSet<String>();
+			
+			while (rs.next()){
+				handleForeignKey(rs, voucherIdSet, "VoucherFk");
+			}
+			
+			//voucher map
+			nameSpace = AlgaTerraSpecimenImportBase.ECO_FACT_DERIVED_UNIT_NAMESPACE;
+			cdmClass = DerivedUnitBase.class;
+			idSet = voucherIdSet;
+			Map<String, DerivedUnitBase> voucherMap = (Map<String,DerivedUnitBase>)getCommonService().getSourcedObjectsByIdInSource(cdmClass, idSet, nameSpace);
+			result.put(nameSpace, voucherMap);
+
+			
+		} catch (SQLException e) {
+			throw new RuntimeException(e);
+		}
+		return result;
+	}
+
+
+	
+
+	/* (non-Javadoc)
+	 * @see eu.etaxonomy.cdm.io.common.CdmIoBase#doCheck(eu.etaxonomy.cdm.io.common.IoStateBase)
+	 */
+	@Override
+	protected boolean doCheck(BerlinModelImportState state){
+		IOValidator<BerlinModelImportState> validator = new AlgaTerraTypeImportValidator();
+		return validator.validate(state);
+	}
+
+	/* (non-Javadoc)
+	 * @see eu.etaxonomy.cdm.io.common.CdmIoBase#isIgnore(eu.etaxonomy.cdm.io.common.IImportConfigurator)
+	 */
+	protected boolean isIgnore(BerlinModelImportState bmState){
+		AlgaTerraImportConfigurator config = ((AlgaTerraImportState) bmState).getAlgaTerraConfigurator();
+//		return !  ( config.isDoTypes() && config.isDoImages()) ;
+		return false;
+	}
+	
+}
