Oracle Fusion Middleware Java API Reference for Oracle ADF Model
11g Release 1 (11.1.1.4.0)

E10653-05

oracle.jbo.domain
Class Timestamp

java.lang.Object
  extended by oracle.sql.Datum
      extended by oracle.sql.TIMESTAMP
          extended by oracle.jbo.domain.Timestamp
All Implemented Interfaces:
java.io.Serializable, java.lang.Comparable, DomainInterface, KeyAttributeInterface, NativeTypeDomainInterface, XMLDomainInterface, XMLDomainWriter, oracle.jdbc.internal.ObjectData, ORAData
Direct Known Subclasses:
TimestampTZ

public class Timestamp
extends TIMESTAMP
implements NativeTypeDomainInterface, XMLDomainWriter, KeyAttributeInterface, ORAData, java.lang.Comparable, java.io.Serializable

This class extends oracle.sql.TIMESTAMP, Oracle's Java representation of the TIMESTAMP database type. This class allows an instance of the oracle.sql.TIMESTAMP to be used as an immutable domain object.

The intent of many of the methods in this class is to wrap the corresponding method in the oracle.sql class such that it returns an instance of an oracle.jbo.domain.* object.

The oracle.jbo.domain.Timestamp class is the Java representation of the underlying database type that you must use if you want to exploit the domain feature of Business Components for Java.

Timestamp objects consist of data (a byte array) and a Domain type code. Domain dates extend SQL dates by being convertable to and from JDBC values.

Timestamp/Time Formats Accepted

The oracle.jbo.domain.Timestamp class accepts dates and times in the same format accepted by java.sql.TimeStamp (either a long milliseconds time value or the year, month, day, hour, minute, second, nano format) and java.sql.Timestamp (either a milliseconds time value or the year, month, day format).

Since:
JDeveloper 3.0
See Also:
Serialized Form
javabean.class
name=Timestamp

Field Summary
 
Fields inherited from class oracle.sql.TIMESTAMP
BUILD_DATE, SIZE_DATE, SIZE_TIMESTAMP, SIZE_TIMESTAMP_NOFRAC, TRACE
 
Constructor Summary
Timestamp()
          Creates a default Timestamp Domain object.
Timestamp(byte[] value)
          Internal: Applications should not invoke this method.
Timestamp(Date value)
           
Timestamp(java.sql.Date value)
          Creates a Timestamp Domain object from a JDBC java.sql.Date object.
Timestamp(java.util.Date value)
          Creates a Timestamp Domain object from a JDBC java.util.Date object.
Timestamp(java.sql.Date value, boolean bConvertToUserTZ)
          Creates a Timestamp Domain object from a JDBC java.sql.Date object.
Timestamp(java.util.Date value, boolean bConvertToUserTZ)
          Creates a Timestamp Domain object from a JDBC java.util.Date object.
Timestamp(java.sql.Date value, java.util.Calendar cal)
          Creates a Timestamp Domain object from a JDBC java.sql.Date object.
Timestamp(java.util.Date value, java.util.Calendar cal)
          Creates a Timestamp Domain object from a JDBC java.util.Date object.
Timestamp(long value)
          Creates a Timestamp Domain object from a long Timestamp value.
Timestamp(java.lang.String value)
          Creates a Timestamp Domain object from a Java String.
Timestamp(java.lang.String value, boolean bConvertToUserTZ)
          Creates a Timestamp Domain object from a Java String.
Timestamp(java.lang.String value, java.util.Calendar cal)
          Creates a Timestamp Domain object from a Java String.
Timestamp(Timestamp value)
          Creates a Timestamp identical to an existing Timestamp.
Timestamp(java.sql.Timestamp value)
          Creates a Timestamp Domain object from a JDBC Timestamp.
Timestamp(TIMESTAMP value)
          Creates a Timestamp Domain object from an Oracle SQL TIMESTAMP.
Timestamp(java.sql.Timestamp value, boolean bConvertToUserTZ)
          Creates a Timestamp Domain object from a JDBC Timestamp.
Timestamp(java.sql.Timestamp value, java.util.Calendar cal)
          Creates a Timestamp Domain object from a JDBC Timestamp.
 
Method Summary
 int compareTo(java.lang.Object n)
           
 java.sql.Date dateValue()
          Convert to a Date representation of the Timestamp object
 boolean equals(java.lang.Object other)
          Tests this for equality with another object.
 java.lang.Object getData()
          Internal: Applications should not invoke this method.
 java.lang.Object getNativeObject()
           
static ORADataFactory getORADataFactory()
          Internal: Applications should not invoke this method.
 Node getSerializedDomainXML(Document xmlDoc)
          Creates the xml node in the given xml document for this domain's data in hex format of the byte[] representation of the data.
 long getTime()
          Returns the time as a long value using timestampValue().getTime().
 java.sql.Timestamp getValue()
          Return a java.sql.Timestamp object with this domain's value.
 Node getXMLContentNode(Document xmlDoc)
          Creates the xml node in the given xml document for this domain's data.
