X-Git-Url: http://git.kpe.io/?a=blobdiff_plain;f=examples%2Fperson.lisp;h=5a91b6a674d832242fc98854ba6040c76da0801d;hb=0817a8721cbefca2205dcde535ff6b164033abef;hp=81e37f41045dba0d43fffc783d4e881e4a09b9c5;hpb=c0d7503d6636b6d5adb762258fdb20c1b4ceb53a;p=hyperobject.git diff --git a/examples/person.lisp b/examples/person.lisp index 81e37f4..5a91b6a 100644 --- a/examples/person.lisp +++ b/examples/person.lisp @@ -9,7 +9,7 @@ ;;;; ;;;; A simple example file for hyperobjects ;;;; -;;;; $Id: person.lisp,v 1.1 2002/11/29 23:14:32 kevin Exp $ +;;;; $Id$ ;;;; ;;;; This file is Copyright (c) 2000-2002 by Kevin M. Rosenberg ;;;; @@ -17,19 +17,28 @@ (in-package :hyperobject-user) - (defclass person (hyperobject) - ((first-name :type string :initarg :first-name :reader first-name) - (last-name :type string :initarg :last-name :reader last-name - :reference find-person-by-last-name) - (dob :type integer :initarg :dob :reader dob :print-formatter format-date) - (resume :type cdata :initarg :resume :reader resume) - (addresses :initarg :addresses :reader addresses :subobject t)) + ((first-name :value-type (varchar 20) :initarg :first-name :accessor first-name + :value-constraint stringp :null-allowed nil) + (last-name :value-type (varchar 30) :initarg :last-name :accessor last-name + :value-constraint stringp + :hyperlink find-person-by-last-name :null-allowed nil) + (full-name :value-type string :stored nil) + (dob :value-type integer :initarg :dob :accessor dob :print-formatter format-date + :value-constraint integerp :input-filter convert-to-date) + (resume :value-type string :initarg :resume :accessor resume + :value-constraint stringp) +;; (addresses :value-type (list-of subobject) :initarg :addresses :accessor addresses)) + (addresses :subobject t :initarg :addresses :accessor addresses)) (:metaclass hyperobject-class) - (:default-initargs :first-name nil :last-name nil :dob 0 :resume nil) - (:print-slots first-name last-name dob resume) - (:title "Person") - (:description "A Person")) + (:default-initargs :first-name "" :last-name "" :dob 0 :resume nil) + (:default-print-slots first-name last-name dob resume) + (:user-name "Person") + (:user-name-plural "Persons") + (:description "A Person") + (:direct-rules + (:rule-1 (:dependants (last-name first-name) :volatile full-name) + (setf full-name (concatenate 'string first-name " " last-name))))) (defun format-date (ut) (when (typep ut 'integer) @@ -44,22 +53,27 @@ hr min sec)))) (defclass address (hyperobject) - ((title :type string :initarg :title :reader title) - (street :type string :initarg :street :reader street) - (phones :initarg :phones :reader phones :subobject t)) + ((title :value-type (varchar 20) :initarg :title :accessor title + :value-constraint stringp) + (street :value-type (varchar 30) :initarg :street :accessor street + :value-constraint stringp) + (phones :subobject t :initarg :phones :accessor phones)) (:metaclass hyperobject-class) (:default-initargs :title nil :street nil) - (:title "Address") - (:print-slots title street) + (:user-name "Address" "Addresses") + (:default-print-slots title street) (:description "An address")) (defclass phone (hyperobject) - ((title :type string :initarg :title :reader title) - (phone-number :type string :initarg :phone-number :reader phone-number)) + ((title :value-type (varchar 20) :initarg :title :accessor title + :value-constraint stringp) + (phone-number :value-type (varchar 16) :initarg :phone-number :accessor phone-number + :value-constraint stringp)) (:metaclass hyperobject-class) - (:title "Phone Number") + (:user-name "Phone Number") + (:user-name-plural "Phone Numbers") (:default-initargs :title nil :phone-number nil) - (:print-slots title phone-number) + (:default-print-slots title phone-number) (:description "A phone number")) @@ -87,4 +101,4 @@ (view mary :subobjects t) (format t "~&XML Format with field labels and hyperlinks~%") -(view mary :subobjects t :label t :format :xmlref) +(view mary :subobjects t :category :xml-link-labels)