rs.sol.soloist.server.builtindomains.builtindatatypes
Class DateTime

java.lang.Object
  extended by rs.sol.soloist.server.uml.commonimplementation.runtime._ClassifierInstance
      extended by rs.sol.soloist.server.uml.commonimplementation.runtime._DataTypeInstance
          extended by rs.sol.soloist.server.javaimpl.runtime.SOLoistDataTypeInstance
              extended by rs.sol.soloist.server.builtindomains.builtindatatypes.InstanceOfDataType
                  extended by rs.sol.soloist.server.builtindomains.builtindatatypes.InstanceOfPrimitiveType
                      extended by rs.sol.soloist.server.builtindomains.builtindatatypes.DateTime
All Implemented Interfaces:
rs.sol.soloist.server.uml.concepts.IElement, IClassifierInstance, IDataTypeInstance, IPrimitiveTypeInstance, IRTElement

public class DateTime
extends InstanceOfPrimitiveType

Absolute date and time.


Nested Class Summary
static class DateTime.AsDateTime
          Encodes DateTime as SQL DATETIME (in UTC)
static class DateTime.AsDateTimeLocal
          Encodes DateTime as SQL DATETIME (in local timezone)
static class DateTime.AsLong
           
static class DateTime.AsString
          Encodes DateTime as yyyy-MM-dd HH:mm:ss.SSS in UTC
static class DateTime.AsStringLocal
          Encodes DateTime as yyyy-MM-dd HH:mm:ss.SSS in local timezone
static class DateTime.DefaultSerializationHandler
           
 
Field Summary
static IPrimitiveType CLASSIFIER
           
static java.lang.String FQ_TYPE_NAME
           
static java.lang.String MILLISECOND_RESOLUTION_PATTERN
           
static java.lang.String SECOND_RESOLUTION_PATTERN
           
static java.util.TimeZone UTC
           
 
Constructor Summary
DateTime()
          Now.
DateTime(long timestamp)
           
 
Method Summary
 DateTime addCalendarField(int calendarField, int amount)
           
 boolean after(DateTime other)
           
 boolean before(DateTime other)
           
 boolean equals(java.lang.Object obj)
           
static DateTime fromCalendar(java.util.Calendar calendar)
           
static DateTime fromDate(java.util.Date date)
           
static DateTime fromDateAndTime(Date date, Time time)
          Date and time interpreted in given time zone
static DateTime fromDateAndTime(Date date, Time time, java.util.TimeZone zone)
          Date and time interpreted in given time zone
static DateTime fromSerializable(java.io.Serializable ser)
          TODO: use SerializationHandler
static DateTime fromString(java.lang.String string)
           
static DateTime fromString(java.lang.String string, java.util.TimeZone zone)
           
 Date getDate()
           
 Date getDate(java.util.TimeZone zone)
           
 Time getTime()
           
 Time getTime(java.util.TimeZone zone)
           
 long getTimestamp()
           
 java.util.Date getValue()
           
 int hashCode()
           
 boolean isEqualTo(IClassifierInstance ci)
          Is this Classifier Instance equal to the given Classifier Instance?
Semantic rules:
1.
 IClassifierInstance makeClone()
          Clones this Classifier Instance.
 TimeInterval minus(DateTime other)
           
 DateTime minus(TimeInterval interval)
           
 DateTime minusDays(int days)
           
 DateTime minusHours(int hours)
           
 DateTime minusMilliseconds(int milliseconds)
           
 DateTime minusMinutes(int minutes)
           
 DateTime minusMonths(int months)
           
 DateTime minusSeconds(int seconds)
           
 DateTime minusYears(int years)
           
 DateTime plus(TimeInterval interval)
           
 DateTime plusDays(int days)
           
 DateTime plusHours(int hours)
           
 DateTime plusMilliseconds(int milliseconds)
           
 DateTime plusMinutes(int minutes)
           
 DateTime plusMonths(int months)
           
 DateTime plusSeconds(int seconds)
           
 DateTime plusYears(int years)
           
 void setFieldsOnCalendar(java.util.Calendar cal)
           
 java.util.Calendar toCalendar()
           
 java.util.Calendar toCalendar(java.util.Locale locale)
           
 java.util.Calendar toCalendar(java.util.TimeZone zone)
           
 java.util.Calendar toCalendar(java.util.TimeZone zone, java.util.Locale locale)
           
 java.util.Date toDate()
           
 java.lang.String toString()
           
 java.lang.String toString(java.util.TimeZone zone)
           
 java.lang.String toStringMilliseconds()
           
 java.lang.String toStringMilliseconds(java.util.TimeZone zone)
           
 java.lang.String toStringSeconds()
           
 java.lang.String toStringSeconds(java.util.TimeZone zone)
           
 java.sql.Timestamp toTimestamp()
           
 
