Fixed TimeZone
git-svn-id: https://svn.d4science.research-infrastructures.eu/gcube/trunk/portlets/user/tabular-data-gwt-service@115605 82a268e6-3cf1-43bd-a215-b396298e98cf
This commit is contained in:
parent
5aa624f7ac
commit
8b52dd1a06
|
@ -5,7 +5,6 @@ package org.gcube.portlets.user.td.gwtservice.server;
|
|||
|
||||
import java.io.InputStream;
|
||||
import java.nio.charset.Charset;
|
||||
import java.text.ParseException;
|
||||
import java.text.SimpleDateFormat;
|
||||
import java.util.ArrayList;
|
||||
import java.util.Arrays;
|
||||
|
@ -317,9 +316,7 @@ public class TDGWTServiceImpl extends RemoteServiceServlet implements
|
|||
|
||||
private static SimpleDateFormat sdf = new SimpleDateFormat(
|
||||
"yyyy-MM-dd HH:mm");
|
||||
|
||||
private static SimpleDateFormat sdfDate = new SimpleDateFormat("yyyy-MM-dd");
|
||||
|
||||
|
||||
private static SimpleDateFormat sdfPerformance = new SimpleDateFormat(
|
||||
"yyyy-MM-dd HH:mm:ss.SSS");
|
||||
|
||||
|
@ -1050,7 +1047,7 @@ public class TDGWTServiceImpl extends RemoteServiceServlet implements
|
|||
ArrayList<TRMetadata> trMetadatas = getTRMetadata(tr);
|
||||
updateTabResourceInformation(currentTR, trMetadatas);
|
||||
|
||||
currentTR.setDate(sdf.format(tr.getCreationDate().getTime()));
|
||||
currentTR.setDate(tr.getCreationDate().getTime());
|
||||
currentTR.setValid(tr.isValid());
|
||||
currentTR.setFinalized(tr.isFinalized());
|
||||
currentTR.setLocked(tr.isLocked());
|
||||
|
@ -1111,7 +1108,7 @@ public class TDGWTServiceImpl extends RemoteServiceServlet implements
|
|||
ArrayList<TRMetadata> trMetadatas = getTRMetadata(tr);
|
||||
updateTabResourceInformation(currentTR, trMetadatas);
|
||||
|
||||
currentTR.setDate(sdf.format(tr.getCreationDate().getTime()));
|
||||
currentTR.setDate(tr.getCreationDate().getTime());
|
||||
currentTR.setValid(tr.isValid());
|
||||
currentTR.setFinalized(tr.isFinalized());
|
||||
currentTR.setLocked(tr.isLocked());
|
||||
|
@ -2812,7 +2809,7 @@ public class TDGWTServiceImpl extends RemoteServiceServlet implements
|
|||
+ " ,description:" + tabResource.getDescription() + " ,agency:"
|
||||
+ tabResource.getAgency() + " ,rights:"
|
||||
+ tabResource.getRight() + "]");
|
||||
tabResource.setDate(sdf.format(tr.getCreationDate().getTime()));
|
||||
tabResource.setDate(tr.getCreationDate().getTime());
|
||||
tabResource.setValid(tr.isValid());
|
||||
tabResource.setFinalized(tr.isFinalized());
|
||||
tabResource.setLocked(tr.isLocked());
|
||||
|
@ -2827,30 +2824,28 @@ public class TDGWTServiceImpl extends RemoteServiceServlet implements
|
|||
}
|
||||
meta.add(new RightsMetadata(tabResource.getRight()));
|
||||
|
||||
if (tabResource.getValidFrom() != null
|
||||
&& !tabResource.getValidFrom().isEmpty()) {
|
||||
if (tabResource.getValidFrom() != null) {
|
||||
try {
|
||||
Date dateF = sdfDate.parse(tabResource.getValidFrom());
|
||||
Date dateF = tabResource.getValidFrom();
|
||||
GregorianCalendar validFromC = new GregorianCalendar();
|
||||
validFromC.setTime(dateF);
|
||||
ValidSinceMetadata validSince = new ValidSinceMetadata();
|
||||
validSince.setValue(validFromC);
|
||||
meta.add(validSince);
|
||||
} catch (ParseException e) {
|
||||
} catch (Throwable e) {
|
||||
logger.info("ValidFromMetadata is not set, no valid calendar present");
|
||||
}
|
||||
}
|
||||
|
||||
if (tabResource.getValidUntilTo() != null
|
||||
&& !tabResource.getValidUntilTo().isEmpty()) {
|
||||
if (tabResource.getValidUntilTo() != null) {
|
||||
try {
|
||||
Date dateU = sdfDate.parse(tabResource.getValidUntilTo());
|
||||
Date dateU = tabResource.getValidUntilTo();
|
||||
GregorianCalendar validUntilToC = new GregorianCalendar();
|
||||
validUntilToC.setTime(dateU);
|
||||
ValidUntilMetadata validUntil = new ValidUntilMetadata(
|
||||
validUntilToC);
|
||||
meta.add(validUntil);
|
||||
} catch (ParseException e) {
|
||||
} catch (Throwable e) {
|
||||
logger.info("ValidUntilMetadata is not set, no valid calendar present");
|
||||
}
|
||||
}
|
||||
|
@ -2919,14 +2914,14 @@ public class TDGWTServiceImpl extends RemoteServiceServlet implements
|
|||
} else {
|
||||
t.setAgency("");
|
||||
}
|
||||
t.setDate(sdf.format(tr.getCreationDate().getTime()));
|
||||
t.setDate(tr.getCreationDate().getTime());
|
||||
|
||||
if (tr.contains(ValidSinceMetadata.class)) {
|
||||
ValidSinceMetadata validSinceMeta = tr
|
||||
.getMetadata(ValidSinceMetadata.class);
|
||||
if (validSinceMeta != null && validSinceMeta.getValue() != null) {
|
||||
Calendar validSinceC = validSinceMeta.getValue();
|
||||
t.setValidFrom(sdfDate.format(validSinceC.getTime()));
|
||||
t.setValidFrom(validSinceC.getTime());
|
||||
} else {
|
||||
|
||||
}
|
||||
|
@ -2939,7 +2934,7 @@ public class TDGWTServiceImpl extends RemoteServiceServlet implements
|
|||
.getMetadata(ValidUntilMetadata.class);
|
||||
if (validUntilMeta != null && validUntilMeta.getValue() != null) {
|
||||
Calendar validUntilC = validUntilMeta.getValue();
|
||||
t.setValidUntilTo(sdfDate.format(validUntilC.getTime()));
|
||||
t.setValidUntilTo(validUntilC.getTime());
|
||||
} else {
|
||||
|
||||
}
|
||||
|
@ -4383,16 +4378,14 @@ public class TDGWTServiceImpl extends RemoteServiceServlet implements
|
|||
TRValidSinceMetadata validSinceMetadata = new TRValidSinceMetadata();
|
||||
Calendar cal = ((ValidSinceMetadata) trMetadata)
|
||||
.getValue();
|
||||
validSinceMetadata.setValue(sdfDate
|
||||
.format(cal.getTime()));
|
||||
validSinceMetadata.setValue(cal.getTime());
|
||||
listTRMetadata.add(validSinceMetadata);
|
||||
} else {
|
||||
if (trMetadata instanceof ValidUntilMetadata) {
|
||||
TRValidUntilMetadata validUntilMetadata = new TRValidUntilMetadata();
|
||||
Calendar cal = ((ValidUntilMetadata) trMetadata)
|
||||
.getValue();
|
||||
validUntilMetadata.setValue(sdfDate
|
||||
.format(cal.getTime()));
|
||||
validUntilMetadata.setValue(cal.getTime());
|
||||
listTRMetadata.add(validUntilMetadata);
|
||||
} else {
|
||||
if (trMetadata instanceof LicenceMetadata) {
|
||||
|
@ -4489,16 +4482,14 @@ public class TDGWTServiceImpl extends RemoteServiceServlet implements
|
|||
TRValidSinceMetadata validSinceMetadata = new TRValidSinceMetadata();
|
||||
Calendar cal = ((ValidSinceMetadata) trMetadata)
|
||||
.getValue();
|
||||
validSinceMetadata.setValue(sdfDate
|
||||
.format(cal.getTime()));
|
||||
validSinceMetadata.setValue(cal.getTime());
|
||||
listTRMetadata.add(validSinceMetadata);
|
||||
} else {
|
||||
if (trMetadata instanceof ValidUntilMetadata) {
|
||||
TRValidUntilMetadata validUntilMetadata = new TRValidUntilMetadata();
|
||||
Calendar cal = ((ValidUntilMetadata) trMetadata)
|
||||
.getValue();
|
||||
validUntilMetadata.setValue(sdfDate
|
||||
.format(cal.getTime()));
|
||||
validUntilMetadata.setValue(cal.getTime());
|
||||
listTRMetadata.add(validUntilMetadata);
|
||||
} else {
|
||||
if (trMetadata instanceof LicenceMetadata) {
|
||||
|
@ -6173,30 +6164,28 @@ public class TDGWTServiceImpl extends RemoteServiceServlet implements
|
|||
meta.add(rights);
|
||||
}
|
||||
|
||||
if (tabResource.getValidFrom() != null
|
||||
&& !tabResource.getValidFrom().isEmpty()) {
|
||||
if (tabResource.getValidFrom() != null) {
|
||||
try {
|
||||
Date dateF = sdfDate.parse(tabResource.getValidFrom());
|
||||
Date dateF = tabResource.getValidFrom();
|
||||
GregorianCalendar validFromC = new GregorianCalendar();
|
||||
validFromC.setTime(dateF);
|
||||
ValidSinceMetadata validSince = new ValidSinceMetadata();
|
||||
validSince.setValue(validFromC);
|
||||
meta.add(validSince);
|
||||
} catch (ParseException e) {
|
||||
} catch (Throwable e) {
|
||||
logger.info("ValidFromMetadata is not set, no valid calendar present");
|
||||
}
|
||||
}
|
||||
|
||||
if (tabResource.getValidUntilTo() != null
|
||||
&& !tabResource.getValidUntilTo().isEmpty()) {
|
||||
if (tabResource.getValidUntilTo() != null) {
|
||||
try {
|
||||
Date dateU = sdfDate.parse(tabResource.getValidUntilTo());
|
||||
Date dateU = tabResource.getValidUntilTo();
|
||||
GregorianCalendar validUntilToC = new GregorianCalendar();
|
||||
validUntilToC.setTime(dateU);
|
||||
ValidUntilMetadata validUntil = new ValidUntilMetadata(
|
||||
validUntilToC);
|
||||
meta.add(validUntil);
|
||||
} catch (ParseException e) {
|
||||
} catch (Throwable e) {
|
||||
logger.info("ValidUntilMetadata is not set, no valid calendar present");
|
||||
}
|
||||
}
|
||||
|
@ -6379,9 +6368,9 @@ public class TDGWTServiceImpl extends RemoteServiceServlet implements
|
|||
templateData.setOwner(owner);
|
||||
templateData.setContacts(retrieveTemplateShareInfo(desc));
|
||||
if(desc.getCreationdDate()!=null){
|
||||
templateData.setCreationDate(sdf.format(desc.getCreationdDate().getTime()));
|
||||
templateData.setCreationDate(desc.getCreationdDate().getTime());
|
||||
} else {
|
||||
templateData.setCreationDate("");
|
||||
templateData.setCreationDate(null);
|
||||
}
|
||||
templateDataList.add(templateData);
|
||||
}
|
||||
|
|
|
@ -2,6 +2,7 @@ package org.gcube.portlets.user.td.gwtservice.shared.rule.description;
|
|||
|
||||
import java.io.Serializable;
|
||||
import java.util.ArrayList;
|
||||
import java.util.Date;
|
||||
|
||||
import org.gcube.portlets.user.td.gwtservice.shared.rule.RuleScopeType;
|
||||
import org.gcube.portlets.user.td.gwtservice.shared.rule.type.TDRuleType;
|
||||
|
@ -20,7 +21,7 @@ public class RuleDescriptionData implements Serializable {
|
|||
private long id;
|
||||
private String name;
|
||||
private String description;
|
||||
private String creationDate;
|
||||
private Date creationDate;
|
||||
private Contacts owner;
|
||||
private ArrayList<Contacts> contacts;
|
||||
private RuleScopeType scope;
|
||||
|
@ -32,7 +33,7 @@ public class RuleDescriptionData implements Serializable {
|
|||
}
|
||||
|
||||
public RuleDescriptionData(long id, String name, String description,
|
||||
String creationDate, Contacts owner, ArrayList<Contacts> contacts,
|
||||
Date creationDate, Contacts owner, ArrayList<Contacts> contacts,
|
||||
RuleScopeType scope, C_Expression expression, TDRuleType tdRuleType) {
|
||||
super();
|
||||
this.id = id;
|
||||
|
@ -70,11 +71,11 @@ public class RuleDescriptionData implements Serializable {
|
|||
this.description = description;
|
||||
}
|
||||
|
||||
public String getCreationDate() {
|
||||
public Date getCreationDate() {
|
||||
return creationDate;
|
||||
}
|
||||
|
||||
public void setCreationDate(String creationDate) {
|
||||
public void setCreationDate(Date creationDate) {
|
||||
this.creationDate = creationDate;
|
||||
}
|
||||
|
||||
|
|
|
@ -2,6 +2,7 @@ package org.gcube.portlets.user.td.gwtservice.shared.template;
|
|||
|
||||
import java.io.Serializable;
|
||||
import java.util.ArrayList;
|
||||
import java.util.Date;
|
||||
|
||||
import org.gcube.portlets.user.td.gwtservice.shared.share.Contacts;
|
||||
|
||||
|
@ -23,7 +24,7 @@ public class TemplateData implements Serializable {
|
|||
private String category;
|
||||
private Contacts owner;
|
||||
private ArrayList<Contacts> contacts;
|
||||
private String creationDate;
|
||||
private Date creationDate;
|
||||
|
||||
public TemplateData() {
|
||||
super();
|
||||
|
@ -41,7 +42,7 @@ public class TemplateData implements Serializable {
|
|||
*/
|
||||
public TemplateData(long id, String name, String description,
|
||||
String agency, String category, Contacts owner,
|
||||
ArrayList<Contacts> contacts, String creationDate) {
|
||||
ArrayList<Contacts> contacts, Date creationDate) {
|
||||
super();
|
||||
this.id = id;
|
||||
this.name = name;
|
||||
|
@ -65,7 +66,7 @@ public class TemplateData implements Serializable {
|
|||
return name;
|
||||
}
|
||||
|
||||
public void setName(String name) {
|
||||
public void setName(String name) {
|
||||
this.name = name;
|
||||
}
|
||||
|
||||
|
@ -117,11 +118,11 @@ public class TemplateData implements Serializable {
|
|||
this.contacts = contacts;
|
||||
}
|
||||
|
||||
public String getCreationDate() {
|
||||
public Date getCreationDate() {
|
||||
return creationDate;
|
||||
}
|
||||
|
||||
public void setCreationDate(String creationDate) {
|
||||
public void setCreationDate(Date creationDate) {
|
||||
this.creationDate = creationDate;
|
||||
}
|
||||
|
||||
|
|
|
@ -2,6 +2,7 @@ package org.gcube.portlets.user.td.gwtservice.shared.tr;
|
|||
|
||||
import java.io.Serializable;
|
||||
import java.util.ArrayList;
|
||||
import java.util.Date;
|
||||
|
||||
import org.gcube.portlets.user.td.gwtservice.shared.share.Contacts;
|
||||
import org.gcube.portlets.user.td.widgetcommonevent.shared.TRId;
|
||||
|
@ -21,10 +22,10 @@ public class TabResource implements Serializable {
|
|||
private String name;
|
||||
private String description;
|
||||
private String agency;
|
||||
private String date;
|
||||
private Date date;
|
||||
private String right;
|
||||
private String validFrom;
|
||||
private String validUntilTo;
|
||||
private Date validFrom;
|
||||
private Date validUntilTo;
|
||||
private String licence;
|
||||
private Contacts owner;
|
||||
private ArrayList<Contacts> contacts;
|
||||
|
@ -36,7 +37,7 @@ public class TabResource implements Serializable {
|
|||
}
|
||||
|
||||
public TabResource(String id, String name, String description,
|
||||
String agency, String date, String right, String validFrom, String validUntilTo,
|
||||
String agency, Date date, String right, Date validFrom, Date validUntilTo,
|
||||
String licence, TRId trId) {
|
||||
this.id = id;
|
||||
this.name = name;
|
||||
|
@ -74,11 +75,11 @@ public class TabResource implements Serializable {
|
|||
this.agency = agency;
|
||||
}
|
||||
|
||||
public String getDate() {
|
||||
public Date getDate() {
|
||||
return date;
|
||||
}
|
||||
|
||||
public void setDate(String date) {
|
||||
public void setDate(Date date) {
|
||||
this.date = date;
|
||||
}
|
||||
|
||||
|
@ -154,19 +155,19 @@ public class TabResource implements Serializable {
|
|||
this.finalized = finalized;
|
||||
}
|
||||
|
||||
public String getValidFrom() {
|
||||
public Date getValidFrom() {
|
||||
return validFrom;
|
||||
}
|
||||
|
||||
public void setValidFrom(String validFrom) {
|
||||
public void setValidFrom(Date validFrom) {
|
||||
this.validFrom = validFrom;
|
||||
}
|
||||
|
||||
public String getValidUntilTo() {
|
||||
public Date getValidUntilTo() {
|
||||
return validUntilTo;
|
||||
}
|
||||
|
||||
public void setValidUntilTo(String validUntilTo) {
|
||||
public void setValidUntilTo(Date validUntilTo) {
|
||||
this.validUntilTo = validUntilTo;
|
||||
}
|
||||
|
||||
|
|
|
@ -1,5 +1,7 @@
|
|||
package org.gcube.portlets.user.td.gwtservice.shared.tr.metadata;
|
||||
|
||||
import java.util.Date;
|
||||
|
||||
|
||||
|
||||
/**
|
||||
|
@ -11,16 +13,16 @@ package org.gcube.portlets.user.td.gwtservice.shared.tr.metadata;
|
|||
public class TRValidSinceMetadata implements TRMetadata {
|
||||
|
||||
private static final long serialVersionUID = 5425320654892310426L;
|
||||
String id="ValidSinceMetadata";
|
||||
String title="Valid Since";
|
||||
private String id="ValidSinceMetadata";
|
||||
private String title="Valid Since";
|
||||
|
||||
private String value;
|
||||
private Date value;
|
||||
|
||||
public String getValue() {
|
||||
public Date getValue() {
|
||||
return value;
|
||||
}
|
||||
|
||||
public void setValue(String value) {
|
||||
public void setValue(Date value) {
|
||||
this.value = value;
|
||||
}
|
||||
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
package org.gcube.portlets.user.td.gwtservice.shared.tr.metadata;
|
||||
|
||||
|
||||
import java.util.Date;
|
||||
|
||||
/**
|
||||
*
|
||||
|
@ -9,18 +9,18 @@ package org.gcube.portlets.user.td.gwtservice.shared.tr.metadata;
|
|||
*
|
||||
*/
|
||||
public class TRValidUntilMetadata implements TRMetadata {
|
||||
|
||||
private static final long serialVersionUID = 4127072595380574045L;
|
||||
String id="ValidUntilMetadata";
|
||||
String title="Valid Until";
|
||||
|
||||
private String value;
|
||||
|
||||
public String getValue() {
|
||||
private static final long serialVersionUID = 4127072595380574045L;
|
||||
private String id = "ValidUntilMetadata";
|
||||
private String title = "Valid Until";
|
||||
|
||||
private Date value;
|
||||
|
||||
public Date getValue() {
|
||||
return value;
|
||||
}
|
||||
|
||||
public void setValue(String value) {
|
||||
public void setValue(Date value) {
|
||||
this.value = value;
|
||||
}
|
||||
|
||||
|
@ -29,7 +29,6 @@ public class TRValidUntilMetadata implements TRMetadata {
|
|||
return "TRValidUntilMetadata [value=" + value + "]";
|
||||
}
|
||||
|
||||
|
||||
public String getId() {
|
||||
return id;
|
||||
}
|
||||
|
@ -37,6 +36,5 @@ public class TRValidUntilMetadata implements TRMetadata {
|
|||
public String getTitle() {
|
||||
return title;
|
||||
}
|
||||
|
||||
|
||||
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue