001: /**********************************************************************************
002: * $URL: https://source.sakaiproject.org/svn/osp/tags/sakai_2-4-1/wizard/api/src/java/org/theospi/portfolio/wizard/mgt/WizardManager.java $
003: * $Id: WizardManager.java 22351 2007-03-09 14:11:59Z bkirschn@umich.edu $
004: ***********************************************************************************
005: *
006: * Copyright (c) 2005, 2006, 2007 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.mgt;
021:
022: import java.util.Collection;
023: import java.util.List;
024:
025: import org.sakaiproject.entity.api.Reference;
026: import org.sakaiproject.exception.ImportException;
027: import org.sakaiproject.exception.UnsupportedFileTypeException;
028: import org.sakaiproject.metaobj.shared.model.Agent;
029: import org.sakaiproject.metaobj.shared.model.Id;
030: import org.theospi.portfolio.matrix.model.WizardPageDefinition;
031: import org.theospi.portfolio.shared.mgt.WorkflowEnabledManager;
032: import org.theospi.portfolio.wizard.model.CompletedWizard;
033: import org.theospi.portfolio.wizard.model.Wizard;
034: import org.theospi.portfolio.wizard.model.WizardPageSequence;
035:
036: public interface WizardManager extends WorkflowEnabledManager {
037:
038: public static final int WIZARD_NO_CHECK = 0;
039:
040: public static final int WIZARD_OPERATE_CHECK = 10;
041:
042: public static final int WIZARD_VIEW_CHECK = 20;
043:
044: public static final int WIZARD_EDIT_CHECK = 30;
045:
046: public static final int WIZARD_EXPORT_CHECK = 40;
047:
048: public static final int WIZARD_DELETE_CHECK = 50;
049:
050: public static final String WIZARD_PARAM_ID = "wizardId";
051:
052: public static final String EXPOSED_WIZARD_KEY = "osp.exposedwizard.wizard.id";
053:
054: /**
055: * Checks if the current user is authorized to review all the types of
056: * Reviews. If the user is the owner or the user is authorized then the
057: * Reviews are read in and pushed into the security advisor.
058: *
059: * @param id
060: * Id of the wizard to check
061: */
062: public void checkWizardAccess(Id id);
063:
064: /**
065: * creates a new Wizard in the current site owned by the current user
066: *
067: * @return Wizard
068: */
069: public Wizard createNew();
070:
071: public Reference decorateReference(Wizard wizard, String reference);
072:
073: public void deleteObjects(List deletedItems);
074:
075: /**
076: * Removes a wizard from storage
077: *
078: * @param wizard
079: */
080: public void deleteWizard(Wizard wizard);
081:
082: /**
083: * Unlock resources and delete completed wizards from a preview wizard
084: */
085: public void deletePreviewWizardData(Wizard wizard);
086:
087: /**
088: *
089: * @param sites
090: * A list of site Ids (Strings)
091: * @return
092: */
093: public List findPublishedWizards(List sites);
094:
095: public List findPublishedWizards(String siteId);
096:
097: public List findPublishedWizards(List sites, boolean lazy);
098:
099: /**
100: ** Find all WizardPageSequence objects associated with this wizard
101: ** (e.g. useful for unlocking associated resources prior
102: ** to deleting wizard).
103: **/
104: public List findPagesByWizard(Id wizardId);
105:
106: /**
107: * Method to get each wizard page definition for the site identified by the
108: * given site identifier. The wizard page definitions are not loaded with
109: * their wizard pages.
110: *
111: * @param siteId
112: * The identifier of the site.
113: * @return A list of wizard page definitions for this site.
114: */
115: public List<WizardPageDefinition> findWizardPageDefs(
116: final String siteId);
117:
118: /**
119: * Method to get each wizard page definition for the site identified by the
120: * given site identifier, optionally loading each with it's wizard pages.
121: *
122: * @param siteId
123: * The identifier of the site.
124: * @param deep
125: * True if each wizard page definition should be loaded with it's
126: * wizard pages.
127: * @return A list of wizard page definitions for this site.
128: */
129: public List<WizardPageDefinition> findWizardPageDefs(
130: final String siteId, final boolean deep);
131:
132: public List findWizardsByOwner(String ownerId, String siteId);
133:
134: public Collection getAvailableForms(String siteId, String type);
135:
136: public CompletedWizard getCompletedWizard(Id completedWizardId);
137:
138: public CompletedWizard getCompletedWizard(Wizard wizard);
139:
140: public CompletedWizard getCompletedWizard(Wizard wizard,
141: String userId);
142:
143: public CompletedWizard getCompletedWizard(Wizard wizard,
144: String userId, boolean create);
145:
146: public CompletedWizard getCompletedWizardByPage(Id pageId);
147:
148: public List getCompletedWizardPagesByPageDef(Id id);
149:
150: public List getCompletedWizardsByWizardId(String wizardId);
151:
152: /**
153: * Given a user's completed wizard this takes a look at the number of
154: * submitted pages (not in the READY state)
155: *
156: * @param wizard
157: * CompletedWizard to tally the number of submitted pages
158: * @return int
159: */
160: public int getSubmittedPageCount(CompletedWizard wizard);
161:
162: /**
163: * Gets the total number of pages for the given wizard
164: *
165: * @param wizard
166: * Wizard to tally the number of pages
167: * @return int
168: */
169: public int getTotalPageCount(Wizard wizard);
170:
171: /**
172: * Gets a wizard given its id. This performs a check on the operate
173: * permission
174: *
175: * @param Id
176: * wizardId
177: * @return Wizard
178: */
179: public Wizard getWizard(Id wizardId);
180:
181: /**
182: * gets a wizard given its id. it may perform a check on the view permission
183: * if the checkAuthz is true
184: *
185: * @param Id
186: * wizardId
187: * @param boolean
188: * checkAuthz
189: * @return
190: */
191: public Wizard getWizard(Id wizardId, int checkAuthz);
192:
193: /**
194: * Gets a wizard given its id. This performs a check on the view permission
195: *
196: * @param String
197: * wizardId
198: * @return Wizard
199: */
200: public Wizard getWizard(String id);
201:
202: /**
203: * gets a wizard given its id. it performs a check on the permission
204: * specified in checkAuthz: WIZARD_NO_CHECK, WIZARD_OPERATE_CHECK,
205: * WIZARD_VIEW_CHECK WIZARD_EDIT_CHECK, WIZARD_EXPORT_CHECK,
206: * WIZARD_DELETE_CHECK
207: *
208: * @param String
209: * wizardId
210: * @param boolean
211: * checkAuthz
212: * @return
213: */
214: public Wizard getWizard(String id, int checkAuthz);
215:
216: public String getWizardEntityProducer();
217:
218: /**
219: * This is the light weight method of getting the owner of a wizard given
220: * its id.
221: *
222: * @param Id
223: * wizardId
224: * @return Agent of the owner id
225: */
226: public Agent getWizardIdOwner(final Id wizardId);
227:
228: /**
229: * This is the light weight method of getting the site id of a wizard given
230: * its id.
231: *
232: * @param Id
233: * wizardId
234: * @return String of the site id
235: */
236: public String getWizardIdSiteId(final Id wizardId);
237:
238: /**
239: * Method to get the wizard page definition identified by the given
240: * identifier object. The wizard page definition is not loaded with it's
241: * wizard pages.
242: *
243: * @param id
244: * The identifier object that uniquely identifies the wizard page
245: * definition.
246: * @return The wizard page definition.
247: */
248: public WizardPageDefinition getWizardPageDefinition(Id id);
249:
250: /**
251: * Method to get the wizard page definition identified by the given
252: * identifier object, optionally loading it with it's wizard pages.
253: *
254: * @param id
255: * The identifier object that uniquely identifies the wizard page
256: * definition.
257: * @param deep
258: * True if the wizard page definition should be loaded with it's
259: * wizard pages.
260: * @return The wizard page definition.
261: */
262: public WizardPageDefinition getWizardPageDefinition(Id id,
263: boolean deep);
264:
265: public WizardPageSequence getWizardPageSeqByDef(Id id);
266:
267: /**
268: * Pulls all wizards, deeping loading all parts of each Wizard
269: *
270: * @return List of Wizard
271: */
272: public List getWizardsForWarehousing();
273:
274: public boolean importResource(Id worksite, String reference)
275: throws UnsupportedFileTypeException, ImportException;
276:
277: public List listAllWizardsByOwner(String owner, String siteId);
278:
279: public List listWizardsByType(String owner, String siteId,
280: String type);
281:
282: /**
283: * changes the settings on the wizard to make it available for preview
284: * to the users the site
285: *
286: * @param wizard
287: */
288: public void previewWizard(Wizard wizard);
289:
290: /**
291: * changes the settings on the wizard to make it available to the users of
292: * the site
293: *
294: * @param wizard
295: */
296: public void publishWizard(Wizard wizard);
297:
298: /**
299: * Saves a completed wizard into storage
300: *
301: * @param wizard
302: * CompletedWizard
303: * @return CompletedWizard
304: */
305: public CompletedWizard saveWizard(CompletedWizard wizard);
306:
307: /**
308: * Saves a Wizard to storage. It returns an updated wizard
309: *
310: * @param wizard
311: * @return Wizard
312: */
313: public Wizard saveWizard(Wizard wizard);
314:
315: }
|