001: /**********************************************************************************
002: * $URL: https://source.sakaiproject.org/svn/osp/tags/sakai_2-4-1/wizard/api/src/java/org/theospi/portfolio/wizard/model/WizardStyleItem.java $
003: * $Id: WizardStyleItem.java 10835 2006-06-17 03:25:03Z lance@indiana.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.wizard.model;
021:
022: import org.sakaiproject.content.api.ContentResource;
023: import org.sakaiproject.entity.api.Reference;
024: import org.sakaiproject.metaobj.shared.mgt.ReferenceHolder;
025: import org.sakaiproject.metaobj.shared.model.IdentifiableObject;
026:
027: /**
028: * Created by IntelliJ IDEA.
029: * User: John Ellis
030: * Date: Nov 11, 2005
031: * Time: 12:38:19 PM
032: * To change this template use File | Settings | File Templates.
033: */
034: public class WizardStyleItem extends IdentifiableObject {
035:
036: private Wizard wizard;
037: private ReferenceHolder baseReference;
038: private ReferenceHolder fullReference;
039:
040: public WizardStyleItem() {
041: }
042:
043: public WizardStyleItem(Wizard wizard, Reference baseReference,
044: Reference fullReference) {
045: this .wizard = wizard;
046: this .baseReference = new ReferenceHolder(baseReference);
047: this .fullReference = new ReferenceHolder(fullReference);
048: }
049:
050: public Wizard getWizard() {
051: return wizard;
052: }
053:
054: public void setWizard(Wizard wizard) {
055: this .wizard = wizard;
056: }
057:
058: public ReferenceHolder getBaseReference() {
059: return baseReference;
060: }
061:
062: public void setBaseReference(ReferenceHolder baseReference) {
063: this .baseReference = baseReference;
064: }
065:
066: public void setBaseReference(Reference baseReference) {
067: this .baseReference = new ReferenceHolder(baseReference);
068: }
069:
070: public ReferenceHolder getFullReference() {
071: return fullReference;
072: }
073:
074: public void setFullReference(Reference fullReference) {
075: this .fullReference = new ReferenceHolder(fullReference);
076: }
077:
078: public void setFullReference(ReferenceHolder fullReference) {
079: this .fullReference = fullReference;
080: }
081:
082: public String getDisplayName() {
083: ContentResource resource = (ContentResource) baseReference
084: .getBase().getEntity();
085:
086: String displayNameProp = resource.getProperties()
087: .getNamePropDisplayName();
088: return resource.getProperties().getProperty(displayNameProp);
089: }
090:
091: public boolean equals(Object o) {
092: if (this == o) {
093: return true;
094: }
095: if (!(o instanceof WizardStyleItem)) {
096: return false;
097: }
098:
099: final WizardStyleItem styleItem = (WizardStyleItem) o;
100:
101: if (fullReference != null ? !fullReference
102: .equals(styleItem.fullReference)
103: : styleItem.fullReference != null) {
104: return false;
105: }
106: if (wizard != null ? !wizard.equals(styleItem.wizard)
107: : styleItem.wizard != null) {
108: return false;
109: }
110:
111: return true;
112: }
113:
114: public int hashCode() {
115: int result = 0;
116: result = 29 * result + (wizard != null ? wizard.hashCode() : 0);
117: result = 29
118: * result
119: + (fullReference != null ? fullReference.hashCode() : 0);
120: return result;
121: }
122:
123: }
|