View Javadoc

1   /**
2    * Copyright 2005-2011 The Kuali Foundation
3    *
4    * Licensed under the Educational Community License, Version 2.0 (the "License");
5    * you may not use this file except in compliance with the License.
6    * You may obtain a copy of the License at
7    *
8    * http://www.opensource.org/licenses/ecl2.php
9    *
10   * Unless required by applicable law or agreed to in writing, software
11   * distributed under the License is distributed on an "AS IS" BASIS,
12   * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13   * See the License for the specific language governing permissions and
14   * limitations under the License.
15   */
16  package org.kuali.rice.kew.actionlist;
17  
18  import org.kuali.rice.kew.api.action.ActionItem;
19  import org.kuali.rice.kew.api.action.ActionRequest;
20  import org.kuali.rice.kew.api.action.ActionSet;
21  import org.kuali.rice.kew.api.actionlist.DisplayParameters;
22  import org.kuali.rice.kew.api.document.Document;
23  import org.kuali.rice.kew.mail.CustomEmailAttribute;
24  import org.kuali.rice.kew.notes.CustomNoteAttribute;
25  import org.kuali.rice.kew.notes.Note;
26  import org.kuali.rice.krad.UserSession;
27  
28  import java.io.Serializable;
29  
30  
31  public class TestCustomActionList implements CustomActionListAttribute, Serializable, CustomEmailAttribute, CustomNoteAttribute {
32  
33  	private static final long serialVersionUID = -7212208304658959134L;
34  
35  	private Document routeHeaderVO;
36      private ActionRequest actionRequestVO;
37      private UserSession userSession;
38      
39      public TestCustomActionList() {}
40      
41      public boolean isAuthorizedToAddNotes() throws Exception {
42          return true;
43      }
44  
45      public boolean isAuthorizedToEditNote(Note note) throws Exception {
46          return true;
47      }
48      
49      public String getCustomEmailBody() throws Exception {
50          return "This is a test.  This is a Customized Email Body.  This is a Customized Email Body.  This is a Customized Email Body.  This is a Customized Email Body.  This is a Customized Email Body." +
51          "  This is a Customized Email Body.  This is a Customized Email Body.  This is a Customized Email Body.  This is a Customized Email Body.  This is a Customized Email Body.  This is a Customized Email Body." +
52          "  This is a Customized Email Body.  This is a Customized Email Body.  This is a Customized Email Body.  This is a Customized Email Body.  This is a Customized Email Body.  This is a Customized Email Body.";
53      }
54  
55      public String getCustomEmailSubject() throws Exception {
56          return "Customized Email Subject";
57      }
58  
59  	public ActionSet getLegalActions(String principalId, ActionItem actionItem) throws Exception {
60  		ActionSet actionSet = ActionSet.Builder.create().build();
61  		actionSet.addAcknowledge();
62  		actionSet.addApprove();
63  		actionSet.addCancel();
64  		actionSet.addDisapprove();
65  		return actionSet;
66  	}
67      
68      public DisplayParameters getDocHandlerDisplayParameters(String principalId, ActionItem actionItem) throws Exception {
69          return DisplayParameters.Builder.create(new Integer(300)).build();
70  	}
71      
72      public Document getRouteHeaderVO() {
73          return routeHeaderVO;
74      }
75  
76      public void setRouteHeaderVO(Document routeHeaderVO) {
77          this.routeHeaderVO = routeHeaderVO;
78      }
79  
80  	public ActionRequest getActionRequestVO() {
81  		return actionRequestVO;
82  	}
83  
84  	public void setActionRequestVO(ActionRequest actionRequestVO) {
85  		this.actionRequestVO = actionRequestVO;
86  	}
87  
88  	public UserSession getUserSession() {
89  		return userSession;
90  	}
91  
92  	public void setUserSession(UserSession userSession) {
93  		this.userSession = userSession;
94  	}
95  
96      @Override
97      public boolean isAuthorizedToRetrieveAttachments() throws Exception {
98          return true;
99      }
100     
101 }