bug fixed: elapsed time now including N° day/days spent

git-svn-id: http://svn.research-infrastructures.eu/public/d4science/gcube/trunk/portlets/user/speciesdiscovery@79140 82a268e6-3cf1-43bd-a215-b396298e98cf
This commit is contained in:
Francesco Mangiacrapa 2013-07-15 10:16:15 +00:00
parent 3d15a31af9
commit 861ac1fbbb
7 changed files with 30 additions and 7 deletions

View File

@ -1,6 +1,6 @@
<?xml version="1.0" encoding="UTF-8"?>
<classpath>
<classpathentry kind="src" output="target/species-discovery-3.2.0-SNAPSHOT/WEB-INF/classes" path="src/main/java">
<classpathentry kind="src" output="target/species-discovery-3.3.0-SNAPSHOT/WEB-INF/classes" path="src/main/java">
<attributes>
<attribute name="optional" value="true"/>
<attribute name="maven.pomderived" value="true"/>
@ -31,5 +31,5 @@
<attribute name="org.eclipse.jst.component.dependency" value="/WEB-INF/lib"/>
</attributes>
</classpathentry>
<classpathentry kind="output" path="target/species-discovery-3.2.0-SNAPSHOT/WEB-INF/classes"/>
<classpathentry kind="output" path="target/species-discovery-3.3.0-SNAPSHOT/WEB-INF/classes"/>
</classpath>

View File

@ -79,7 +79,7 @@
<version>1.0.0-SNAPSHOT</version>
<!-- <version>[1.0.0-SNAPSHOT, 2.0.0-SNAPSHOT)</version> -->
<!-- UNCOMMENT THIS FOR RELEASE -->
<scope>provided</scope>
<!-- <scope>provided</scope> -->
</dependency>
<dependency>

View File

@ -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);

View File

@ -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));

View File

@ -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";

View File

@ -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);
}

View File

@ -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==");
}
}