001: /**********************************************************************************
002: * $URL:https://source.sakaiproject.org/svn/osp/trunk/wizard/tool/src/java/org/theospi/portfolio/wizard/tool/DecoratedCompletedWizard.java $
003: * $Id:DecoratedCompletedWizard.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.wizard.tool;
021:
022: import java.util.List;
023:
024: import org.sakaiproject.metaobj.shared.model.Agent;
025: import org.theospi.portfolio.review.model.Review;
026: import org.theospi.portfolio.wizard.model.CompletedWizard;
027:
028: /**
029: * Created by IntelliJ IDEA.
030: * User: John Ellis
031: * Date: Jan 23, 2006
032: * Time: 5:51:07 PM
033: * To change this template use File | Settings | File Templates.
034: */
035: public class DecoratedCompletedWizard {
036:
037: private WizardTool parent;
038: private DecoratedWizard wizard;
039: private CompletedWizard base;
040: private DecoratedCompletedCategory rootCategory;
041:
042: private List reflections = null;
043: private List evaluations = null;
044: private List reviews = null;
045:
046: private int submittedPages = 0;
047:
048: public DecoratedCompletedWizard() {
049: }
050:
051: public DecoratedCompletedWizard(WizardTool parent,
052: DecoratedWizard wizard, CompletedWizard base) {
053: this .parent = parent;
054: this .wizard = wizard;
055: this .base = base;
056: if (base != null) {
057: setRootCategory(new DecoratedCompletedCategory(parent,
058: wizard.getRootCategory(), base.getRootCategory()));
059: setSubmittedPages(parent.getWizardManager()
060: .getSubmittedPageCount(base));
061: }
062: }
063:
064: public WizardTool getParent() {
065: return parent;
066: }
067:
068: public void setParent(WizardTool parent) {
069: this .parent = parent;
070: }
071:
072: public DecoratedWizard getWizard() {
073: return wizard;
074: }
075:
076: public void setWizard(DecoratedWizard wizard) {
077: this .wizard = wizard;
078: }
079:
080: public CompletedWizard getBase() {
081: return base;
082: }
083:
084: public void setBase(CompletedWizard base) {
085: this .base = base;
086: }
087:
088: public DecoratedCompletedCategory getRootCategory() {
089: return rootCategory;
090: }
091:
092: public void setRootCategory(DecoratedCompletedCategory rootCategory) {
093: this .rootCategory = rootCategory;
094: }
095:
096: public String processSubmitWizard() {
097: getParent().processSubmitWizard(getBase());
098: return "submitted";
099: }
100:
101: public List getReflections() {
102: if (reflections == null) {
103: reflections = getParent().getReviewManager()
104: .getReviewsByParentAndType(
105: getBase().getId().getValue(),
106: Review.REFLECTION_TYPE,
107: getBase().getWizard().getSiteId(),
108: getParent().getWizardManager()
109: .getWizardEntityProducer());
110: }
111: return reflections;
112: }
113:
114: public List getEvaluations() {
115: if (evaluations == null) {
116: evaluations = getParent().getReviewManager()
117: .getReviewsByParentAndType(
118: getBase().getId().getValue(),
119: Review.EVALUATION_TYPE,
120: getBase().getWizard().getSiteId(),
121: getParent().getWizardManager()
122: .getWizardEntityProducer());
123: }
124: return evaluations;
125: }
126:
127: public List getReviews() {
128: if (reviews == null) {
129: reviews = getParent().getReviewManager()
130: .getReviewsByParentAndType(
131: getBase().getId().getValue(),
132: Review.FEEDBACK_TYPE,
133: getBase().getWizard().getSiteId(),
134: getParent().getWizardManager()
135: .getWizardEntityProducer());
136: }
137: return reviews;
138: }
139:
140: public boolean getIsReadOnly() {
141: Agent completedWizardAgent = getBase().getOwner();
142: Agent currentAgent = getParent().getAuthManager().getAgent();
143: return !completedWizardAgent.equals(currentAgent);
144: }
145:
146: public int getSubmittedPages() {
147: return submittedPages;
148: }
149:
150: public void setSubmittedPages(int submittedPages) {
151: this.submittedPages = submittedPages;
152: }
153: }
|