001: /*
002: * Copyright 2005-2007 The Kuali Foundation.
003: *
004: *
005: * Licensed under the Educational Community License, Version 1.0 (the "License");
006: * you may not use this file except in compliance with the License.
007: * You may obtain a copy of the License at
008: *
009: * http://www.opensource.org/licenses/ecl1.php
010: *
011: * Unless required by applicable law or agreed to in writing, software
012: * distributed under the License is distributed on an "AS IS" BASIS,
013: * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
014: * See the License for the specific language governing permissions and
015: * limitations under the License.
016: */
017: package edu.iu.uis.eden.server;
018:
019: import java.util.List;
020:
021: import org.apache.commons.lang.builder.ReflectionToStringBuilder;
022:
023: /**
024: * SimpleDocumentActionsWebService is a simplified view into KEW that exposes those methods
025: * that would be required by a basic client as a web service that is meant
026: * to be as interoperable as possible (using simple types, etc.)
027: *
028: * The standard return is a simple structure containing a standard set of return values:
029: * <ul>
030: * <li>docStatus String - current status of document in KEW</li>
031: * <li>createDate String - date document was created in KEW</li>
032: * <li>initiatorId String - netid of document initiator</li>
033: * <li>appDocId String - application specific document id</li>
034: * <li>initiatorName String - display name of the document initiator</li>
035: * <li>routedByUserId String - id of the user that routed the document (can be different from initiator)</li>
036: * <li>routedByUserName String - display name of the user that routed the document (can be different from initiator)</li>
037: * <li>errorMessage String - error message from KEW if any</li>
038: * </ul>
039: *
040: * @author Bryan G. Hutchinson (bh79 at cornell dot edu)
041: * @author Aaron Hamid (arh14 at cornell dot edu)
042: */
043: public interface SimpleDocumentActionsWebService {
044:
045: /**
046: * Response object used for isUserInRouteLog method
047: */
048: public static class UserInRouteLogResponse extends ErrorResponse {
049: protected String isUserInRouteLog;
050:
051: public String getIsUserInRouteLog() {
052: return isUserInRouteLog;
053: }
054:
055: public void setIsUserInRouteLog(String isUserInRouteLog) {
056: this .isUserInRouteLog = isUserInRouteLog;
057: }
058:
059: public String toString() {
060: return ReflectionToStringBuilder.toString(this );
061: }
062: }
063:
064: /**
065: * Response object used for deleteNote method
066: */
067: public static class ErrorResponse {
068: protected String errorMessage;
069:
070: public String getErrorMessage() {
071: return errorMessage;
072: }
073:
074: public void setErrorMessage(String errorMessage) {
075: this .errorMessage = errorMessage;
076: }
077:
078: public String toString() {
079: return ReflectionToStringBuilder.toString(this );
080: }
081: }
082:
083: /**
084: * Response object for note-related methods
085: */
086: public static class NoteResponse extends ErrorResponse {
087: protected String author;
088: protected String noteId;
089: protected String timestamp;
090: protected String noteText;
091:
092: public String getAuthor() {
093: return author;
094: }
095:
096: public void setAuthor(String author) {
097: this .author = author;
098: }
099:
100: public String getNoteId() {
101: return noteId;
102: }
103:
104: public void setNoteId(String noteId) {
105: this .noteId = noteId;
106: }
107:
108: public String getTimestamp() {
109: return timestamp;
110: }
111:
112: public void setTimestamp(String timestamp) {
113: this .timestamp = timestamp;
114: }
115:
116: public String getNoteText() {
117: return noteText;
118: }
119:
120: public void setNoteText(String noteText) {
121: this .noteText = noteText;
122: }
123:
124: public String toString() {
125: return ReflectionToStringBuilder.toString(this );
126: }
127: }
128:
129: /**
130: * "Standard" response object
131: */
132: public static class StandardResponse extends ErrorResponse {
133: protected String docStatus;
134: protected String createDate;
135: protected String initiatorId;
136: protected String routedByUserId;
137: protected String routedByUserName;
138: protected String appDocId;
139: protected String initiatorName;
140:
141: public String getDocStatus() {
142: return docStatus;
143: }
144:
145: public void setDocStatus(String docStatus) {
146: this .docStatus = docStatus;
147: }
148:
149: public String getCreateDate() {
150: return createDate;
151: }
152:
153: public void setCreateDate(String createDate) {
154: this .createDate = createDate;
155: }
156:
157: public String getInitiatorId() {
158: return initiatorId;
159: }
160:
161: public void setInitiatorId(String initiatorId) {
162: this .initiatorId = initiatorId;
163: }
164:
165: public String getAppDocId() {
166: return appDocId;
167: }
168:
169: public void setAppDocId(String appDocId) {
170: this .appDocId = appDocId;
171: }
172:
173: public String getInitiatorName() {
174: return initiatorName;
175: }
176:
177: public void setInitiatorName(String initiatorName) {
178: this .initiatorName = initiatorName;
179: }
180:
181: public String toString() {
182: return ReflectionToStringBuilder.toString(this );
183: }
184:
185: public String getRoutedByUserId() {
186: return routedByUserId;
187: }
188:
189: public void setRoutedByUserId(String routedByUserId) {
190: this .routedByUserId = routedByUserId;
191: }
192:
193: public String getRoutedByUserName() {
194: return routedByUserName;
195: }
196:
197: public void setRoutedByUserName(String routedByUserName) {
198: this .routedByUserName = routedByUserName;
199: }
200: }
201:
202: /**
203: * Response object used when creating or obtaining documents
204: */
205: public static class DocumentResponse extends StandardResponse {
206: protected String docId;
207: protected String docContent;
208: protected String title;
209: protected List<NoteDetail> notes;
210: protected String actionRequested;
211:
212: public DocumentResponse() {
213: }
214:
215: public DocumentResponse(StandardResponse standardResponse) {
216: this .appDocId = standardResponse.getAppDocId();
217: this .createDate = standardResponse.getCreateDate();
218: this .docStatus = standardResponse.getDocStatus();
219: this .errorMessage = standardResponse.getErrorMessage();
220: this .initiatorId = standardResponse.getInitiatorId();
221: this .initiatorName = standardResponse.getInitiatorName();
222: this .routedByUserId = standardResponse.getRoutedByUserId();
223: this .routedByUserName = standardResponse
224: .getRoutedByUserName();
225: }
226:
227: public String getDocContent() {
228: return docContent;
229: }
230:
231: public void setDocContent(String docContent) {
232: this .docContent = docContent;
233: }
234:
235: public String getTitle() {
236: return title;
237: }
238:
239: public void setTitle(String title) {
240: this .title = title;
241: }
242:
243: public List<NoteDetail> getNotes() {
244: return notes;
245: }
246:
247: public void setNotes(List<NoteDetail> notes) {
248: this .notes = notes;
249: }
250:
251: public String getActionRequested() {
252: return actionRequested;
253: }
254:
255: public void setActionRequested(String actionRequested) {
256: this .actionRequested = actionRequested;
257: }
258:
259: public String toString() {
260: return ReflectionToStringBuilder.toString(this );
261: }
262:
263: public String getDocId() {
264: return docId;
265: }
266:
267: public void setDocId(String docId) {
268: this .docId = docId;
269: }
270: }
271:
272: /**
273: * Response object encapsulating a note on a document
274: */
275: public static class NoteDetail {
276: public String author;
277: public String id;
278: public String timestamp;
279: public String noteText;
280:
281: public String getAuthor() {
282: return author;
283: }
284:
285: public void setAuthor(String author) {
286: this .author = author;
287: }
288:
289: public String getId() {
290: return id;
291: }
292:
293: public void setId(String id) {
294: this .id = id;
295: }
296:
297: public String getTimestamp() {
298: return timestamp;
299: }
300:
301: public void setTimestamp(String timestamp) {
302: this .timestamp = timestamp;
303: }
304:
305: public String getNoteText() {
306: return noteText;
307: }
308:
309: public void setNoteText(String noteText) {
310: this .noteText = noteText;
311: }
312:
313: public String toString() {
314: return ReflectionToStringBuilder.toString(this );
315: }
316: }
317:
318: /**
319: * Create a KEW document.
320: *
321: * @param initiatorId netid of the document initiator
322: * @param appDocId application specific document id
323: * @param docType KEW document type for the document to be created
324: * @param docTitle title for this document
325: * @return DocumentResponse including the standard set of return values and the docId of the newly created document
326: */
327: public DocumentResponse create(String initiatorId, String appDocId,
328: String docType, String docTitle);
329:
330: /**
331: * Route a KEW document.
332: *
333: * @param docId KEW document id of the document to route
334: * @param userId netid of the user who is routing the document
335: * @param docTitle title for this document
336: * @param docContent xml content for this document
337: * @param annotation a comment associated with this request
338: * @return StandardResponse including the standard set of return values
339: */
340: public StandardResponse route(String docId, String userId,
341: String docTitle, String docContent, String annotation);
342:
343: /**
344: * Approve the KEW document, in response to an approval action request.
345: *
346: * @param docId KEW document id of the document to approve
347: * @param userId netid of the user who is approving the document
348: * @param docTitle title for this document
349: * @param docContent xml content for this document
350: * @param annotation a comment associated with this request
351: * @return StandardResponse including the standard set of return values
352: */
353: public StandardResponse approve(String docId, String userId,
354: String docTitle, String docContent, String annotation);
355:
356: /**
357: * Blanket Approve the KEW document (all future approval requests will be satisfied),
358: * in response to an approval action request. Can only be performed by a super user.
359: *
360: * @param docId KEW document id of the document to blanket approve
361: * @param userId netid of the user who is blanket approving the document
362: * @param docTitle title for this document
363: * @param docContent xml content for this document
364: * @param annotation a comment associated with this request
365: * @return StandardResponse including the standard set of return values
366: */
367: public StandardResponse blanketApprove(String docId, String userId,
368: String docTitle, String docContent, String annotation);
369:
370: /**
371: * Cancel the KEW document.
372: *
373: * @param docId KEW document id of the document to cancel
374: * @param userId netid of the user who is canceling the document
375: * @param annotation a comment associated with this request
376: * @return StandardResponse including the standard set of return values
377: */
378: public StandardResponse cancel(String docId, String userId,
379: String annotation);
380:
381: /**
382: * Disapprove the KEW document, in response to an approval action request.
383: *
384: * @param docId KEW document id of the document to disapprove
385: * @param userId netid of the user who is disapproving the document
386: * @param annotation a comment associated with this request
387: * @return StandardResponse including the standard set of return values
388: */
389: public StandardResponse disapprove(String docId, String userId,
390: String annotation);
391:
392: /**
393: * Acknowledge the KEW document, in response to an acknowledge action request.
394: *
395: * @param docId KEW document id of the document to acknowledge
396: * @param userId netid of the user who is acknowledging the document
397: * @param annotation a comment associated with this request
398: * @return StandardResponse including the standard set of return values
399: */
400: public StandardResponse acknowledge(String docId, String userId,
401: String annotation);
402:
403: /**
404: * Clear an FYI request for this KEW document from the user's action list,
405: * in response to an FYI action request.
406: *
407: * @param docId KEW document id of the document to acknowledge
408: * @param userId netid of the user who is acknowledging the document
409: * @return StandardResponse including the standard set of return values
410: */
411: public StandardResponse fyi(String docId, String userId);
412:
413: /**
414: * Save the KEW document, keeps it in the user's action list for completion later.
415: *
416: * @param docId KEW document id of the document to save
417: * @param userId netid of the user who is saving the document
418: * @param docTitle title for this document
419: * @param annotation a comment associated with this request
420: * @return StandardResponse including the standard set of return values
421: */
422: public StandardResponse save(String docId, String userId,
423: String docTitle, String annotation);
424:
425: /**
426: * Create an Adhoc FYI request for another user for this KEW document.
427: * NOTE: Must make a subsequent call to route in order for the action
428: * request to be created. This allows the user to create multiple adhoc
429: * requests at the same time prior to routing.
430: *
431: * @param docId KEW document id of the document to create the adhoc request for
432: * @param userId netid of the user who is making this request
433: * @param recipientUserId netid of the user for whom the request is being created
434: * @param annotation a comment associated with this request
435: * @return StandardResponse including the standard set of return values
436: */
437: public StandardResponse requestAdHocFyiToUser(String docId,
438: String userId, String recipientUserId, String annotation);
439:
440: /**
441: * Create an Adhoc FYI request for another group for this KEW document.
442: * NOTE: Must make a subsequent call to route in order for the action
443: * request to be created. This allows the user to create multiple adhoc
444: * requests at the same time prior to routing.
445: *
446: * @param docId KEW document id of the document to create the adhoc request for
447: * @param userId netid of the user who is making this request
448: * @param recipientGroupId workgroupId of the group to create this request for
449: * @param annotation a comment associated with this request
450: * @return StandardResponse including the standard set of return values
451: */
452: public StandardResponse requestAdHocFyiToGroup(String docId,
453: String userId, String recipientGroupId, String annotation);
454:
455: /**
456: * Create an Adhoc Acknowledge request for another user for this KEW document.
457: * NOTE: Must make a subsequent call to route in order for the action
458: * request to be created. This allows the user to create multiple adhoc
459: * requests at the same time prior to routing.
460: *
461: * @param docId KEW document id of the document to create the adhoc request for
462: * @param userId netid of the user who is making this request
463: * @param recipientUserId netid of the user for whom the request is being created
464: * @param annotation a comment associated with this request
465: * @return StandardResponse including the standard set of return values
466: */
467: public StandardResponse requestAdHocAckToUser(String docId,
468: String userId, String recipientUserId, String annotation);
469:
470: /**
471: * Create an Adhoc Acknowledge request for another group for this KEW document.
472: * NOTE: Must make a subsequent call to route in order for the action
473: * request to be created. This allows the user to create multiple adhoc
474: * requests at the same time prior to routing.
475: *
476: * @param docId KEW document id of the document to create the adhoc request for
477: * @param userId netid of the user who is making this request
478: * @param recipientGroupId workgroupId of the group to create this request for
479: * @param annotation a comment associated with this request
480: * @return StandardResponse including the standard set of return values
481: */
482: public StandardResponse requestAdHocAckToGroup(String docId,
483: String userId, String recipientGroupId, String annotation);
484:
485: /**
486: * Create an Adhoc Approval request for another user for this KEW document.
487: * NOTE: Must make a subsequent call to route in order for the action
488: * request to be created. This allows the user to create multiple adhoc
489: * requests at the same time prior to routing.
490: *
491: * @param docId KEW document id of the document to create the adhoc request for
492: * @param userId netid of the user who is making this request
493: * @param recipientUserId netid of the user for whom the request is being created
494: * @param annotation a comment associated with this request
495: * @return StandardResponse including the standard set of return values
496: */
497: public StandardResponse requestAdHocApproveToUser(String docId,
498: String userId, String recipientUserId, String annotation);
499:
500: /**
501: * Create an Adhoc Approval request for another group for this KEW document.
502: * NOTE: Must make a subsequent call to route in order for the action
503: * request to be created. This allows the user to create multiple adhoc
504: * requests at the same time prior to routing.
505: *
506: * @param docId KEW document id of the document to create the adhoc request for
507: * @param userId netid of the user who is making this request
508: * @param recipientGroupId workgroupId of the group to create this request for
509: * @param annotation a comment associated with this request
510: * @return StandardResponse including the standard set of return values
511: */
512: public StandardResponse requestAdHocApproveToGroup(String docId,
513: String userId, String recipientGroupId, String annotation);
514:
515: /**
516: * Check to see if the user is associated with this KEW document.
517: * Useful for security purposes (if return is False, user shouldn't
518: * be able to see the document unless it's public.)
519: *
520: * @param docId KEW document id of the document to check
521: * @param userId netid of the user to check
522: * @return UserInRouteLogResponse containing True/False for isUserInRouteLog and an error message if
523: * a problem occured
524: */
525: public UserInRouteLogResponse isUserInRouteLog(String docId,
526: String userId);
527:
528: /**
529: * Retrieve a KEW document based on the docId and userId passed in, and return the
530: * information about the document.
531: *
532: * @param docId KEW document id of the document to retrieve information about
533: * @param userId netid of the user to retrieve the document for
534: * @return DocumentResponse including the standard set of return values, the xml document content,
535: * the title, the action requested ( Approve, Aknowledge, Fyi, Complete ) and an
536: * array of Maps containing the following for each Note (author, noteId, timestamp,
537: * noteText).
538: */
539: public DocumentResponse getDocument(String docId, String userId);
540:
541: /**
542: * Add a note (possibly including a binary attachment) to this KEW document.
543: *
544: * @param docId KEW document id of the document to add the note to
545: * @param userId netid of the user who is adding the note
546: * @param noteText text of the note
547: * @return NoteResponse containing relevant note information (author, noteId, timestamp, noteText)
548: * along with an error message (if any)
549: */
550: public NoteResponse addNote(String docId, String userId,
551: String noteText);
552:
553: /**
554: * Update an existing note (possibly including a binary attachment) to this KEW document.
555: *
556: * @param docId KEW document id of the document to update the note for
557: * @param noteId the id of the note to update
558: * @param userId netid of the user who is updating the note
559: * @param noteText text of the note if changed
560: * @return NoteResponse containing relevant note information (author, noteId, timestamp, noteText)
561: * along with an error message (if any)
562: */
563: public NoteResponse updateNote(String docId, String noteId,
564: String userId, String noteText);
565:
566: /**
567: * Delete an existing note.
568: *
569: * @param docId KEW document id of the document to delete the note from
570: * @param noteId the id of the note to delete
571: * @param userId netid of the user who is deleting the note
572: * @return ErrorResponse containing an error message if any
573: */
574: public ErrorResponse deleteNote(String docId, String noteId,
575: String userId);
576:
577: /**
578: * Return a KEW document to a previous route node. This method should
579: * be used with caution.
580: *
581: * @param docId KEW document id of the document to return to a previous node
582: * @param userId netid of the user who is requesting this action
583: * @param annotation a comment associated with this request
584: * @param nodeName name of the route node to return to
585: * @return StandardResponse including the standard set of return values
586: */
587: public StandardResponse returnToPreviousNode(String docId,
588: String userId, String annotation, String nodeName);
589:
590: }
|