solved erros on occurences download

master
lucio 4 years ago
parent 6bab244632
commit d33dfb854f

@ -1,10 +1,38 @@
<?xml version="1.0" encoding="UTF-8"?>
<classpath>
<classpathentry kind="src" output="target/classes" path="src/main/java"/>
<classpathentry excluding="**" kind="src" output="target/classes" path="src/main/resources"/>
<classpathentry kind="src" output="target/test-classes" path="src/test/java"/>
<classpathentry excluding="**" kind="src" output="target/test-classes" path="src/test/resources"/>
<classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER"/>
<classpathentry kind="con" path="org.eclipse.m2e.MAVEN2_CLASSPATH_CONTAINER"/>
<classpathentry kind="src" output="target/classes" path="src/main/java">
<attributes>
<attribute name="optional" value="true"/>
<attribute name="maven.pomderived" value="true"/>
</attributes>
</classpathentry>
<classpathentry excluding="**" kind="src" output="target/classes" path="src/main/resources">
<attributes>
<attribute name="maven.pomderived" value="true"/>
</attributes>
</classpathentry>
<classpathentry kind="src" output="target/test-classes" path="src/test/java">
<attributes>
<attribute name="optional" value="true"/>
<attribute name="maven.pomderived" value="true"/>
<attribute name="test" value="true"/>
</attributes>
</classpathentry>
<classpathentry excluding="**" kind="src" output="target/test-classes" path="src/test/resources">
<attributes>
<attribute name="maven.pomderived" value="true"/>
<attribute name="test" value="true"/>
</attributes>
</classpathentry>
<classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER/org.eclipse.jdt.internal.debug.ui.launcher.StandardVMType/JavaSE-1.8">
<attributes>
<attribute name="maven.pomderived" value="true"/>
</attributes>
</classpathentry>
<classpathentry kind="con" path="org.eclipse.m2e.MAVEN2_CLASSPATH_CONTAINER">
<attributes>
<attribute name="maven.pomderived" value="true"/>
</attributes>
</classpathentry>
<classpathentry kind="output" path="target/classes"/>
</classpath>

@ -1,6 +1,8 @@
#Tue Feb 14 11:06:25 CET 2012
eclipse.preferences.version=1
org.eclipse.jdt.core.compiler.codegen.targetPlatform=1.6
org.eclipse.jdt.core.compiler.compliance=1.6
org.eclipse.jdt.core.compiler.codegen.targetPlatform=1.8
org.eclipse.jdt.core.compiler.compliance=1.8
org.eclipse.jdt.core.compiler.problem.enablePreviewFeatures=disabled
org.eclipse.jdt.core.compiler.problem.forbiddenReference=warning
org.eclipse.jdt.core.compiler.source=1.6
org.eclipse.jdt.core.compiler.problem.reportPreviewFeatures=ignore
org.eclipse.jdt.core.compiler.release=disabled
org.eclipse.jdt.core.compiler.source=1.8

@ -5,13 +5,13 @@
<parent>
<artifactId>maven-parent</artifactId>
<groupId>org.gcube.tools</groupId>
<version>1.0.0</version>
<version>1.1.0</version>
<relativePath />
</parent>
<groupId>org.gcube.data.spd</groupId>
<artifactId>gbif-spd-plugin</artifactId>
<version>1.9.0-SNAPSHOT</version>
<version>1.9.1-SNAPSHOT</version>
<name>GBIFPlugin</name>
<description>gbif plugin for species manager service</description>
@ -45,17 +45,14 @@
<dependency>
<groupId>com.fasterxml.jackson.core</groupId>
<artifactId>jackson-databind</artifactId>
<version>${jackson.version}</version>
</dependency>
<dependency>
<groupId>com.fasterxml.jackson.core</groupId>
<artifactId>jackson-annotations</artifactId>
<version>${jackson.version}</version>
</dependency>
<dependency>
<groupId>com.fasterxml.jackson.core</groupId>
<artifactId>jackson-core</artifactId>
<version>${jackson.version}</version>
</dependency>
<dependency>
@ -81,7 +78,6 @@
<dependency>
<groupId>ch.qos.logback</groupId>
<artifactId>logback-classic</artifactId>
<version>1.0.13</version>
<scope>test</scope>
</dependency>
@ -92,12 +88,6 @@
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-compiler-plugin</artifactId>
<version>3.1</version>
<configuration>
<compilerVersion>1.7</compilerVersion>
<source>1.7</source>
<target>1.7</target>
</configuration>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
@ -128,7 +118,6 @@
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-assembly-plugin</artifactId>
<version>2.2</version>
<configuration>
<descriptors>
<descriptor>${distroDirectory}/descriptor.xml</descriptor>

@ -4,6 +4,7 @@ import static org.gcube.data.spd.gbifplugin.search.query.MappingUtils.getAsCalen
import static org.gcube.data.spd.gbifplugin.search.query.MappingUtils.getAsDouble;
import static org.gcube.data.spd.gbifplugin.search.query.MappingUtils.getAsInteger;
import static org.gcube.data.spd.gbifplugin.search.query.MappingUtils.getAsString;
import static org.gcube.data.spd.gbifplugin.search.query.MappingUtils.getAsLong;
import java.text.SimpleDateFormat;
import java.util.Calendar;
@ -127,7 +128,7 @@ public class OccurrenceSearch {
private OccurrencePoint retrieveElement(Map<String, Object> mappedObj) throws Exception{
long start = System.currentTimeMillis();
String occurrenceId = getAsInteger(mappedObj, "key").toString();
String occurrenceId = mappedObj.get("key").toString();
OccurrencePoint occurrence = new OccurrencePoint(occurrenceId);
occurrence.setCollectionCode(getAsString(mappedObj, "collectionCode"));

@ -65,6 +65,11 @@ public class MappingUtils {
return (Integer) map.get(key);
}
public static Long getAsLong(Map<String, Object> map, String key){
if (!map.containsKey(key)) return 0l;
return (Long) map.get(key);
}
public static Calendar getAsCalendar(Map<String, Object> map, String key){
if (!map.containsKey(key)) return null;
return parseCalendar((String) map.get(key));
@ -73,7 +78,7 @@ public class MappingUtils {
public static Calendar parseCalendar(String date){
try{
DateFormat df = new SimpleDateFormat("yyyy-MM-dd'T'HH:mm:ss.SSSZ");
DateFormat df = new SimpleDateFormat("yyyy-MM-dd");
Calendar calendar= Calendar.getInstance();
calendar.setTime(df.parse(date));
return calendar;

Loading…
Cancel
Save