8 package cz.vutbr.fit.knot.annotations.entity.attribute;
12 import java.util.Date;
13 import java.util.TimeZone;
14 import javax.persistence.DiscriminatorValue;
15 import javax.persistence.Entity;
29 @DiscriminatorValue(
"DateTime")
49 this.dateValue = (Date) value;
59 if (dateValue == null) {
62 if(this.stringValue != null){
63 String originalOffset = TimeZone.getDefault().getID();
64 TimeZone.setDefault(TimeZone.getTimeZone(
"GMT" + this.stringValue));
65 String ret = Util.toRFC3339Date(dateValue);
66 TimeZone.setDefault(TimeZone.getTimeZone(originalOffset));
70 return Util.toRFC3339Date(dateValue);
80 public void setRawValue(String value)
throws IllegalArgumentException {
85 String zone = Util.parseTimeZoneID(value);
86 String originalOffset = TimeZone.getDefault().getID();
88 TimeZone.setDefault(TimeZone.getTimeZone(
"GMT" + zone));
89 this.stringValue = zone;
92 this.dateValue = Util.parseRFC3339Date(value);
93 }
catch (Exception e) {
94 throw new IllegalArgumentException(
"Value " + value +
" is not a valid RFC3339 date time");
97 TimeZone.setDefault(TimeZone.getTimeZone(originalOffset));
static final String DATE_TIME_URI
Class representing attribute of type DateTime.
void setRawValue(String value)
Base class representing attribute of annotation.
void setValue(Object value)
Utility class (manipulates RFC 3339 dates)
String getTypeOntologyUri()