001/*
002 * Copyright 2014 The Kuali Foundation Licensed under the
003 * Educational Community License, Version 2.0 (the "License"); you may
004 * not use this file except in compliance with the License. You may
005 * obtain a copy of the License at
006 *
007 * http://www.osedu.org/licenses/ECL-2.0
008 *
009 * Unless required by applicable law or agreed to in writing,
010 * software distributed under the License is distributed on an "AS IS"
011 * BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express
012 * or implied. See the License for the specific language governing
013 * permissions and limitations under the License.
014 */
015package org.kuali.student.ap.academicplan.service;
016
017import org.kuali.student.ap.academicplan.constants.AcademicPlanServiceConstants;
018import org.kuali.student.ap.academicplan.dto.LearningPlanInfo;
019import org.kuali.student.ap.academicplan.dto.PlanItemInfo;
020import org.kuali.student.r2.common.dto.ContextInfo;
021import org.kuali.student.r2.common.dto.StatusInfo;
022import org.kuali.student.r2.common.dto.ValidationResultInfo;
023import org.kuali.student.r2.common.exceptions.*;
024
025
026import javax.jws.WebParam;
027import javax.jws.WebService;
028import javax.jws.soap.SOAPBinding;
029import java.util.List;
030
031
032/**
033 * Provides a means for students to plan an academic career.
034 * <p/>
035 * It designed to allow the student to:
036 * <p/>
037 * <ul>
038 * <li>Search for courses [...or, requirements, certifications, etc.] by subject course code, keyword, and to selective
039 *      narrow a search result by a plethora of categories (e.g. subj code, course # level, gen-end rqmts,....)</li>
040 * <li>Select courses and add to their plan, or to a "bookmark" list</li>
041 * <li>Adopt a learning template plan</li>
042 * <li>View of courses already taken and credits/grade recieved for each, directly within their plan</li>
043 * <li>Share a plan (...or part thereof) with an Advisor for review/comment/recommendation</li>
044 * <li>Run degree audit on a plan</li>
045 * <li>Select courses for doing a what if audit</li>
046 * <li>Creating multiple plans (pathways) to meet program goals</li>
047 * <li>Build out a detailed class schedule that may be used to feed registration (i.e. ...to make  a "registration
048 *      request")</li>
049 * <li>Use an interface to the program / learning objectives (degree/major/minor/certificate/...) in which
050 *      they are enrolled, or for which they may wish to consider in a "what if" planning scenario (e.g. when running
051 *      degree audit)</li>
052 * </ul>
053 * @author Kuali Student Team (ks-collab@kuali.org)
054 * @version 1.0 (Dev)
055 */
056@WebService(name = "AcademicPlanService", serviceName = "AcademicPlanService", portName = "AcademicPlanService",
057        targetNamespace = AcademicPlanServiceConstants.NAMESPACE)
058@SOAPBinding(style = SOAPBinding.Style.DOCUMENT, use = SOAPBinding.Use.LITERAL,
059        parameterStyle = SOAPBinding.ParameterStyle.WRAPPED)
060public interface AcademicPlanService {
061
062    /**
063     * Retrieve learning plan by it's Id
064     *
065     * @param learningPlanId plan id
066     * @param context service call context, including: date-time of call, id of user executing the call
067     * @return requested learning plan
068     * @throws DoesNotExistException     a learning plan having the passed in Id was not found
069     * @throws InvalidParameterException a passed in parameter value is invalid
070     * @throws MissingParameterException a passed in parameter value is missing or null
071     * @throws OperationFailedException  unable to complete request
072     */
073    public LearningPlanInfo getLearningPlan(@WebParam(name = "learningPlanId") String learningPlanId,
074            @WebParam(name = "context") ContextInfo context)
075            throws DoesNotExistException, InvalidParameterException, MissingParameterException,
076                   OperationFailedException, PermissionDeniedException;
077
078    /**
079     * Retrieve a set of learning plans that match the passed in list of plan ids
080     *
081     * @param learningPlanIds list of ids of plans to retrieve
082     * @param context service call context, including: date-time of call, id of user executing the call
083     * @return set of learning plans that match the passed in list of plan ids
084     * @throws InvalidParameterException a passed in parameter value is invalid
085     * @throws MissingParameterException a passed in parameter value is missing or null
086     * @throws OperationFailedException  unable to complete request
087     * @throws PermissionDeniedException the user specified in the contextInfo is not authorized to perform the
088     *                                   retrieval requested
089     */
090    public List<LearningPlanInfo> getLearningPlansByIds(
091            @WebParam(name = "learningPlanIds") List<String> learningPlanIds,
092            @WebParam(name = "context") ContextInfo context)
093    throws InvalidParameterException, MissingParameterException, OperationFailedException, PermissionDeniedException;
094
095    /**
096     * Retrieve plan item that matches the passed in plan item id
097     *
098     * @param planItemId id of plan item to be retrieved
099     * @param context service call context, including: date-time of call, id of user executing the call
100     * @return plan item matching the passed in plan item id
101     * @throws DoesNotExistException     a plan item having the passed in Id was not found
102     * @throws InvalidParameterException a passed in parameter value is invalid
103     * @throws MissingParameterException a passed in parameter value is missing or null
104     * @throws OperationFailedException  unable to complete request
105     */
106    public PlanItemInfo getPlanItem(@WebParam(name = "planItemId") String planItemId,
107            @WebParam(name = "context") ContextInfo context)
108            throws DoesNotExistException, InvalidParameterException, MissingParameterException,
109                   OperationFailedException, PermissionDeniedException;
110
111    /**
112     * Retrieve a list of plan items matching the passed in ids
113     *
114     * @param planItemIds list of plan item ids
115     * @param context service call context, including: date-time of call, id of user executing the call
116     * @return a list of plan items matching the passed in ids
117     * @throws InvalidParameterException a passed in parameter value is invalid
118     * @throws MissingParameterException a passed in parameter value is missing or null
119     * @throws OperationFailedException  unable to complete request
120     */
121    public List<PlanItemInfo> getPlanItemsByIds(@WebParam(name = "planItemIds") List<String> planItemIds,
122            @WebParam(name = "context") ContextInfo context)
123            throws InvalidParameterException, MissingParameterException, OperationFailedException,
124                   PermissionDeniedException;
125
126    /**
127     * Retrieve a list of plan items in a specific plan, by plan item type
128     *
129     * @param learningPlanId id of learning plan for which items are to be retrieved
130     * @param planItemTypeKey key of plan item type
131     * @param context service call context, including: date-time of call, id of user executing the call
132     * @return a list of plan items for the indicated plan id and item type
133     * @throws InvalidParameterException a passed in parameter value is invalid
134     * @throws MissingParameterException a passed in parameter value is missing or null
135     * @throws OperationFailedException  unable to complete request
136     */
137    public List<PlanItemInfo> getPlanItemsInPlanByType(@WebParam(name = "learningPlanId") String learningPlanId,
138            @WebParam(name = "planItemTypeKey") String planItemTypeKey,
139            @WebParam(name = "context") ContextInfo context)
140            throws InvalidParameterException, MissingParameterException, OperationFailedException,
141                   PermissionDeniedException;
142
143    /**
144     * Retrieve a list of plan items in a specific plan, by item category
145     *
146     * @param learningPlanId id of learning plan for which items are to be retrieved
147     * @param category the category (e.g. planned, bookmarked, backup) of items to be retrieved
148     * @param context service call context, including: date-time of call, id of user executing the call
149     * @return a list of plan items for the indicated plan id and category
150     * @throws InvalidParameterException a passed in parameter value is invalid
151     * @throws MissingParameterException a passed in parameter value is missing or null
152     * @throws OperationFailedException  unable to complete request
153     */
154    public List<PlanItemInfo> getPlanItemsInPlanByCategory(@WebParam(name = "learningPlanId") String learningPlanId,
155            @WebParam(name = "category") AcademicPlanServiceConstants.ItemCategory category,
156            @WebParam(name = "context") ContextInfo context)
157            throws InvalidParameterException, MissingParameterException, OperationFailedException,
158                   PermissionDeniedException;
159
160    /**
161     * retrieve all items for the indicated plan
162     *
163     * @param learningPlanId id of plan for which items are to be retrieved
164     * @param context service call context, including: date-time of call, id of user executing the call
165     * @return a list of plan items for the indcated plan id
166     * @throws InvalidParameterException a passed in parameter value is invalid
167     * @throws MissingParameterException a passed in parameter value is missing or null
168     * @throws OperationFailedException  unable to complete request
169     */
170    public List<PlanItemInfo> getPlanItemsInPlan(@WebParam(name = "learningPlanId") String learningPlanId,
171            @WebParam(name = "context") ContextInfo context)
172            throws InvalidParameterException, MissingParameterException, OperationFailedException,
173                   PermissionDeniedException;
174
175    /**
176     * Retrieve a list of plan items that are planned for the indicated academic term and in the indicated category
177     * category
178     *
179     * @param learningPlanId id of learning plan for which items are to be retrieved
180     * @param termId id of the academic term for which items are to be retrieved
181     * @param category the category (e.g. planned, bookmarked, backup) of items to be retrieved
182     * @param context service call context, including: date-time of call, id of user executing the call
183     * @return a list of plan items for the indicated plan id, term id, and item category
184     * @throws InvalidParameterException a passed in parameter value is invalid
185     * @throws MissingParameterException a passed in parameter value is missing or null
186     * @throws OperationFailedException  unable to complete request
187     */
188    public List<PlanItemInfo> getPlanItemsInPlanByTermIdByCategory(
189            @WebParam(name = "learningPlanId") String learningPlanId,
190            @WebParam(name = "termId") String termId,
191            @WebParam(name = "category") AcademicPlanServiceConstants.ItemCategory category,
192            @WebParam(name = "context") ContextInfo context)
193            throws InvalidParameterException, MissingParameterException, OperationFailedException,
194                   PermissionDeniedException;
195
196    /**
197     * @param learningPlanId id of learning plan for which items are to be retrieved
198     * @param termId id of the academic term for which items are to be retrieved
199     * @param categories the list of categories (e.g. planned, bookmarked, backup) of items to be retrieved
200     * @param context service call context, including: date-time of call, id of user executing the call
201     * @return a list of plan items for the indicated plan id, term id, and item category
202     * @throws InvalidParameterException a passed in parameter value is invalid
203     * @throws MissingParameterException a passed in parameter value is missing or null
204     * @throws OperationFailedException  unable to complete request
205     */
206    public List<PlanItemInfo> getPlanItemsByPlanTermAndCategories(
207            @WebParam(name = "learningPlanId") String learningPlanId,
208            @WebParam(name = "termId") String termId,
209            @WebParam(name = "categories") List<AcademicPlanServiceConstants.ItemCategory> categories,
210            @WebParam(name = "context") ContextInfo context)
211            throws InvalidParameterException, MissingParameterException, OperationFailedException,
212                   PermissionDeniedException;
213
214    /**
215     * Gets plan items for the indicated reference object id and reference object type
216     *
217     * @param learningPlanId The id of the plan.
218     * @param refObjectId    The id of the referenced object.
219     * @param refObjectType  The type of the referenced object.
220     * @param context service call context, including: date-time of call, id of user executing the call
221     * @return a list of plan items for the indicated plan id, reference object id, and reference object type
222     * @throws InvalidParameterException a passed in parameter value is invalid
223     * @throws MissingParameterException a passed in parameter value is missing or null
224     * @throws OperationFailedException  unable to complete request
225     */
226    public List<PlanItemInfo> getPlanItemsInPlanByRefObjectIdByRefObjectType(
227            @WebParam(name = "learningPlanId")String learningPlanId,
228            @WebParam(name = "refObjectId") String refObjectId,
229            @WebParam(name = "refObjectType") String refObjectType,
230            @WebParam(name = "context") ContextInfo context)
231            throws InvalidParameterException, MissingParameterException, OperationFailedException,
232                   PermissionDeniedException;
233
234    /**
235     * Get learning plans for the indicated student and of the indicated plan type
236     *
237     * @param studentId id of student for which learning plans are to be retrieved
238     * @param planTypeKey key for type of plans to be retrieved
239     * @param context service call context, including: date-time of call, id of user executing the call
240     * @return a list of learning plans for the indicated student and plan type
241     * @throws InvalidParameterException a passed in parameter value is invalid
242     * @throws MissingParameterException a passed in parameter value is missing or null
243     * @throws OperationFailedException  unable to complete request
244     */
245    public List<LearningPlanInfo> getLearningPlansForStudentByType(@WebParam(name = "studentId") String studentId,
246            @WebParam(name = "planTypeKey") String
247                    planTypeKey,
248            @WebParam(name = "context") ContextInfo context)
249            throws InvalidParameterException, MissingParameterException, OperationFailedException,
250                   PermissionDeniedException;
251
252    /**
253     * create learning plan
254     *
255     * @param learningPlan learning plan to be created
256     * @param context service call context, including: date-time of call, id of user executing the call
257     * @return the newly created learning plan (...includes the newly assigned learningPlanId)
258     * @throws AlreadyExistsException a learning plan with the indicated plan id already exists
259     * @throws DataValidationErrorException a data item of the learning plan is invalid
260     * @throws InvalidParameterException a passed in parameter value is invalid
261     * @throws MissingParameterException a passed in parameter value is missing or null
262     * @throws OperationFailedException  unable to complete request
263     * @throws PermissionDeniedException the user (context.getUserId()) is not authorized to perform this operation
264     */
265    public LearningPlanInfo createLearningPlan(@WebParam(name = "learningPlan") LearningPlanInfo learningPlan,
266            @WebParam(name = "context") ContextInfo context)
267    throws AlreadyExistsException, DataValidationErrorException, InvalidParameterException,
268            MissingParameterException, OperationFailedException, PermissionDeniedException;
269
270    /**
271     * create plan item
272     *
273     *
274     * @param planItem item to be created
275     * @param context service call context, including: date-time of call, id of user executing the call
276     * @return the newly created learning plan (...includes the newly assigned learningPlanId)
277     * @throws AlreadyExistsException a plan item with the indicated id already exists
278     * @throws DataValidationErrorException a data item of the plan item is invalid
279     * @throws InvalidParameterException a passed in parameter value is invalid
280     * @throws MissingParameterException a passed in parameter value is missing or null
281     * @throws OperationFailedException  unable to complete request
282     * @throws PermissionDeniedException the user (context.getUserId()) is not authorized to perform this operation
283     */
284    public PlanItemInfo createPlanItem(@WebParam(name = "planItem") PlanItemInfo planItem,
285            @WebParam(name = "context") ContextInfo context)
286            throws AlreadyExistsException, DataValidationErrorException, InvalidParameterException,
287            MissingParameterException, OperationFailedException, PermissionDeniedException;
288
289    /**
290     * update learning plan
291     *
292     * @param learningPlanId id of learning plan to be updated
293     * @param learningPlan updated learning plan to be persisted
294     * @param context service call context, including: date-time of call, id of user executing the call
295     * @return the updated learning plan
296     * @throws DataValidationErrorException a data item of the passed in learning plan is invalid
297     * @throws InvalidParameterException a passed in parameter value is invalid
298     * @throws MissingParameterException a passed in parameter value is missing or null
299     * @throws OperationFailedException  unable to complete request
300     * @throws PermissionDeniedException the user (context.getUserId()) is not authorized to perform this operation
301     * @throws DoesNotExistException a learning plan does not exist having the indicated plan id
302     * @throws VersionMismatchException the version on the passed in plan was out of sync with the last saved version
303     */
304    public LearningPlanInfo updateLearningPlan(@WebParam(name = "learningPlanId") String learningPlanId,
305            @WebParam(name = "learningPlan") LearningPlanInfo learningPlan,
306            @WebParam(name = "context") ContextInfo context)
307    throws DataValidationErrorException, InvalidParameterException, MissingParameterException,
308           OperationFailedException, PermissionDeniedException, DoesNotExistException, VersionMismatchException;
309
310    /**
311     * update learning plan item
312     *
313     * @param planItemId id of the plan item to be udpated
314     * @param planItem item to be persisted
315     * @param context service call context, including: date-time of call, id of user executing the call
316     * @return the updated plan item
317     * @throws DataValidationErrorException a data item of the passed in plan item is invalid
318     * @throws InvalidParameterException a passed in parameter value is invalid
319     * @throws MissingParameterException a passed in parameter value is missing or null
320     * @throws OperationFailedException  unable to complete request
321     * @throws PermissionDeniedException the user (context.getUserId()) is not authorized to perform this operation
322     * @throws DoesNotExistException a learning plan does not exist having the indicated plan id
323     * @throws VersionMismatchException the version on the passed in plan was out of sync with the last saved version
324     */
325    public PlanItemInfo updatePlanItem(@WebParam(name = "planItemId") String planItemId,
326            @WebParam(name = "planItem") PlanItemInfo planItem,
327            @WebParam(name = "context") ContextInfo context)
328            throws DataValidationErrorException, InvalidParameterException, MissingParameterException,
329            OperationFailedException, PermissionDeniedException, DoesNotExistException, VersionMismatchException;
330
331    /**
332     * delete the indicated learning plan
333     * @param learningPlanId id of plan to be deleted
334     * @param context service call context, including: date-time of call, id of user executing the call
335     * @return StatusInfo status of delete:  where StatusInfo.isSuccess() is true only if the delete was successful
336     *                                       and StatusInfo.getMessage() contains a textual description of the status
337     * @throws DoesNotExistException a plan item does not exist having the indicated id
338     * @throws InvalidParameterException a passed in parameter value is invalid
339     * @throws MissingParameterException a passed in parameter value is missing or null
340     * @throws OperationFailedException  unable to complete request
341     * @throws PermissionDeniedException the user (context.getUserId()) is not authorized to perform this operation
342     */
343    public StatusInfo deleteLearningPlan(@WebParam(name = "learningPlanId") String learningPlanId,
344            @WebParam(name = "context") ContextInfo context)
345    throws DoesNotExistException, InvalidParameterException, MissingParameterException, OperationFailedException,
346            PermissionDeniedException;
347
348    /**
349     * delete the indicated learning plan
350     * @param planItemId id of plan item to be deleted
351     * @param context service call context, including: date-time of call, id of user executing the call
352     * @return StatusInfo status of delete:  where StatusInfo.isSuccess() is true only if the delete was successful
353     *                                       and StatusInfo.getMessage() contains a textual description of the status
354     * @throws DoesNotExistException a plan item does not exist having the indicated id
355     * @throws InvalidParameterException a passed in parameter value is invalid
356     * @throws MissingParameterException a passed in parameter value is missing or null
357     * @throws OperationFailedException  unable to complete request
358     * @throws PermissionDeniedException the user (context.getUserId()) is not authorized to perform this operation
359     */
360    public StatusInfo deletePlanItem(@WebParam(name = "planItemId") String planItemId,
361            @WebParam(name = "context") ContextInfo context)
362    throws DoesNotExistException, InvalidParameterException, MissingParameterException, OperationFailedException, PermissionDeniedException;
363
364    /**
365     * validate the passed in learning plan
366     * @param validationType must be one of: "FULL_VALIDATION", "SKIP_REQUREDNESS_VALIDATIONS", see: DataDictionaryValidator
367     * @param learningPlanInfo the learning plan object to be validated
368     * @param context service call context, including: date-time of call, id of user executing the call
369     * @return a list of validation results (multiple validation issues may exist)
370     * @throws DoesNotExistException a plan does not exist having the indicated id
371     * @throws InvalidParameterException a passed in parameter value is invalid
372     * @throws MissingParameterException a passed in parameter value is missing or null
373     * @throws OperationFailedException  unable to complete request
374     */
375    public List<ValidationResultInfo> validateLearningPlan(@WebParam(name = "validationType") String validationType,
376            @WebParam(name = "learningPlanInfo") LearningPlanInfo learningPlanInfo,
377            @WebParam(name = "context") ContextInfo context)
378            throws DoesNotExistException, InvalidParameterException, MissingParameterException,
379                   OperationFailedException, PermissionDeniedException;
380
381    /**
382     * validate the passed in plan item
383     *
384     * @param validationType must be one of: "FULL_VALIDATION", "SKIP_REQUREDNESS_VALIDATIONS", see: DataDictionaryValidator
385     * @param planItemInfo the learning plan item to be validated
386     * @param context service call context, including: date-time of call, id of user executing the call
387     * @return a list of validation results (multiple validation issues may exist)
388     * @throws DoesNotExistException a plan item does not exist having the incated id
389     * @throws InvalidParameterException a passed in parameter value is invalid
390     * @throws MissingParameterException a passed in parameter value is missing or null
391     * @throws OperationFailedException  unable to complete request
392     * @throws AlreadyExistsException
393     */
394    public List<ValidationResultInfo> validatePlanItem(@WebParam(name = "validationType") String validationType,
395            @WebParam(name = "planItemInfo") PlanItemInfo planItemInfo,
396            @WebParam(name = "context") ContextInfo context)
397            throws DoesNotExistException, InvalidParameterException, MissingParameterException,
398                   OperationFailedException, PermissionDeniedException;
399}