001: /* Copyright 2004 The JA-SIG Collaborative. All rights reserved.
002: * See license distributed with this file and
003: * available online at http://www.uportal.org/license.html
004: */
005:
006: package org.jasig.portal.layout.alm;
007:
008: import org.jasig.portal.PortalException;
009:
010: import java.util.Set;
011: import java.util.HashSet;
012:
013: /**
014: * The implementation of the user layout fragment.
015: *
016: * Prior to uPortal 2.5, this class existed in the package org.jasig.portal.layout.
017: * It was moved to its present package to reflect that it is part of Aggregated
018: * Layouts.
019: *
020: * @author <a href="mailto:mvi@immagic.com">Michael Ivanov</a>
021: * @version $Revision: 35724 $
022: */
023: public class ALFragment extends AggregatedLayout implements
024: ILayoutFragment {
025:
026: protected String functionalName;
027: protected String description;
028: protected boolean pushedFragment = false;
029:
030: public ALFragment(String fragmentId,
031: IAggregatedUserLayoutManager layoutManager)
032: throws PortalException {
033: super (fragmentId, layoutManager);
034: }
035:
036: public ALFragment(String fragmentId) throws PortalException {
037: super (fragmentId);
038: }
039:
040: /**
041: * Answers whether the fragment is pushed or pulled
042: *
043: * @return an boolean value
044: */
045: public boolean isPushedFragment() {
046: return pushedFragment;
047: }
048:
049: /**
050: * Marks the fragment as pushed
051: */
052: public void setPushedFragment() {
053: pushedFragment = true;
054: }
055:
056: /**
057: * Marks the fragment as pulled
058: */
059: public void setPulledFragment() {
060: pushedFragment = false;
061: }
062:
063: /**
064: * Returns a fragment functional name
065: *
066: * @return an <code>String</code> fragment name
067: */
068: public String getFunctionalName() {
069: return functionalName;
070: }
071:
072: /**
073: * Sets a fragment functional name
074: * @param functionalName a <code>String</code> value
075: */
076: public void setFunctionalName(String functionalName) {
077: this .functionalName = functionalName;
078: }
079:
080: /**
081: * Returns a fragment name
082: *
083: * @return an <code>String</code> fragment name
084: */
085: public String getName() {
086: return getFunctionalName();
087: }
088:
089: /**
090: * Returns a fragment description
091: *
092: * @return an <code>String</code> fragment description
093: */
094: public String getDescription() {
095: return description;
096: }
097:
098: /**
099: * Sets a fragment name
100: * @param name a <code>String</code> value
101: */
102: public void setName(String name) {
103: setFunctionalName(name);
104: }
105:
106: /**
107: * Sets a fragment description
108: * @param description a <code>String</code> value
109: */
110: public void setDescription(String description) {
111: this .description = description;
112: }
113:
114: /**
115: * Returns a list of fragment Ids existing in the layout.
116: *
117: * @return a <code>Set</code> of <code>String</code> fragment Ids.
118: * @exception PortalException if an error occurs
119: */
120: public Set getFragmentIds() throws PortalException {
121: Set set = new HashSet();
122: set.add(getId());
123: return set;
124: }
125:
126: /**
127: * Returns an fragment Id for a given node.
128: * Returns null if the node is not part of any fragments.
129: *
130: * @param nodeId a <code>String</code> value
131: * @return a <code>String</code> fragment Id
132: * @exception PortalException if an error occurs
133: */
134: public String getFragmentId(String nodeId) throws PortalException {
135: return getId();
136: }
137:
138: /**
139: * Returns the fragment root Id.
140: *
141: * @return a <code>String</code> fragment root Id
142: * @exception PortalException if an error occurs
143: */
144: public String getFragmentRootId() throws PortalException {
145: return getFragmentRootId(getId());
146: }
147:
148: }
|