From 861ac1fbbb4af9014aa2d53515472d87c1c0d50e Mon Sep 17 00:00:00 2001 From: Francesco Mangiacrapa Date: Mon, 15 Jul 2013 10:16:15 +0000 Subject: [PATCH] =?UTF-8?q?bug=20fixed:=20elapsed=20time=20now=20including?= =?UTF-8?q?=20N=C2=B0=20day/days=20spent?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit git-svn-id: http://svn.research-infrastructures.eu/public/d4science/gcube/trunk/portlets/user/speciesdiscovery@79140 82a268e6-3cf1-43bd-a215-b396298e98cf --- .classpath | 4 ++-- pom.xml | 2 +- .../job/occurrence/OccurrenceGridJob.java | 2 +- .../client/job/taxonomy/TaxonomyGridJob.java | 2 +- .../server/asl/SessionUtil.java | 2 +- .../speciesdiscovery/server/util/DateUtil.java | 17 ++++++++++++++++- .../server/util/StorageUtil.java | 8 ++++++++ 7 files changed, 30 insertions(+), 7 deletions(-) diff --git a/.classpath b/.classpath index df7a4da..6952a3a 100644 --- a/.classpath +++ b/.classpath @@ -1,6 +1,6 @@ - + @@ -31,5 +31,5 @@ - + diff --git a/pom.xml b/pom.xml index 053b343..0f89f67 100644 --- a/pom.xml +++ b/pom.xml @@ -79,7 +79,7 @@ 1.0.0-SNAPSHOT - provided + diff --git a/src/main/java/org/gcube/portlets/user/speciesdiscovery/client/job/occurrence/OccurrenceGridJob.java b/src/main/java/org/gcube/portlets/user/speciesdiscovery/client/job/occurrence/OccurrenceGridJob.java index c4cf9a3..37ec38d 100644 --- a/src/main/java/org/gcube/portlets/user/speciesdiscovery/client/job/occurrence/OccurrenceGridJob.java +++ b/src/main/java/org/gcube/portlets/user/speciesdiscovery/client/job/occurrence/OccurrenceGridJob.java @@ -97,7 +97,7 @@ public class OccurrenceGridJob extends ContentPanel{ ColumnConfig endTime = new ColumnConfig(JobOccurrencesModel.ENDTIME, JobOccurrencesModel.ENDTIME, 140); // endTime.setDateTimeFormat(DateTimeFormat.getFormat(DATE_TIME_FORMAT)); - ColumnConfig elapsedTime = new ColumnConfig(JobOccurrencesModel.ELAPSEDTIME, JobOccurrencesModel.ELAPSEDTIME + " " + ConstantsSpeciesDiscovery.TIMEFORMAT_HH_MM_SS, 100); + ColumnConfig elapsedTime = new ColumnConfig(JobOccurrencesModel.ELAPSEDTIME, JobOccurrencesModel.ELAPSEDTIME + " Days, " + ConstantsSpeciesDiscovery.TIMEFORMAT_HH_MM_SS, 100); elapsedTime.setHidden(true); ColumnConfig fileFormat = new ColumnConfig(JobOccurrencesModel.FILEFORMAT, JobOccurrencesModel.FILEFORMAT, 100); diff --git a/src/main/java/org/gcube/portlets/user/speciesdiscovery/client/job/taxonomy/TaxonomyGridJob.java b/src/main/java/org/gcube/portlets/user/speciesdiscovery/client/job/taxonomy/TaxonomyGridJob.java index 1d98e4a..8840c1d 100644 --- a/src/main/java/org/gcube/portlets/user/speciesdiscovery/client/job/taxonomy/TaxonomyGridJob.java +++ b/src/main/java/org/gcube/portlets/user/speciesdiscovery/client/job/taxonomy/TaxonomyGridJob.java @@ -97,7 +97,7 @@ public class TaxonomyGridJob extends ContentPanel{ ColumnConfig endTime = new ColumnConfig(JobTaxonomyModel.ENDTIME, JobTaxonomyModel.ENDTIME, 140); // endTime.setDateTimeFormat(DateTimeFormat.getFormat(DATE_TIME_FORMAT)); - ColumnConfig elapsedTime = new ColumnConfig(JobTaxonomyModel.ELAPSEDTIME, JobTaxonomyModel.ELAPSEDTIME + " " + ConstantsSpeciesDiscovery.TIMEFORMAT_HH_MM_SS, 140); + ColumnConfig elapsedTime = new ColumnConfig(JobTaxonomyModel.ELAPSEDTIME, JobTaxonomyModel.ELAPSEDTIME + " Days, " + ConstantsSpeciesDiscovery.TIMEFORMAT_HH_MM_SS, 140); ColumnConfig status = new ColumnConfig(JobTaxonomyModel.STATUS, JobTaxonomyModel.STATUS, 80); final ColumnModel cm = new ColumnModel(Arrays.asList(name, dataSources, progress, creationDate, endTime, elapsedTime, status)); diff --git a/src/main/java/org/gcube/portlets/user/speciesdiscovery/server/asl/SessionUtil.java b/src/main/java/org/gcube/portlets/user/speciesdiscovery/server/asl/SessionUtil.java index 638716c..5a2da70 100644 --- a/src/main/java/org/gcube/portlets/user/speciesdiscovery/server/asl/SessionUtil.java +++ b/src/main/java/org/gcube/portlets/user/speciesdiscovery/server/asl/SessionUtil.java @@ -101,7 +101,7 @@ public class SessionUtil { //for test only // user = "test.user"; - user = "francesco.mangiacrapa"; + user = "lucio.lelii"; // user = "pasquale.pagano"; // user = "lucio.lelii"; diff --git a/src/main/java/org/gcube/portlets/user/speciesdiscovery/server/util/DateUtil.java b/src/main/java/org/gcube/portlets/user/speciesdiscovery/server/util/DateUtil.java index 09c736d..c80a55b 100644 --- a/src/main/java/org/gcube/portlets/user/speciesdiscovery/server/util/DateUtil.java +++ b/src/main/java/org/gcube/portlets/user/speciesdiscovery/server/util/DateUtil.java @@ -9,6 +9,8 @@ import java.util.TimeZone; import org.apache.log4j.Logger; import org.gcube.portlets.user.speciesdiscovery.client.ConstantsSpeciesDiscovery; +import org.joda.time.DateTime; +import org.joda.time.Days; public class DateUtil { @@ -154,13 +156,26 @@ public class DateUtil { } + /** + * + * @param date1 + * @param date2 + * @return difference between two date in this format: N°day/days HH:mm:ss + */ public static String getDifference(long date1, long date2){ long millisDiff = date2 - date1; // System.out.println("millisDiff: "+millisDiff); Date date = new Date(millisDiff); DateFormat outFormat = new SimpleDateFormat(ConstantsSpeciesDiscovery.TIMEFORMAT_HH_MM_SS); outFormat.setTimeZone(TimeZone.getTimeZone(ConstantsSpeciesDiscovery.TIME_ZONE_UTC)); - return outFormat.format(date); + int days = Days.daysBetween(new DateTime(date1), new DateTime(date2)).getDays(); + + if(days>0){ + String hours = outFormat.format(date); + return days==1?days + " Day, "+hours:days + " Days, "+hours; + } + else + return outFormat.format(date); } diff --git a/src/main/java/org/gcube/portlets/user/speciesdiscovery/server/util/StorageUtil.java b/src/main/java/org/gcube/portlets/user/speciesdiscovery/server/util/StorageUtil.java index 802a43c..f73926b 100644 --- a/src/main/java/org/gcube/portlets/user/speciesdiscovery/server/util/StorageUtil.java +++ b/src/main/java/org/gcube/portlets/user/speciesdiscovery/server/util/StorageUtil.java @@ -121,5 +121,13 @@ public class StorageUtil { // logger.trace("url extracted: "+loc[1]); // return loc[1]; // } + + public static void main(String[] args) throws Exception { + + InputStream is = getInputStreamByStorageClient("smp:/51e1065ee4b0a159b8c25cc8?5ezvFfBOLqb2cBxvyAbVnOhbxBCSqhv+Z4BC5NS/+OwS5RYBeaUL5FS9eDyNubiTI4vSpggUgPA+jm9rQxwbisfhkOW/m6l2IYG9BKb8AEJFLgVvG3FJTk0+4xV9iM/hNQvChZjoJZna0aPXkHN4Eg=="); + + + + } }