8 package cz.vutbr.fit.knot.annotations.entity.attribute;
 
   12 import java.text.SimpleDateFormat;
 
   13 import java.util.TimeZone;
 
   14 import javax.persistence.DiscriminatorValue;
 
   15 import javax.persistence.Entity;
 
   16 import javax.persistence.NamedQueries;
 
   17 import javax.persistence.NamedQuery;
 
   31 @DiscriminatorValue(
"Date")
 
   33     @NamedQuery(name = 
"Attribute.findByDateValue", query = 
"SELECT a FROM Attribute a WHERE a.dateValue = :dateValue"),
 
   43   public void setRawValue(String value) 
throws IllegalArgumentException {
 
   48     String zone = Util.parseTimeZoneID(value);
 
   49     String originalOffset = TimeZone.getDefault().getID();
 
   51       TimeZone.setDefault(TimeZone.getTimeZone(
"GMT" + zone));
 
   52       this.stringValue = zone;
 
   53       this.boolVAlue = 
false;
 
   55       this.boolVAlue = 
true;  
 
   58       this.dateValue = Util.parseDate(value);
 
   59     } 
catch (Exception e) {
 
   61         this.dateValue = Util.parseRFC3339Date(value);
 
   62       } 
catch (Exception ex) {
 
   64           SimpleDateFormat sdf = 
new SimpleDateFormat(
"yyyy-MM-dd");
 
   65           this.dateValue = sdf.parse(value);
 
   66         } 
catch (Exception exx) {
 
   67           throw new IllegalArgumentException(
"Value " + value + 
" is not a valid date");
 
   72       TimeZone.setDefault(TimeZone.getTimeZone(originalOffset));
 
   83     if(this.stringValue != null){
 
   84       String originalOffset = TimeZone.getDefault().getID();
 
   85       TimeZone.setDefault(TimeZone.getTimeZone(
"GMT" + this.stringValue));
 
   86       String ret = Util.toRFC3339DateOnly(dateValue);
 
   87       TimeZone.setDefault(TimeZone.getTimeZone(originalOffset));
 
   90     if (this.boolVAlue != null && this.boolVAlue == 
true) {
 
   91       return Util.toRFC3339DateOnlyWTZ(this.dateValue);
 
   93     return Util.toRFC3339DateOnly(this.dateValue);
 
Class representing attribute of type DateTime. 
String getTypeOntologyUri()
static final String DATE_URI
Class representing attribute of type Date. 
Utility class (manipulates RFC 3339 dates) 
void setRawValue(String value)