Source code: com/RuntimeCollective/webapps/bean/Versioned.java
1 /* $Header: /home/CVS/rjp/src/com/RuntimeCollective/webapps/bean/Versioned.java,v 1.6 2003/09/30 15:13:10 joe Exp $
2 * $Revision: 1.6 $
3 * $Date: 2003/09/30 15:13:10 $
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.Duplicable;
33
34 import java.util.List;
35
36 /**
37 * Interface to implement if you want an EntityBean to be duplicable, that is,
38 * to make it possible to duplicate a bean into a new one, with the same properties,
39 * but a new id.
40 *
41 * @version $Id: Versioned.java,v 1.6 2003/09/30 15:13:10 joe Exp $
42 */
43 public interface Versioned extends Duplicable {
44
45 /** Not sure we need this, but EBS complains otherwise */
46 public static String DATABASE_TABLE = "global_object";
47
48 /** The tag for the TRUNK, reference version. This will be used for the version being currently edited. */
49 public static final String TRUNK_TAG = "trunk";
50 /** The tag for the Live version of objects (one per object - like all other tags). */
51 public static final String LIVE_TAG = "live";
52 /** The tag for the Archived version of objects (in case you need one). */
53 public static final String ARCHIVED_TAG = "archived";
54
55 /**
56 * Set the Reference of this Version, that is,
57 * the id of the first object in the family of versions.
58 * <p>
59 * This should not really be called directly.
60 * <p>
61 * This Reference version should *not* be deleted, otherwise all other versions will get scattered.
62 *
63 * @param reference, the new Reference int
64 */
65 public void setVersionReference(int reference);
66
67 /**
68 * Get the Reference of this Version, that is,
69 * the id of the first object in the family of versions.
70 *
71 * @return the Reference int
72 */
73 public int getVersionReference();
74
75 /**
76 * Set the Tag of this Version.
77 * <p>
78 * This should not really be called directly.
79 *
80 * @param tag, the new Tag String
81 */
82 public void setVersionTag(String tag);
83
84 /**
85 * Get the Tag of this Version.
86 *
87 * @return the Tag String
88 */
89 public String getVersionTag();
90
91 /**
92 * Get a List of all the existing version's tags.
93 *
94 * @return a List of Strings, the tags
95 */
96 public List getVersionTagList();
97
98 /**
99 * Create and save a new version of this object based on a existing one,
100 * and tag it with the specified tag. If a version with the newVersionTag
101 * already exists, it will be overwritten - ie its id will be reused.
102 * <p>
103 * The reference version should already exist, otherwise this method will do
104 * nothing and return "null".
105 * <br>
106 * A version with the newVersionTag may or may not exist: if it doesn't, it will
107 * be created - if it does, it will be overwritten.
108 *
109 * @param referenceVersionTag, the version which will be duplicated and used as
110 * a base for the new version
111 * @param newVersionTag, the tag given to the new version
112 * @return a new version, or null if either the reference version doesn't exist, or
113 * the new tag is already used.
114 */
115 public Versioned createOrReplaceVersion(String referenceVersionTag, String newVersionTag);
116
117 /**
118 * Get an existing version of this object.
119 * <p>
120 * The version should already exist. It is doesn't, this method
121 * will do nothing and return "null".
122 *
123 * @param versionTag, the version required
124 * @return the required version, or "null" if it doesn't exist
125 */
126 public Versioned getVersion(String versionTag);
127 }
128
129
130
131