* 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.specimen;
-
import java.util.HashMap;
import java.util.Map;
import java.util.UUID;
-import org.apache.commons.lang.StringUtils;
-import org.apache.log4j.Logger;
+import org.apache.commons.lang3.StringUtils;
+import org.apache.logging.log4j.LogManager;
+import org.apache.logging.log4j.Logger;
import eu.etaxonomy.cdm.api.service.IAgentService;
import eu.etaxonomy.cdm.api.service.ITermService;
/**
* @author p.kelbert
* @since 20.10.2008
- * @version 1.0
*/
public class UnitsGatheringEvent {
- private static final Logger logger = Logger.getLogger(UnitsGatheringEvent.class);
+ private static final Logger logger = LogManager.getLogger();
+
private static final boolean DEBUG = false;
private final GatheringEvent gatheringEvent = GatheringEvent.NewInstance();
Abcd206ImportConfigurator config) {
this.setLocality(termService, locality, languageIso);
Integer errorRadiusInt = null;
- if (errorRadius != null){
+ if (StringUtils.isNotBlank(errorRadius)){
errorRadiusInt = Integer.getInteger(errorRadius);
}
}
public void setDate(String date){
- TimePeriod timeperiod = this.gatheringEvent.getTimeperiod();
- if(timeperiod==null){
- timeperiod = TimePeriod.NewInstance();
- this.gatheringEvent.setTimeperiod(timeperiod);
- }else{
this.gatheringEvent.setTimeperiod(TimePeriodParser.parseString(date));
- }
}
else{
//TODO check for unit at string end
String pattern = "\\D";// regex for non-digits
- if(elevationMin!=null){
+ if(StringUtils.isNotBlank(elevationMin)){
Integer min = Integer.parseInt(elevationMin.replaceAll(pattern, ""));
this.gatheringEvent.setAbsoluteElevation(min);
}
- if(elevationMax!=null){
+ if(StringUtils.isNotBlank(elevationMax)){
Integer max = Integer.parseInt(elevationMax.replaceAll(pattern, ""));
this.gatheringEvent.setAbsoluteElevationMax(max);
}
- if(elevationUnit!=null){
+ if(StringUtils.isNotBlank(elevationUnit)){
if(!elevationUnit.equals("m")){
//TODO convert if necessary
}
else{
//TODO check for unit at string end
String pattern = "\\D";// regex for non-digits
- if(heightMin!=null){
+ if(StringUtils.isNotBlank(heightMin)){
Double min = Double.parseDouble(heightMin.replaceAll(pattern, ""));
this.gatheringEvent.setDistanceToGround(min);
}
- if(heightMax!=null){
+ if(StringUtils.isNotBlank(heightMax)){
Double max = Double.parseDouble(heightMax.replaceAll(pattern, ""));
this.gatheringEvent.setDistanceToGroundMax(max);
}
- if(heightUnit!=null){
+ if(StringUtils.isNotBlank(heightUnit)){
if (!heightUnit.equals("m")){
logger.debug("The unit " + heightUnit + " of the distance to ground is not meter.");
}
this.gatheringEvent.setDistanceToWaterSurfaceText(depthText);
}
else{
- if (depthUnit != null && depthUnit.equals("cm")){
+ if (StringUtils.isNotBlank(depthUnit) && depthUnit.equals("cm")){
if (depthMin != null) {
depthMin = depthMin/100;
}
if(depthMax!=null){
this.gatheringEvent.setDistanceToWaterSurfaceMax(depthMax);
}
- if(depthUnit!=null){
+ if(StringUtils.isNotBlank(depthUnit)){
if (!depthUnit.equals("m")){
logger.debug("The unit " + depthUnit + " of the distance to ground is not meter.");
return this.gatheringEvent.getCollectingMethod();
}
- /**
- * @param gatheringTeam
- */
public void setTeam(String gatheringTeam, SpecimenSynthesysExcelImportConfigurator config) {
Team t = new Team();
if ((gatheringTeam != null) && !gatheringTeam.isEmpty()) {