001/**
002 * Copyright 2005-2014 The Kuali Foundation
003 *
004 * Licensed under the Educational Community License, Version 2.0 (the "License");
005 * you may not use this file except in compliance with the License.
006 * You may obtain a copy of the License at
007 *
008 * http://www.opensource.org/licenses/ecl2.php
009 *
010 * Unless required by applicable law or agreed to in writing, software
011 * distributed under the License is distributed on an "AS IS" BASIS,
012 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
013 * See the License for the specific language governing permissions and
014 * limitations under the License.
015 */
016package org.kuali.rice.kew.actionlist;
017
018import org.kuali.rice.kew.api.action.ActionItem;
019import org.kuali.rice.kew.api.action.ActionRequest;
020import org.kuali.rice.kew.api.action.ActionSet;
021import org.kuali.rice.kew.api.actionlist.DisplayParameters;
022import org.kuali.rice.kew.api.document.Document;
023import org.kuali.rice.kew.mail.CustomEmailAttribute;
024import org.kuali.rice.kew.notes.CustomNoteAttribute;
025import org.kuali.rice.kew.notes.Note;
026import org.kuali.rice.krad.UserSession;
027
028import java.io.Serializable;
029
030
031public class TestCustomActionList implements CustomActionListAttribute, Serializable, CustomEmailAttribute, CustomNoteAttribute {
032
033        private static final long serialVersionUID = -7212208304658959134L;
034
035        private Document routeHeaderVO;
036    private ActionRequest actionRequestVO;
037    private UserSession userSession;
038    
039    public TestCustomActionList() {}
040    
041    public boolean isAuthorizedToAddNotes() throws Exception {
042        return true;
043    }
044
045    public boolean isAuthorizedToEditNote(Note note) throws Exception {
046        return true;
047    }
048    
049    public String getCustomEmailBody() throws Exception {
050        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." +
051        "  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." +
052        "  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.";
053    }
054
055    public String getCustomEmailSubject() throws Exception {
056        return "Customized Email Subject";
057    }
058
059        public ActionSet getLegalActions(String principalId, ActionItem actionItem) throws Exception {
060                ActionSet actionSet = ActionSet.Builder.create().build();
061                actionSet.addAcknowledge();
062                actionSet.addApprove();
063                actionSet.addCancel();
064                actionSet.addDisapprove();
065                return actionSet;
066        }
067    
068    public DisplayParameters getDocHandlerDisplayParameters(String principalId, ActionItem actionItem) throws Exception {
069        return DisplayParameters.Builder.create(new Integer(300)).build();
070        }
071    
072    public Document getRouteHeaderVO() {
073        return routeHeaderVO;
074    }
075
076    public void setRouteHeaderVO(Document routeHeaderVO) {
077        this.routeHeaderVO = routeHeaderVO;
078    }
079
080        public ActionRequest getActionRequestVO() {
081                return actionRequestVO;
082        }
083
084        public void setActionRequestVO(ActionRequest actionRequestVO) {
085                this.actionRequestVO = actionRequestVO;
086        }
087
088        public UserSession getUserSession() {
089                return userSession;
090        }
091
092        public void setUserSession(UserSession userSession) {
093                this.userSession = userSession;
094        }
095
096    @Override
097    public boolean isAuthorizedToRetrieveAttachments() throws Exception {
098        return true;
099    }
100    
101}