Methods inherited from class rs.sol.soloist.server.builtindomains.builtindatatypes.InstanceOfPrimitiveType
accept, accept, getSQLString, toSerializable
 
Methods inherited from class rs.sol.soloist.server.javaimpl.runtime.SOLoistDataTypeInstance
addAttributeValue, getAttributeValue, getDataType, getMyID, getSlot, getSlots, setDataType, setMyID
 
Methods inherited from class rs.sol.soloist.server.uml.commonimplementation.runtime._DataTypeInstance
getClassifier, hasIdentity, isClassInstance, isDataTypeInstance, isMarkedAsDeleted, markAsDeleted
 
Methods inherited from class rs.sol.soloist.server.uml.commonimplementation.runtime._ClassifierInstance
conformsTo, constructor, copySlots, copySlots, destroy, destructor, getAttributeValue, getAttributeValue, getAttributeValue, getAttributeValues, getClassifierFQName, getClassifierUQName, getFirstCommonGeneralizer, getFirstCommonGeneralizerFQName, getFirstCommonGeneralizerUQName, getMElement, getSlot, getSlot, getSlot, isDirectInstanceOf, isDirectInstanceOf, isInstanceOf, isInstanceOf, isKindOf, isModelElement, isRTElement
 
Methods inherited from class java.lang.Object
getClass, notify, notifyAll, wait, wait, wait
 
Methods inherited from interface rs.sol.soloist.server.uml.concepts.runtime.IDataTypeInstance
getDataType
 
Methods inherited from interface rs.sol.soloist.server.uml.concepts.runtime.IClassifierInstance
conformsTo, constructor, copySlots, copySlots, destroy, destructor, getAttributeValue, getAttributeValue, getAttributeValue, getAttributeValues, getClassifier, getClassifierFQName, getClassifierUQName, getFirstCommonGeneralizer, getFirstCommonGeneralizerFQName, getFirstCommonGeneralizerUQName, getMyID, getSlot, getSlot, getSlot, getSlot, getSlots, isClassInstance, isDataTypeInstance, isDirectInstanceOf, isDirectInstanceOf, isInstanceOf, isInstanceOf, isMarkedAsDeleted, markAsDeleted
 
Methods inherited from interface rs.sol.soloist.server.uml.concepts.runtime.IRTElement
getMElement, hasIdentity
 
Methods inherited from interface rs.sol.soloist.server.uml.concepts.IElement
isKindOf, isModelElement, isRTElement
 

Field Detail

FQ_TYPE_NAME

public static final java.lang.String FQ_TYPE_NAME
See Also:
Constant Field Values

CLASSIFIER

public static final IPrimitiveType CLASSIFIER

SECOND_RESOLUTION_PATTERN

public static final java.lang.String SECOND_RESOLUTION_PATTERN
See Also:
Constant Field Values

MILLISECOND_RESOLUTION_PATTERN

public static final java.lang.String MILLISECOND_RESOLUTION_PATTERN
See Also:
Constant Field Values

UTC

public static final java.util.TimeZone UTC
Constructor Detail

DateTime

public DateTime()
Now.


DateTime

public DateTime(long timestamp)
Method Detail

isEqualTo

public boolean isEqualTo(IClassifierInstance ci)
                  throws rs.sol.soloist.server.uml.exceptions.RequestFailedException
Description copied from interface: IClassifierInstance
Is this Classifier Instance equal to the given Classifier Instance?
Semantic rules:
1. If this and ci are instances of different kinds of Classifiers (one is an instance of a Class, and the other is an instance of a Data Type) they are different (not equal).
2. If this and ci refer to two different instances of Classes, they are different (not equal).
3. If this and ci refer to two instances of Data Types, their equality is checked on value basis (if all of their Slots are equal).

Specified by:
isEqualTo in interface IClassifierInstance
Overrides:
isEqualTo in class rs.sol.soloist.server.javaimpl.runtime.SOLoistDataTypeInstance
Throws:
rs.sol.soloist.server.uml.exceptions.RequestFailedException

equals

