01: /*
02: * Copyright 2001-2007 Geert Bevin <gbevin[remove] at uwyn dot com>
03: * Distributed under the terms of either:
04: * - the common development and distribution license (CDDL), v1.0; or
05: * - the GNU Lesser General Public License, v2.1 or later
06: * $Id: DatabaseContentInfo.java 3634 2007-01-08 21:42:24Z gbevin $
07: */
08:
09: package com.uwyn.rife.cmf.dam.contentmanagers;
10:
11: import com.uwyn.rife.cmf.ContentInfo;
12: import com.uwyn.rife.site.ConstrainedProperty;
13:
14: /**
15: * This class adds additional properties to the <code>ContentInfo</code> class
16: * to be able to store the data in a datab.ase
17: *
18: * @author Geert Bevin (gbevin[remove] at uwyn dot com)
19: * @version $Revision: 3634 $
20: * @since 1.0
21: */
22: public class DatabaseContentInfo extends ContentInfo {
23: private int mContentId = -1;
24:
25: /**
26: * Instantiates a new <code>DatabaseContentInfo</code> instance.
27: */
28: public DatabaseContentInfo() {
29: }
30:
31: public void activateValidation() {
32: super .activateValidation();
33:
34: addConstraint(new ConstrainedProperty("contentId")
35: .notNull(true).rangeBegin(0).identifier(true));
36: }
37:
38: /**
39: * Sets the ID of the stored <code>Content</code> instance.
40: * <p>This ID will not be used to refer to the Content instance from
41: * outside the backend. The path and the version should be used for this
42: * instead.
43: *
44: * @param contentId the ID of the <code>Content</code> instance
45: * @see #getContentId()
46: */
47: public void setContentId(int contentId) {
48: mContentId = contentId;
49: }
50:
51: /**
52: * Retrieves the ID of the stored <code>Content</code> instance.
53: *
54: * @return the <code>Content</code>'s ID
55: * @see #setContentId(int)
56: */
57: public int getContentId() {
58: return mContentId;
59: }
60: }
|