static XMLDomainReaderFactory getXMLDomainFactory(java.lang.Class attrClass)
          Internal: Applications should not use this method.
 int hashCode()
          Computes a hash code for this.
 java.lang.String printXMLDefinition(java.util.Hashtable allDefs, java.io.PrintWriter pw, boolean bContainees)
          Prints the DTD info for this domain in the given print writer.
 void setContext(DomainOwnerInterface owner, Transaction trans, java.lang.Object ctx)
          Internal: Applications should not invoke this method.
 Datum toDatum(java.sql.Connection conn)
          Internal: Applications should not invoke this method.
 java.lang.String toString()
          For testing purposes only: converts this to a textual representation.
static Timestamp toTimestamp(java.lang.String value)
          Converts an Oracle Timestamp expressed as a string to a Java Timestamp.
 
Methods inherited from class oracle.sql.TIMESTAMP
getNanos, isConvertibleTo, makeJdbcArray, stringValue, timestampValue, timestampValue, timeValue, TimeZoneConvert, toBytes, toBytes, toBytes, toBytes, toBytes, toBytes, toBytes, toDate, toDATE, toJdbc, toString, toTime, toTimestamp, toTimestamp
 
Methods inherited from class oracle.sql.Datum
asciiStreamValue, bigDecimalValue, binaryStreamValue, booleanValue, byteValue, characterStreamValue, compareBytes, doubleValue, floatValue, getBytes, getLength, getStream, intValue, longValue, setBytes, setShareBytes, shareBytes, stringValue, timeValue
 
Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, wait, wait, wait
 
Methods inherited from interface oracle.jbo.domain.KeyAttributeInterface
getBytes, setBytes
 

Constructor Detail

Timestamp

public Timestamp()
Creates a default Timestamp Domain object.

This constructor does not create a null date: use one of the NullValue() constructors.


Timestamp

public Timestamp(byte[] value)
Internal: Applications should not invoke this method.

Creates a Timestamp Domain object from the given byte array.

Parameters:
value - a value returned by a previous call to getBytes() on an SQL object compatable with Timestamp.

Timestamp

public Timestamp(Date value)

Timestamp

public Timestamp(TIMESTAMP value)
Creates a Timestamp Domain object from an Oracle SQL TIMESTAMP.

Parameters:
value - a TIMESTAMP SQL object.

Timestamp

public Timestamp(Timestamp value)
Creates a Timestamp identical to an existing Timestamp.

Parameters:
value - a Timestamp Domain object.

Timestamp

public Timestamp(java.sql.Timestamp value)
Creates a Timestamp Domain object from a JDBC Timestamp.

Parameters:
value - a TIMESTAMP SQL object.

Timestamp

public Timestamp(long value)
Creates a Timestamp Domain object from a long Timestamp value. Uses java.sql.Timestamp(long) to create this domain instance. This value should usually be the value returned from System.currentTimeMillis() or from Timestamp.getTime() method


Timestamp

public Timestamp(java.sql.Date value)
Creates a Timestamp Domain object from a JDBC java.sql.Date object.

Parameters:
value - a Date SQL object.

Timestamp

public Timestamp(java.util.Date value)
Creates a Timestamp Domain object from a JDBC java.util.Date object.

Parameters:
value - a java.util.Date object.

Timestamp

public Timestamp(java.lang.String value)
Creates a Timestamp Domain object from a Java String.

Parameters:
value - a textual representation of a Timestamp.

Timestamp

public Timestamp(java.sql.Timestamp value,
                 boolean bConvertToUserTZ)
Creates a Timestamp Domain object from a JDBC Timestamp.

Parameters:
value - a TIMESTAMP SQL object.
bConvertToUserTZ - if this flag is true then the timestamp is converted to the user time zone. User Time zone is obtained from the ADF Context. It is typically configured in the application settings.

Timestamp

public Timestamp(java.sql.Timestamp value,
                 java.util.Calendar cal)
Creates a Timestamp Domain object from a JDBC Timestamp.

Parameters:
value - a TIMESTAMP SQL object.
cal - converts the value to the timezone in the cal argument.

Timestamp

public Timestamp(java.sql.Date value,
                 boolean bConvertToUserTZ)
Creates a Timestamp Domain object from a JDBC java.sql.Date object.

Parameters:
value - a Date SQL object.
bConvertToUserTZ - if this flag is true then the timestamp is converted to the user time zone. User Time zone is obtained from the ADF Context. It is typically configured in the application settings.

Timestamp

public Timestamp(java.sql.Date value,
                 java.util.Calendar cal)
Creates a Timestamp Domain object from a JDBC java.sql.Date object.

Parameters:
value - a Date SQL object.
cal - converts the value to the timezone in the cal argument.

Timestamp

public Timestamp(java.util.Date value,
                 boolean bConvertToUserTZ)
Creates a Timestamp Domain object from a JDBC java.util.Date object.

Parameters:
value - a java.util.Date object.
bConvertToUserTZ - if this flag is true then the timestamp is converted to the user time zone. User Time zone is obtained from the ADF Context. It is typically configured in the application settings.

Timestamp

public Timestamp(java.util.Date value,
                 java.util.Calendar cal)