public boolean equals(java.lang.Object obj)
Overrides:
equals in class java.lang.Object

hashCode

public int hashCode()
Overrides:
hashCode in class java.lang.Object

fromCalendar

public static DateTime fromCalendar(java.util.Calendar calendar)

fromDate

public static DateTime fromDate(java.util.Date date)

toCalendar

public java.util.Calendar toCalendar()

toCalendar

public java.util.Calendar toCalendar(java.util.TimeZone zone)

toCalendar

public java.util.Calendar toCalendar(java.util.Locale locale)

toCalendar

public java.util.Calendar toCalendar(java.util.TimeZone zone,
                                     java.util.Locale locale)

setFieldsOnCalendar

public void setFieldsOnCalendar(java.util.Calendar cal)

addCalendarField

public DateTime addCalendarField(int calendarField,
                                 int amount)

toDate

public java.util.Date toDate()

toTimestamp

public java.sql.Timestamp toTimestamp()

makeClone

public IClassifierInstance makeClone()
                              throws rs.sol.soloist.server.uml.exceptions.ActionExecutionFailedException
Description copied from interface: IClassifierInstance
Clones this Classifier Instance.

Throws:
rs.sol.soloist.server.uml.exceptions.ActionExecutionFailedException

getTimestamp

public long getTimestamp()

toString

public java.lang.String toString()
Specified by:
toString in interface IDataTypeInstance
Overrides:
toString in class rs.sol.soloist.server.uml.commonimplementation.runtime._ClassifierInstance
Returns:
yyyy-MM-dd HH:mm:ss.SSS (in local timezone)

toString

public java.lang.String toString(java.util.TimeZone zone)

toStringMilliseconds

public java.lang.String toStringMilliseconds()
Returns:
yyyy-MM-dd HH:mm:ss.SSS (in local timezone)

toStringMilliseconds

public java.lang.String toStringMilliseconds(java.util.TimeZone zone)

toStringSeconds

public java.lang.String toStringSeconds()
Returns:
yyyy-MM-dd HH:mm:ss (in local timezone)

toStringSeconds

public java.lang.String toStringSeconds(java.util.TimeZone zone)

fromString

public static DateTime fromString(java.lang.String string)
Parameters:
string - - yyyy-MM-dd HH:mm:ss.SSS (in local timezone)

fromString

public static DateTime fromString(java.lang.String string,
                                  java.util.TimeZone zone)
Parameters:
string - - yyyy-MM-dd HH:mm:ss.SSS or yyyy-MM-dd HH:mm:ss (in given timezone)

getDate

public Date getDate()
Returns:
Date in local time zone corresponding to this timestamp

getDate

public Date getDate(java.util.TimeZone zone)
Returns:
Date in given time zone corresponding to this timestamp

getTime

public Time getTime()

getTime

public Time getTime(java.util.TimeZone zone)

fromDateAndTime

public static DateTime fromDateAndTime(Date date,
                                       Time time)
Date and time interpreted in given time zone


fromDateAndTime

public static DateTime fromDateAndTime(Date date,
                                       Time time,
                                       java.util.TimeZone zone)
Date and time interpreted in given time zone


plus

public DateTime plus(TimeInterval interval)

minus

public DateTime minus(TimeInterval interval)

minus

public TimeInterval minus(DateTime other)

plusYears

public DateTime plusYears(int years)

minusYears

public DateTime minusYears(int years)

plusMonths

public DateTime plusMonths(int months)

minusMonths

public DateTime minusMonths(int months)

plusDays

public DateTime plusDays(int days)

minusDays

public DateTime minusDays(int days)

plusHours

public DateTime plusHours(int hours)

minusHours

public DateTime minusHours(int hours)

plusMinutes

public DateTime plusMinutes(int minutes)

minusMinutes

public DateTime minusMinutes(int minutes)

plusSeconds

public DateTime plusSeconds(int seconds)

minusSeconds

public DateTime minusSeconds(int seconds)

plusMilliseconds

public DateTime plusMilliseconds(int milliseconds)

minusMilliseconds

public DateTime minusMilliseconds(int milliseconds)

getValue

public java.util.Date getValue()
Specified by:
getValue in interface IPrimitiveTypeInstance
Overrides:
getValue in class InstanceOfPrimitiveType

fromSerializable

public static DateTime fromSerializable(java.io.Serializable ser)
TODO: use SerializationHandler


before

public boolean before(DateTime other)

after

public boolean after(DateTime other)