001: /**********************************************************************************
002: * $URL:https://source.sakaiproject.org/svn/osp/trunk/common/api/src/java/org/theospi/portfolio/guidance/model/Guidance.java $
003: * $Id:Guidance.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.guidance.model;
021:
022: import org.sakaiproject.metaobj.shared.model.Id;
023: import org.sakaiproject.metaobj.shared.model.IdentifiableObject;
024:
025: import java.io.Serializable;
026: import java.util.ArrayList;
027: import java.util.Iterator;
028: import java.util.List;
029:
030: /**
031: * Created by IntelliJ IDEA.
032: * User: John Ellis
033: * Date: Nov 11, 2005
034: * Time: 12:06:22 PM
035: * To change this template use File | Settings | File Templates.
036: */
037: public class Guidance extends IdentifiableObject implements
038: Serializable {
039:
040: public final static String INSTRUCTION_TYPE = "instruction";
041: public final static String EXAMPLE_TYPE = "example";
042: public final static String RATIONALE_TYPE = "rationale";
043:
044: private String description;
045: private String siteId;
046: private Id securityQualifier;
047: private String securityViewFunction;
048: private String securityEditFunction;
049:
050: private List items;
051:
052: private boolean newObject = false;
053:
054: private static final long serialVersionUID = 7834424504411509616L;
055:
056: public Guidance() {
057: }
058:
059: public Guidance(Id id, String description, String siteId,
060: Id securityQualifier, String securityViewFunction,
061: String securityEditFunction) {
062: this .description = description;
063: this .siteId = siteId;
064: this .securityQualifier = securityQualifier;
065: this .securityViewFunction = securityViewFunction;
066: this .securityEditFunction = securityEditFunction;
067: setId(id);
068: newObject = true;
069: items = new ArrayList();
070: }
071:
072: public String getDescription() {
073: return description;
074: }
075:
076: public void setDescription(String description) {
077: this .description = description;
078: }
079:
080: public String getSiteId() {
081: return siteId;
082: }
083:
084: public void setSiteId(String siteId) {
085: this .siteId = siteId;
086: }
087:
088: public Id getSecurityQualifier() {
089: return securityQualifier;
090: }
091:
092: public void setSecurityQualifier(Id securityQualifier) {
093: this .securityQualifier = securityQualifier;
094: }
095:
096: public String getSecurityViewFunction() {
097: return securityViewFunction;
098: }
099:
100: public void setSecurityViewFunction(String securityViewFunction) {
101: this .securityViewFunction = securityViewFunction;
102: }
103:
104: public String getSecurityEditFunction() {
105: return securityEditFunction;
106: }
107:
108: public void setSecurityEditFunction(String securityEditFunction) {
109: this .securityEditFunction = securityEditFunction;
110: }
111:
112: public List getItems() {
113: return items;
114: }
115:
116: public void setItems(List items) {
117: this .items = items;
118: }
119:
120: public GuidanceItem getItem(String type) {
121: for (Iterator i = getItems().iterator(); i.hasNext();) {
122: GuidanceItem item = (GuidanceItem) i.next();
123: if (item.getType().equals(type)) {
124: return item;
125: }
126: }
127: return null;
128: }
129:
130: public GuidanceItem getInstruction() {
131: return getItem(INSTRUCTION_TYPE);
132: }
133:
134: public GuidanceItem getExample() {
135: return getItem(EXAMPLE_TYPE);
136: }
137:
138: public GuidanceItem getRationale() {
139: return getItem(RATIONALE_TYPE);
140: }
141:
142: public boolean isNewObject() {
143: return newObject;
144: }
145:
146: public void setNewObject(boolean newObject) {
147: this.newObject = newObject;
148: }
149:
150: }
|