001    /*
002     * Copyright 2011 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     */
016    package org.kuali.kfs.fp.exception;
017    
018    import java.util.Properties;
019    
020    import org.kuali.rice.kns.exception.KualiException;
021    
022    
023    
024    public class CashDrawerStateException extends KualiException {
025        private final String campusCode;
026        private final String controllingDocumentId;
027        private final String currentDrawerStatus;
028        private final String desiredDrawerStatus;
029        
030        private final static String CASH_DRAWER_STATE_EXCEPTION_SESSION_KEY = "CASH_DRAWER_STATE_EXCEPTION";
031    
032    
033        public CashDrawerStateException(String campusCode, String controllingDocumentId, String currentDrawerStatus, String desiredDrawerStatus) {
034            super("Cash Drawer State Exception; this exception should simply serve to redirect the page to the Cash Drawer Status page");
035            this.campusCode = campusCode;
036            this.controllingDocumentId = controllingDocumentId;
037            this.currentDrawerStatus = currentDrawerStatus;
038            this.desiredDrawerStatus = desiredDrawerStatus;
039        }
040    
041    
042        /**
043         * @return current value of campusCode.
044         */
045        public String getCampusCode() {
046            return campusCode;
047        }
048    
049        /**
050         * @return current value of currentDrawerStatus.
051         */
052        public String getCurrentDrawerStatus() {
053            return currentDrawerStatus;
054        }
055    
056        /**
057         * @return current value of desiredDrawerStatus.
058         */
059        public String getDesiredDrawerStatus() {
060            return desiredDrawerStatus;
061        }
062    
063        /**
064         * @return current value of controllingDocumentId.
065         */
066        public String getControllingDocumentId() {
067            return controllingDocumentId;
068        }
069        
070        /**
071         * Creates a Properties object, based on the properties in this exception
072         * @return a Properties object
073         */
074        public Properties toProperties() {
075            Properties properties = new Properties();
076            properties.setProperty("verificationUnit", getCampusCode());
077            properties.setProperty("controllingDocumentId", getControllingDocumentId());
078            properties.setProperty("currentDrawerStatus", getCurrentDrawerStatus());
079            properties.setProperty("desiredDrawerStatus", getDesiredDrawerStatus());
080            properties.setProperty("methodToCall", "displayPage");
081            return properties;
082        }
083    }