Classes in this File | Line Coverage | Branch Coverage | Complexity | ||||
StateService |
|
| 1.0;1 |
1 | /* | |
2 | * Copyright 2011 The Kuali Foundation Licensed under the Educational Community License, Version 1.0 (the "License"); you may | |
3 | * not use this file except in compliance with the License. You may obtain a copy of the License at | |
4 | * http://www.opensource.org/licenses/ecl1.php Unless required by applicable law or agreed to in writing, software | |
5 | * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either | |
6 | * express or implied. See the License for the specific language governing permissions and limitations under the License. | |
7 | */ | |
8 | package org.kuali.student.r2.common.service; | |
9 | ||
10 | import java.util.List; | |
11 | ||
12 | import javax.jws.WebParam; | |
13 | import javax.jws.WebService; | |
14 | import javax.jws.soap.SOAPBinding; | |
15 | ||
16 | import org.kuali.student.r2.common.dto.ContextInfo; | |
17 | import org.kuali.student.r2.common.dto.StateInfo; | |
18 | import org.kuali.student.r2.common.dto.StateProcessInfo; | |
19 | import org.kuali.student.r2.common.exceptions.DoesNotExistException; | |
20 | import org.kuali.student.r2.common.exceptions.InvalidParameterException; | |
21 | import org.kuali.student.r2.common.exceptions.MissingParameterException; | |
22 | import org.kuali.student.r2.common.exceptions.OperationFailedException; | |
23 | import org.kuali.student.r2.common.util.constants.StateServiceConstants; | |
24 | ||
25 | /** | |
26 | * Provides a read-only view of states and state flow information. | |
27 | * | |
28 | * This service needs to be implemented by any KS service that is going to handle states | |
29 | * | |
30 | * @version 1.0 (Dev) | |
31 | * | |
32 | * @author kamal | |
33 | */ | |
34 | @WebService(name = "StateService", targetNamespace = StateServiceConstants.NAMESPACE) | |
35 | @SOAPBinding(style = SOAPBinding.Style.DOCUMENT, use = SOAPBinding.Use.LITERAL, parameterStyle = SOAPBinding.ParameterStyle.WRAPPED) | |
36 | public interface StateService { | |
37 | ||
38 | ||
39 | /** | |
40 | * Get Process Information by Key | |
41 | * @param processKey the process key | |
42 | * @param context Context information containing the principalId and locale information about the caller of service operation | |
43 | * @return Information about State Process | |
44 | * @throws DoesNotExistException processKey not found | |
45 | * @throws InvalidParameterException invalid processKey | |
46 | * @throws MissingParameterException no process defined for that process Key | |
47 | * @throws OperationFailedException unable to complete request | |
48 | */ | |
49 | public StateProcessInfo getProcessByKey(@WebParam(name = "processKey") String processKey, @WebParam(name = "context") ContextInfo context) throws DoesNotExistException, InvalidParameterException, MissingParameterException, OperationFailedException; | |
50 | ||
51 | ||
52 | /** | |
53 | * This method retrieves the list of process keys associated with a type of object. | |
54 | * TODO: consider changing the name of this method to getProcessByRefObjectUri | |
55 | * | |
56 | * @param refObjectUri unique name for an object that states are attached | |
57 | * @param context Context information containing the principalId and locale information about the caller of service operation | |
58 | * @return List of process keys | |
59 | * @throws DoesNotExistException typeKey not found | |
60 | * @throws InvalidParameterException invalid typeKey | |
61 | * @throws MissingParameterException missing typeKey | |
62 | * @throws OperationFailedException unable to complete request | |
63 | */ | |
64 | public List<String> getProcessByObjectType(@WebParam(name = "refObjectUri") String refObjectUri, @WebParam(name = "context") ContextInfo context) throws DoesNotExistException, InvalidParameterException, MissingParameterException, OperationFailedException; | |
65 | ||
66 | /** | |
67 | * | |
68 | * This method returns information about a state for a given process. State keys can be reused and state key along with process key uniquely identifies the state instance within a process. | |
69 | * | |
70 | * @param processKey Key identifying the process | |
71 | * @param stateKey Key of the state | |
72 | * @param context Context information containing the principalId and locale information about the caller of service operation | |
73 | * @return Information about the state | |
74 | * @throws DoesNotExistException processKey, stateKey not found | |
75 | * @throws InvalidParameterException invalid processKey, stateKey | |
76 | * @throws MissingParameterException missing processKey, stateKey | |
77 | * @throws OperationFailedException unable to complete request | |
78 | */ | |
79 | public StateInfo getState(@WebParam(name = "processKey") String processKey, @WebParam(name = "stateKey") String stateKey, @WebParam(name = "context") ContextInfo context) throws DoesNotExistException, InvalidParameterException, MissingParameterException, OperationFailedException; | |
80 | ||
81 | /** | |
82 | * This method returns a list of States that belong to a process. For e.g Clu states for clu proposal process | |
83 | * | |
84 | * @param processKey Key identifying the process | |
85 | * @param context Context information containing the principalId and locale information about the caller of service operation | |
86 | * @return List of StateInfo objects associated with the process | |
87 | * @throws DoesNotExistException processKey not found | |
88 | * @throws InvalidParameterException invalid processKey | |
89 | * @throws MissingParameterException missing processKey | |
90 | * @throws OperationFailedException unable to complete request | |
91 | */ | |
92 | public List<StateInfo> getStatesByProcess(@WebParam(name = "processKey") String processKey, @WebParam(name = "context") ContextInfo context) throws DoesNotExistException, InvalidParameterException, MissingParameterException, OperationFailedException; | |
93 | ||
94 | /** | |
95 | * This method returns a list of StateInfo objects that are valid initial states for a given process. | |
96 | * | |
97 | * Often there will be just a single initial valid state. | |
98 | * | |
99 | * ? if more than one does the order matter? i.e. the 1st one returned should be the default but others still allowed? | |
100 | * | |
101 | * @param processKey Process key | |
102 | * @param context Context information containing the principalId and locale information about the caller of service operation | |
103 | * @return list of states are valid for the given process | |
104 | * @throws DoesNotExistException processKey not found | |
105 | * @throws InvalidParameterException invalid processKey | |
106 | * @throws MissingParameterException missing processKey | |
107 | * @throws OperationFailedException unable to complete request | |
108 | */ | |
109 | public List<StateInfo> getInitialValidStates(@WebParam(name = "processKey") String processKey, @WebParam(name = "context") ContextInfo context) throws DoesNotExistException, InvalidParameterException, MissingParameterException, OperationFailedException; | |
110 | ||
111 | ||
112 | /** | |
113 | * | |
114 | * This method retrieves the next happy state in a process given the current state. | |
115 | * | |
116 | * @param processKey Process key | |
117 | * @param currentStateKey Current state key | |
118 | * @param context Context information containing the principalId and locale information about the caller of service operation | |
119 | * @return Next happy state in the process | |
120 | * @throws DoesNotExistException processKey or currentStateKey not found | |
121 | * @throws InvalidParameterException invalid processKey or currentStateKey | |
122 | * @throws MissingParameterException missing processKey or currentStateKey | |
123 | * @throws OperationFailedException unable to complete request | |
124 | */ | |
125 | public StateInfo getNextHappyState(@WebParam(name = "processKey") String processKey, @WebParam(name = "currentStateKey") String currentStateKey, @WebParam(name = "context") ContextInfo context) throws DoesNotExistException, InvalidParameterException, MissingParameterException, OperationFailedException; | |
126 | } |