001: /**********************************************************************************
002: * $URL:https://source.sakaiproject.org/svn/osp/trunk/matrix/api/src/java/org/theospi/portfolio/matrix/model/Attachment.java $
003: * $Id:Attachment.java 9134 2006-05-08 20:28:42Z chmaurer@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 org.sakaiproject.metaobj.shared.model.Id;
023: import org.sakaiproject.metaobj.shared.model.IdentifiableObject;
024:
025: /**
026: * @author rpembry
027: */
028: public class Attachment extends IdentifiableObject {
029: Id artifactId;
030: WizardPage wizardPage;
031:
032: /**
033: * @return Returns the artifactId.
034: */
035: public Id getArtifactId() {
036: return artifactId;
037: }
038:
039: /**
040: * @param artifactId The artifactId to set.
041: */
042: public void setArtifactId(Id artifactId) {
043: this .artifactId = artifactId;
044: }
045:
046: /**
047: * @return Returns the wizardPage that contains this Attachment
048: */
049: public WizardPage getWizardPage() {
050: return wizardPage;
051: }
052:
053: /**
054: * @param wizardPage The parent wizardPage for this Attachment
055: */
056: public void setWizardPage(WizardPage wizardPage) {
057: this .wizardPage = wizardPage;
058: }
059:
060: /* (non-Javadoc)
061: * @see java.lang.Object#equals(java.lang.Object)
062: */
063: public boolean equals(Object other) {
064: if (other == this )
065: return true;
066: if (other == null || !(other instanceof Attachment))
067: return false;
068: //TODO need better equals method
069:
070: Attachment att = (Attachment) other;
071: if (this .getArtifactId().equals(att.getArtifactId())
072: && this .getWizardPage().getVirtualId().equals(
073: att.getWizardPage().getVirtualId()))
074: return true;
075: //if (getId() == null && getNewId() != null && att.getId() == null &&
076: // att.getNewId() != null) return (this.getNewId().equals(att.getNewId()));
077: if (getVirtualId() == null && att.getVirtualId() != null)
078: return false;
079: if (getVirtualId() != null && att.getVirtualId() == null)
080: return false;
081: return (this .getVirtualId().equals(att.getVirtualId()));
082:
083: }
084:
085: /* (non-Javadoc)
086: * @see java.lang.Object#hashCode()
087: */
088: public int hashCode() {
089: //TODO need better hashcode
090: Id id = this .getVirtualId();
091: if (id == null)
092: return 0;
093: return id.getValue().hashCode();
094: }
095: /*
096: public String toString() {
097: return "<Cell id:" + this.wizardPage.getId() + ", artifactId:" + this.getArtifactId() + "]>";
098: }
099: */
100: }
|