User's Manual

Chapter 10. Kernel Tutorial 111
* new instance.
*
* @see com.arsdigita.persistence.Session#create(String)
* @see com.arsdigita.persistence.DataObject
* @see com.arsdigita.persistence.metadata.ObjectType
**/
public DomainObject(String typeName) {
Session s = SessionManager.getSession(); (1)
if (s == null) {
throw new RuntimeException("Could not retrieve a session
from " + "the session manager while instantiating " +
"a class with ObjectType = " + typeName);
}
m_dataObject = s.create(typeName);
initialize();
}
/**
* Constructor. The contained DataObject is
* initialized with a new DataObject with an
* ObjectType specified by type.
*
* @param type The ObjectType of the new instance.
*
* @see com.arsdigita.persistence.Session#create(ObjectType)
* @see com.arsdigita.persistence.DataObject
* @see com.arsdigita.persistence.metadata.ObjectType
**/
public DomainObject(ObjectType type) {
Session s = SessionManager.getSession(); (1)
if (s == null) {
throw new RuntimeException("Could not retrieve a session
from " + "the session manager while instantiating " +
"a class with ObjectType = " + type.getName());
}
m_dataObject = s.create(type);
initialize();
}
/**
* Constructor. The contained DataObject is retrieved
* from the persistent storage mechanism with an OID specified by
* oid.
*
* @param oid The OID for the retrieved
* DataObject.
*
* @exception DataObjectNotFoundException Thrown if we cannot
* retrieve a data object for the specified OID
*
* @see com.arsdigita.persistence.Session#retrieve(OID)
* @see com.arsdigita.persistence.DataObject
* @see com.arsdigita.persistence.OID
**/
public DomainObject(OID oid) throws DataObjectNotFoundException {
Session s = SessionManager.getSession();
if (s == null) {
throw new RuntimeException("Could not retrieve a session (2)
from " + "the session manager while instantiating " +
"a class with OID = " + oid.toString());