Creates a Timestamp Domain object from a JDBC java.util.Date object.

Parameters:
value - a java.util.Date object.
cal - converts the value to the timezone in the cal argument.

Timestamp

public Timestamp(java.lang.String value,
                 boolean bConvertToUserTZ)
Creates a Timestamp Domain object from a Java String.

Parameters:
value - a textual representation of a Timestamp.
bConvertToUserTZ - if this flag is true then the timestamp is converted to the user time zone. User Time zone is obtained from the ADF Context. It is typically configured in the application settings.

Timestamp

public Timestamp(java.lang.String value,
                 java.util.Calendar cal)
Creates a Timestamp Domain object from a Java String.

Parameters:
value - a textual representation of a Timestamp.
cal - converts the value to the timezone in the cal argument.
Method Detail

getORADataFactory

public static ORADataFactory getORADataFactory()
Internal: Applications should not invoke this method.

Initializes the Timestamp Domain.

This method is invoked when JBO is initialized. Applications should not call this method directly.

Returns:
the ORADataFactory for the Timestamp Domain.

toDatum

public Datum toDatum(java.sql.Connection conn)
              throws java.sql.SQLException
Internal: Applications should not invoke this method.

Converts this Timestamp Domain object back into an SQL TIMESTAMP object.

Specified by:
toDatum in interface ORAData
Parameters:
conn - OracleConnection Not used.
Returns:
A Datum containing TIMESTAMP object.
Throws:
SQLException - Never.
java.sql.SQLException

getTime

public long getTime()
Returns the time as a long value using timestampValue().getTime().


getNativeObject

public java.lang.Object getNativeObject()
Specified by:
getNativeObject in interface NativeTypeDomainInterface

getValue

public java.sql.Timestamp getValue()
Return a java.sql.Timestamp object with this domain's value. This method may be used to access the value for this domain in EL-expressions.

javabean.property

getData

public java.lang.Object getData()
Internal: Applications should not invoke this method.

Specified by:
getData in interface DomainInterface
Returns:
a formatted value object.

dateValue

public java.sql.Date dateValue()
                        throws java.sql.SQLException
Convert to a Date representation of the Timestamp object

Overrides:
dateValue in class TIMESTAMP
Returns:
java.sql.Date representation of the Timestamp object
Throws:
SQLException, - if no Date representation exists
java.sql.SQLException

setContext

public void setContext(DomainOwnerInterface owner,
                       Transaction trans,
                       java.lang.Object ctx)
Internal: Applications should not invoke this method.

Specified by:
setContext in interface DomainInterface

compareTo

public int compareTo(java.lang.Object n)
Specified by:
compareTo in interface java.lang.Comparable

toTimestamp

public static Timestamp toTimestamp(java.lang.String value)
Converts an Oracle Timestamp expressed as a string to a Java Timestamp. The Java date can be either an java.sql.Timestamp or an java.sql.Timestamp.

Returns:
returns a java.sql.Timestamp object.

toString

public java.lang.String toString()
For testing purposes only: converts this to a textual representation.

Overrides:
toString in class TIMESTAMP

equals

public boolean equals(java.lang.Object other)
Tests this for equality with another object. The argument is converted to a Timestamp object, if necessary.

Overrides:
equals in class Datum
Parameters:
other - an arbitrary Object.
Returns:
true if conversion was successful and the converted argument is identical to this.

hashCode

public int hashCode()
Computes a hash code for this.

Overrides:
hashCode in class java.lang.Object
Returns:
the hash code of this.

printXMLDefinition

public java.lang.String printXMLDefinition(java.util.Hashtable allDefs,
                                           java.io.PrintWriter pw,
                                           boolean bContainees)
Prints the DTD info for this domain in the given print writer. Returns the DTD string to be added to this domain's container entity/domain.

The allDefs hashtable contains predefined XML definitions and is passed by whatever calls this method.

Specified by:
printXMLDefinition in interface XMLDomainInterface
Parameters:
allDefs - a hashtable of predefined XML definitions passed from whatever calls this method.
pw - print writer into which the defnition is being printed.
bContainees - if true, prints definitions of contained objects.

getXMLContentNode

public Node getXMLContentNode(Document xmlDoc)
Creates the xml node in the given xml document for this domain's data.

Specified by:
getXMLContentNode in interface XMLDomainInterface
Parameters:
xmlDoc - name of the XML document in which the node should be created.

getSerializedDomainXML

public Node getSerializedDomainXML(Document xmlDoc)
Creates the xml node in the given xml document for this domain's data in hex format of the byte[] representation of the data.

Specified by:
getSerializedDomainXML in interface XMLDomainWriter
Parameters:
xmlDoc - name of the XML document in which the node should be created.

getXMLDomainFactory

public static XMLDomainReaderFactory getXMLDomainFactory(java.lang.Class attrClass)
Internal: Applications should not use this method.


Oracle Fusion Middleware Java API Reference for Oracle ADF Model
11g Release 1 (11.1.1.4.0)

E10653-05

Copyright © 1997, 2011, Oracle. All rights reserved.