Source code: com/RuntimeCollective/webapps/bean/Actor.java
1 /* $Header: /home/CVS/rjp/src/com/RuntimeCollective/webapps/bean/Actor.java,v 1.5 2003/09/30 15:13:08 joe Exp $
2 * $Revision: 1.5 $
3 * $Date: 2003/09/30 15:13:08 $
4 *
5 * ====================================================================
6 *
7 * Josephine : http://www.runtime-collective.com/josephine/index.html
8 *
9 * Copyright (C) 2003 Runtime Collective
10 *
11 * This product includes software developed by the
12 * Apache Software Foundation (http://www.apache.org/).
13 *
14 * This library is free software; you can redistribute it and/or
15 * modify it under the terms of the GNU Lesser General Public
16 * License as published by the Free Software Foundation; either
17 * version 2.1 of the License, or (at your option) any later version.
18 *
19 * This library is distributed in the hope that it will be useful,
20 * but WITHOUT ANY WARRANTY; without even the implied warranty of
21 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
22 * Lesser General Public License for more details.
23 *
24 * You should have received a copy of the GNU Lesser General Public
25 * License along with this library; if not, write to the Free Software
26 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
27 *
28 */
29
30 package com.RuntimeCollective.webapps.bean;
31
32 import com.RuntimeCollective.webapps.bean.EntityBean;
33
34 /** Abstract class for all objects that wrap a registered user of a Runtime Webapp.
35 * <p> Different modules will want to add to the properties of a basic User: the school module has Students and Staff, the content management system will have Authors etc. Each of these should be implemented as wrappers of User that implement this Actor interface.
36 * <p> There are three ways of getting an Actor:
37 * <ol>
38 * <li> If you have an existing User and want to 'promote' them to an Actor then construct a new actor using RuntimeParameters.getStore().create, and set the User with setUser.
39 * <li> If there is an existing actor in the DB for which you have the id, then get it using RuntimeParameters.getStore().get -- this will fill in the wrapped user as required.
40 * <li> If there is an existing actor in the DB, but you only have the User that it wraps, then get it using getActorForUser().
41 * </ol>
42 * <p> An Actor should act like any other EntityBean. In particular it must implement the two constructors:
43 * <ul>
44 * <li><code>Actor()</code> -- should generate a new Actor with a new unique ID, though the underlying user should remain null.
45 * <li><code>Actor(int id)</code> -- should get an existing Actor from the database for this ID. It should also get the corresponding User from the RuntimeParameters.getStore().
46 * </ul>
47 * And, as with all other EntityBeans, these constructors should never be called directly but only via the RuntimeParameters.getStore().
48 *
49 * @see com.RuntimeCollective.webapps.bean.SimpleUser
50 * @see com.RuntimeCollective.webapps.bean.User
51 * @author Joe Faith
52 * @version $Id: Actor.java,v 1.5 2003/09/30 15:13:08 joe Exp $
53 */
54 public interface Actor extends User {
55
56 /** Get the User that this Actor wraps. */
57 public User getUser();
58
59 /** Set the User that this Actor wraps. */
60 public void setUser( User user );
61
62 /** Get the value of an attribute. */
63 public Object getAttribute( String name );
64
65 /** Set the value of an attribute. */
66 public void setAttribute( String name, Object value );
67
68 }