8 package cz.vutbr.fit.knot.annotations.entity.attribute;
 
   12 import java.text.DateFormat;
 
   13 import java.text.SimpleDateFormat;
 
   14 import java.util.TimeZone;
 
   15 import javax.persistence.DiscriminatorValue;
 
   16 import javax.persistence.Entity;
 
   30 @DiscriminatorValue(
"Time")
 
   39   public void setRawValue(String value) 
throws IllegalArgumentException {
 
   44     String zone = Util.parseTimeZoneID(value);
 
   45     String originalOffset = TimeZone.getDefault().getID();
 
   47       TimeZone.setDefault(TimeZone.getTimeZone(
"GMT" + zone));
 
   48       this.stringValue = zone;
 
   51       this.dateValue = Util.parseTime(value);
 
   52     } 
catch (Exception e) {
 
   54         this.dateValue = Util.parseRFC3339Date(value);
 
   55       } 
catch (Exception ex) {
 
   58           DateFormat sdf = 
new SimpleDateFormat(
"HH:mm:ss");
 
   59           this.dateValue = sdf.parse(value); 
 
   60         } 
catch (Exception exx) {
 
   61           throw new IllegalArgumentException(
"Value " + value + 
" is not a valid time");
 
   66       TimeZone.setDefault(TimeZone.getTimeZone(originalOffset));
 
   77     if(this.stringValue != null){
 
   78       String originalOffset = TimeZone.getDefault().getID();
 
   79       TimeZone.setDefault(TimeZone.getTimeZone(
"GMT" + this.stringValue));
 
   80       String ret = Util.toRFC3339Time(dateValue);
 
   81       TimeZone.setDefault(TimeZone.getTimeZone(originalOffset));
 
   84     return Util.toRFC3339Time(this.dateValue);
 
Class representing attribute of type DateTime. 
Class representing attribute of type Time. 
static final String TIME_URI
String getTypeOntologyUri()
Utility class (manipulates RFC 3339 dates) 
void setRawValue(String value)