001: /******************************************************************************
002: * JBoss, a division of Red Hat *
003: * Copyright 2006, Red Hat Middleware, LLC, and individual *
004: * contributors as indicated by the @authors tag. See the *
005: * copyright.txt in the distribution for a full listing of *
006: * individual contributors. *
007: * *
008: * This is free software; you can redistribute it and/or modify it *
009: * under the terms of the GNU Lesser General Public License as *
010: * published by the Free Software Foundation; either version 2.1 of *
011: * the License, or (at your option) any later version. *
012: * *
013: * This software is distributed in the hope that it will be useful, *
014: * but WITHOUT ANY WARRANTY; without even the implied warranty of *
015: * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU *
016: * Lesser General Public License for more details. *
017: * *
018: * You should have received a copy of the GNU Lesser General Public *
019: * License along with this software; if not, write to the Free *
020: * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA *
021: * 02110-1301 USA, or see the FSF site: http://www.fsf.org. *
022: ******************************************************************************/package org.jboss.portal.core.model.portal;
023:
024: import java.util.Collection;
025: import java.util.Map;
026:
027: import org.jboss.portal.common.i18n.LocalizedString;
028:
029: /**
030: * The base interface for all portal objects.
031: *
032: * @author <a href="mailto:julien@jboss.org">Julien Viet</a>
033: * @version $Revision: 9031 $
034: */
035: public interface PortalObject extends Comparable {
036:
037: /** Portal property name that indicates the name of the default portal to lookup. */
038: String PORTAL_PROP_DEFAULT_OBJECT_NAME = "portal.defaultObjectName";
039:
040: /** The default portal name. */
041: String DEFAULT_OBJECT_NAME = "default";
042:
043: /** . */
044: int TYPE_CONTEXT = 0;
045:
046: /** . */
047: int TYPE_PORTAL = 1;
048:
049: /** . */
050: int TYPE_PAGE = 2;
051:
052: /** . */
053: int TYPE_WINDOW = 3;
054:
055: /** . */
056: int CONTEXT_MASK = 0x00000001;
057:
058: /** . */
059: int PORTAL_MASK = 0x00000002;
060:
061: /** . */
062: int PAGE_MASK = 0x00000004;
063:
064: /** . */
065: int WINDOW_MASK = 0x00000008;
066:
067: /**
068: * Return the object id unique in the scope of its container.
069: *
070: * @return the object id
071: */
072: PortalObjectId getId();
073:
074: /**
075: * Returns the type of the object which is a value that discriminates the object type.
076: *
077: * @return the object type.
078: */
079: int getType();
080:
081: /**
082: * Return the object name unique in the scope of its parent.
083: *
084: * @return the object name
085: */
086: String getName();
087:
088: /**
089: * Return the localized string used to represent that object.
090: *
091: * @return the localized display name
092: */
093: LocalizedString getDisplayName();
094:
095: /**
096: * Set the localized string used to represent that object.
097: *
098: * @param the localized display name
099: */
100: void setDisplayName(LocalizedString localizedString);
101:
102: /**
103: * Returns the listener id or null if there is none.
104: *
105: * @return the listener
106: */
107: String getListener();
108:
109: /**
110: * Set a listener id.
111: *
112: * @param listener the listener id
113: */
114: void setListener(String listener);
115:
116: /**
117: * Return all the children of this object.
118: *
119: * @return the children
120: */
121: Collection getChildren();
122:
123: /**
124: * Return all the children of this object filtered with a particular mask.
125: *
126: * @return the children
127: */
128: Collection getChildren(int mask);
129:
130: /**
131: * Return the parent object.
132: *
133: * @return the parent object.
134: */
135: PortalObject getParent();
136:
137: /**
138: * Return a specific child object or null if it does not exist.
139: *
140: * @return a child object.
141: */
142: PortalObject getChild(String name);
143:
144: /**
145: * Destroy an existing child.
146: *
147: * @param name the child name
148: * @throws NoSuchPortalObjectException if the child does not exist
149: * @throws IllegalArgumentException if the name argument is null
150: */
151: void destroyChild(String name) throws NoSuchPortalObjectException,
152: IllegalArgumentException;
153:
154: /**
155: * Copy the portal object as a child of the specified object.
156: *
157: * @param parent the parent of the copy
158: * @param name the name of the child
159: * @param deep true copies recursively children
160: * @return the newly created node child of the specified parent
161: * @throws DuplicatePortalObjectException if the specified parent has already a node with such a name
162: * @throws IllegalArgumentException if the specified parent is null
163: */
164: PortalObject copy(PortalObject parent, String name, boolean deep)
165: throws DuplicatePortalObjectException,
166: IllegalArgumentException;
167:
168: /**
169: * Return a property of that object.
170: *
171: * @return the property value
172: * @throws IllegalArgumentException if the name is null
173: */
174: String getProperty(String name) throws IllegalArgumentException;
175:
176: /**
177: * Returns a read only map that contains the object properties.
178: *
179: * @return a map of the object properties
180: */
181: Map getProperties();
182:
183: /**
184: * Return a property declared on that object.
185: *
186: * @return the property value
187: * @throws IllegalArgumentException if the name is null
188: */
189: String getDeclaredProperty(String name)
190: throws IllegalArgumentException;
191:
192: /**
193: * Update a property declared on that object.
194: *
195: * @param name the property name
196: * @param value the property value
197: * @throws IllegalArgumentException if the name argument is null
198: */
199: void setDeclaredProperty(String name, String value)
200: throws IllegalArgumentException;
201:
202: /**
203: * Return a map that contains the object declared properties.
204: *
205: * @return a map of the properties declared by the object
206: */
207: Map getDeclaredProperties();
208:
209: // /**
210: // * Return true if the portal object is part of a dashboard.
211: // *
212: // * @return if it is a dashboard
213: // */
214: // boolean isDashboard();
215: }
|