001: /**********************************************************************************
002: * $URL: https://source.sakaiproject.org/svn/osp/tags/sakai_2-4-1/matrix/api/src/java/org/theospi/portfolio/matrix/model/Cell.java $
003: * $Id: Cell.java 11228 2006-06-27 16:39:38Z andersjb@iupui.edu $
004: ***********************************************************************************
005: *
006: * Copyright (c) 2005, 2006 The Sakai Foundation.
007: *
008: * Licensed under the Educational Community License, Version 1.0 (the "License");
009: * you may not use this file except in compliance with the License.
010: * You may obtain a copy of the License at
011: *
012: * http://www.opensource.org/licenses/ecl1.php
013: *
014: * Unless required by applicable law or agreed to in writing, software
015: * distributed under the License is distributed on an "AS IS" BASIS,
016: * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
017: * See the License for the specific language governing permissions and
018: * limitations under the License.
019: *
020: **********************************************************************************/package org.theospi.portfolio.matrix.model;
021:
022: import java.util.Set;
023:
024: import org.sakaiproject.metaobj.shared.model.Id;
025: import org.sakaiproject.metaobj.shared.model.IdentifiableObject;
026:
027: /**
028: * @author rpembry
029: */
030: public class Cell extends IdentifiableObject {
031:
032: private Id id;
033: private Matrix matrix;
034: private ScaffoldingCell scaffoldingCell;
035: private WizardPage wizardPage;
036:
037: public final static String TYPE = "matrix_cell_type";
038:
039: public Cell() {
040: setWizardPage(new WizardPage());
041: }
042:
043: /**
044: * gets the attachments from the wizard page
045: * @return Returns Set of Attachments
046: */
047: public Set getAttachments() {
048: return wizardPage.getAttachments();
049: }
050:
051: /**
052: * This sets the attachments in the contained wizard page
053: * @param attachments A Set of Attachments to set.
054: */
055: public void setAttachments(Set attachments) {
056: wizardPage.setAttachments(attachments);
057: }
058:
059: /**
060: * @return Returns the id.
061: */
062: public Id getId() {
063: return id;
064: }
065:
066: /**
067: * @param id The id to set.
068: */
069: public void setId(Id id) {
070: this .id = id;
071: }
072:
073: /**
074: * @return Returns the status.
075: */
076: public String getStatus() {
077: return wizardPage.getStatus().toUpperCase();
078: }
079:
080: /**
081: * @param status The status to set.
082: */
083: public void setStatus(String status) {
084: wizardPage.setStatus(status.toUpperCase());
085: }
086:
087: /**
088: * @return Returns the matrix.
089: */
090: public Matrix getMatrix() {
091: return matrix;
092: }
093:
094: /**
095: * @param matrix The matrix to set.
096: */
097: public void setMatrix(Matrix matrix) {
098: this .matrix = matrix;
099: }
100:
101: /* (non-Javadoc)
102: * @see java.lang.Object#equals(java.lang.Object)
103: */
104: public boolean equals(Object other) {
105: if (other == this )
106: return true;
107: if (other == null || !(other instanceof Cell))
108: return false;
109: //TODO need better equals method
110: if (this .getId() == null)
111: return false;
112: return (this .getId().equals(((Cell) other).getId()));
113:
114: }
115:
116: /* (non-Javadoc)
117: * @see java.lang.Object#hashCode()
118: */
119: public int hashCode() {
120: //TODO need better hashcode
121: Id id = this .getId();
122: if (id == null)
123: return 0;
124: return id.getValue().hashCode();
125: }
126:
127: /**
128: * @return Returns the scaffoldingCell.
129: */
130: public ScaffoldingCell getScaffoldingCell() {
131: return scaffoldingCell;
132: }
133:
134: /**
135: * @param scaffoldingCell The scaffoldingCell to set.
136: */
137: public void setScaffoldingCell(ScaffoldingCell scaffoldingCell) {
138: this .scaffoldingCell = scaffoldingCell;
139: wizardPage.setPageDefinition(scaffoldingCell
140: .getWizardPageDefinition());
141: }
142:
143: /**
144: * @return Returns the cellForms.
145: */
146: public Set getCellForms() {
147: return wizardPage.getPageForms();
148: }
149:
150: /**
151: * @param cellForms The cellForms to set.
152: */
153: public void setCellForms(Set cellForms) {
154: wizardPage.setPageForms(cellForms);
155: }
156:
157: public WizardPage getWizardPage() {
158: return wizardPage;
159: }
160:
161: public void setWizardPage(WizardPage wizardPage) {
162: this.wizardPage = wizardPage;
163: }
164: }
|