001: /*
002: * Licensed to the Apache Software Foundation (ASF) under one or more
003: * contributor license agreements. See the NOTICE file distributed with
004: * this work for additional information regarding copyright ownership.
005: * The ASF licenses this file to You under the Apache License, Version 2.0
006: * (the "License"); you may not use this file except in compliance with
007: * the License. You may obtain a copy of the License at
008: *
009: * http://www.apache.org/licenses/LICENSE-2.0
010: *
011: * Unless required by applicable law or agreed to in writing, software
012: * distributed under the License is distributed on an "AS IS" BASIS,
013: * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
014: * See the License for the specific language governing permissions and
015: * limitations under the License.
016: */
017: package org.apache.jetspeed.om.folder.psml;
018:
019: import java.util.ArrayList;
020: import java.util.Iterator;
021: import java.util.List;
022:
023: import org.apache.jetspeed.om.page.Document;
024: import org.apache.jetspeed.om.page.psml.DefaultsImpl;
025: import org.apache.jetspeed.om.page.psml.DocumentImpl;
026:
027: /**
028: * <p>
029: * FolderMetaDataImpl
030: * </p>
031: * <p>
032: *
033: * </p>
034: *
035: * @author <a href="mailto:weaver@apache.org">Scott T. Weaver </a>
036: * @version $Id: FolderMetaDataImpl.java 553014 2007-07-03 23:10:53Z ate $
037: *
038: */
039: public class FolderMetaDataImpl extends DocumentImpl implements
040: Document {
041: public static final String DOCUMENT_TYPE = "folder.metadata";
042:
043: private DefaultsImpl defaults = new DefaultsImpl();
044: private List docOrder;
045: private String defaultPage;
046:
047: /**
048: * menuDefinitions - menu definitions for folder
049: */
050: private List menuDefinitions;
051:
052: public FolderMetaDataImpl() {
053: docOrder = new ArrayList(4);
054: }
055:
056: /**
057: * <p>
058: * getType
059: * </p>
060: *
061: * @return document type
062: */
063: public String getType() {
064: return DOCUMENT_TYPE;
065: }
066:
067: /**
068: * <p>
069: * getUrl
070: * </p>
071: *
072: * @return url of folder
073: */
074: public String getUrl() {
075: return getParent(false).getPath() + PATH_SEPARATOR + getType();
076: }
077:
078: /**
079: * <p>
080: * getSkin
081: * </p>
082: *
083: * @return skin for folder
084: */
085: public String getSkin() {
086: // delegate to defaults implementation
087: return defaults.getSkin();
088: }
089:
090: /**
091: * <p>
092: * setSkin
093: * </p>
094: *
095: * @param skinName skin for folder
096: */
097: public void setSkin(String skinName) {
098: // delegate to defaults implementation
099: defaults.setSkin(skinName);
100: }
101:
102: /**
103: * <p>
104: * getDefaultDecorator
105: * </p>
106: *
107: * @param fragmentType portlet or layout fragment type
108: * @return decorator name
109: */
110: public String getDefaultDecorator(String fragmentType) {
111: // delegate to defaults implementation
112: return defaults.getDecorator(fragmentType);
113: }
114:
115: /**
116: * <p>
117: * setDefaultDecorator
118: * </p>
119: *
120: * @param decoratorName decorator name
121: * @param fragmentType portlet or layout fragment type
122: */
123: public void setDefaultDecorator(String decoratorName,
124: String fragmentType) {
125: // delegate to defaults implementation
126: defaults.setDecorator(fragmentType, decoratorName);
127: }
128:
129: /**
130: * <p>
131: * getDocumentOrder
132: * </p>
133: *
134: * @return document order
135: */
136: public List getDocumentOrder() {
137: return docOrder;
138: }
139:
140: /**
141: * <p>
142: * setDocumentOrder
143: * </p>
144: *
145: * @param docIndexes
146: */
147: public void setDocumentOrder(List docIndexes) {
148: docOrder = docIndexes;
149: }
150:
151: /**
152: * @return Returns the defaultPage.
153: */
154: public String getDefaultPage() {
155: return defaultPage;
156: }
157:
158: /**
159: * @param defaultPage The defaultPage to set.
160: */
161: public void setDefaultPage(String defaultPage) {
162: this .defaultPage = defaultPage;
163: }
164:
165: /**
166: * getMenuDefinitions - get list of menu definitions
167: *
168: * @return definition list
169: */
170: public List getMenuDefinitions() {
171: return menuDefinitions;
172: }
173:
174: /**
175: * setMenuDefinitions - set list of menu definitions
176: *
177: * @param definitions definition list
178: */
179: public void setMenuDefinitions(List definitions) {
180: menuDefinitions = definitions;
181: }
182:
183: /**
184: * getDefaults - Castor access method for Defaults.
185: *
186: * @return defaults instance
187: */
188: public DefaultsImpl getDefaults() {
189: return this .defaults;
190: }
191:
192: /**
193: * setDefaults - Castor access method for Defaults.
194: *
195: * @param defaults defaults instance
196: */
197: public void setDefaults(DefaultsImpl defaults) {
198: this .defaults = defaults;
199: }
200:
201: /**
202: * unmarshalled - notification that this instance has been
203: * loaded from the persistent store
204: */
205: public void unmarshalled() {
206: // notify super class implementation
207: super .unmarshalled();
208:
209: // propagate unmarshalled notification
210: // to all menu definitions
211: if (menuDefinitions != null) {
212: Iterator menuIter = menuDefinitions.iterator();
213: while (menuIter.hasNext()) {
214: ((MenuDefinitionImpl) menuIter.next()).unmarshalled();
215: }
216: }
217: }
218:
219: /**
220: * marshalling - notification that this instance is to
221: * be saved to the persistent store
222: */
223: public void marshalling() {
224: // propagate marshalling notification
225: // to all menu definitions
226: if (menuDefinitions != null) {
227: Iterator menuIter = menuDefinitions.iterator();
228: while (menuIter.hasNext()) {
229: ((MenuDefinitionImpl) menuIter.next()).marshalling();
230: }
231: }
232:
233: // notify super class implementation
234: super.marshalling();
235: }
236: }
|