Red Hat Web Application Framework 6.1 用户手册

下载
页码 230
Chapter 10. Kernel Tutorial
107
10.2.1.1. Starting the Class
A domain object starts off as a standard Java class that extends one of the four domain object base
classes. Because of the auditing and permissioning requirements,
AuditedACSObject
is the base
class.
The code in Example 10-1 illustrates the initial definition of the class and the import statements.
package com.arsdigita.notes;
import com.arsdigita.db.Sequences;
import com.arsdigita.domain.DataObjectNotFoundException;
import com.arsdigita.auditing.AuditedACSObject;
import com.arsdigita.kernel.Stylesheet;
import com.arsdigita.kernel.User;
(1)
import com.arsdigita.persistence.DataAssociation;
import com.arsdigita.persistence.DataObject;
import com.arsdigita.persistence.PersistenceException;
import com.arsdigita.persistence.OID;
import com.arsdigita.persistence.metadata.ObjectType;
import java.math.BigDecimal;
import java.sql.SQLException;
import java.util.Date;
// Stylesheets
import java.util.Locale;
import java.util.ArrayList;
import org.apache.log4j.Category;
/**
* Note class.
Extends AuditedACSObject to implement
(2)
* persistent Note objects.
*
*

p

* Note: according to current DomainObject docs, APIs are not yet
* stable. Changes may invalidate the Note class.
*
* @author Scott Seago
**/
public class Note extends AuditedACSObject {
(3)
private static Category log =
(2)
Category.getInstance(Note.class.getName());
/**
* BASE_DATA_OBJECT_TYPE represents the full objectType name for the
* Note class
**/
private static final String BASE_DATA_OBJECT_TYPE =
(4)
"com.arsdigita.notes.Note";
...
/**
* Returns the appropriate object type for a Note so that proper
* type validation will occur when retrieving Notes by
OID
*
* @return The fully qualified name of of the base data object
* type for the Note object type.