r3454: *** empty log message ***
[hyperobject.git] / example.lisp
index 974a1e20af5717b456f39d26b6a5b8c7f3ee61a7..9398cc6f171247f22d95a34f0d8eaba58315808e 100644 (file)
@@ -2,31 +2,31 @@
 ;;;; *************************************************************************
 ;;;; FILE IDENTIFICATION
 ;;;;
-;;;; Name:          hyperobject-plain-example.lisp
-;;;; Purpose:       Hyper Object Metaclass
+;;;; Name:          hyperobject-example.lisp
+;;;; Purpose:       Hyperobject Example file
 ;;;; Programmer:    Kevin M. Rosenberg
-;;;; Date Started:  Apr 2000
+;;;; Date Started:  Oct 2002
 ;;;;
-;;;; This metaclass as functions to classes to allow display
-;;;; in Text, HTML, and XML formats. This includes hyperlinking
-;;;; capability and sub-objects.
+;;;; A simple example file for hyperobjects
 ;;;;
-;;;; $Id: example.lisp,v 1.1 2002/11/22 10:49:24 kevin Exp $
+;;;; $Id: example.lisp,v 1.2 2002/11/22 15:45:06 kevin Exp $
 ;;;;
 ;;;; This file is Copyright (c) 2000-2002 by Kevin M. Rosenberg
 ;;;;
 ;;;; *************************************************************************
  
-(in-package :hyperobject-user)
+(in-package :hyperobject-mop-user)
 
-(define-hyperobject person ()
-  ((first-name :type string :reference find-person-by-last-name)
-   (last-name :type string)
-   (dob :type integer :initform 0 :format-func format-date)
-   (resume :type cdata)
-   (addresses :subobject t))
-  (:title "Person")
-  (:documentation "Person hyperobject class"))
+
+(defclass person (hyperobject)
+  ((first-name :type string :initarg :first-name :reader first-name :initform nil)
+   (last-name :type string :initarg :last-name :reader last-name :initform nil
+             :reference find-person-by-last-name)
+   (dob :type integer :initarg :dob :reader dob :initform 0 :format-func format-date)
+   (resume :type cdata :initarg :resume :reader resume)
+   (addresses :initarg :addresses :reader addresses :initform nil :subobject t))
+  (:metaclass hyperobject-class)
+  (:title "Person"))
 
 (defun format-date (ut)
   (when (typep ut 'integer)
                year
                hr min sec))))
 
-(define-hyperobject address ()
-  ((title :type string)
-   (street :type string)
-   (phones :subobject t))
-  (:title "Address")
-  (:documentation "Address hyperobject"))
+(defclass address (hyperobject)
+  ((title :type string :initarg :title :reader title :initform nil)
+   (street :type string :initarg :street :reader street :initform nil)
+   (phones :initarg :phones :reader phones :initform nil :subobject t))
+  (:metaclass hyperobject-class)
+  (:title "Address"))
 
-(define-hyperobject phone ()
-  ((phone-number :type string))
-  (:title "Phone Number")
-  (:documentation "Phone hyperobject"))
+(defclass phone (hyperobject)
+  ((phone-number :type string :initarg :phone-number :reader phone-number))
+  (:metaclass hyperobject-class)
+  (:title "Phone Number"))
 
 
 (defparameter home-phone-1 (make-instance 'phone :phone-number "367-9812"))