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.gl.service.impl;
017    
018    import java.io.File;
019    import java.util.List;
020    
021    import org.kuali.kfs.gl.batch.service.impl.EnterpriseFeederStatus;
022    import org.kuali.kfs.sys.Message;
023    
024    /**
025     * This class serves as a wrapper containing references to the feeder status and error messages list. This works around java's
026     * inability to return a value and throw an exception at the same time. Exceptions in KFS are generally needed to force the
027     * framework to rollback a transaction.
028     */
029    public class EnterpriseFeederStatusAndErrorMessagesWrapper {
030        private List<Message> errorMessages;
031        private EnterpriseFeederStatus status;
032        private String doneFileName;
033        private String reconFileName;
034        private String dataFileName;
035    
036        /**
037         * Constructs a EnterpriseFeederStatusAndErrorMessagesWrapper, initializing values to null
038         */
039        public EnterpriseFeederStatusAndErrorMessagesWrapper() {
040            errorMessages = null;
041            status = null;
042        }
043    
044        /**
045         * Gets the errorMessages attribute.
046         * 
047         * @return Returns the errorMessages.
048         */
049        public List<Message> getErrorMessages() {
050            return errorMessages;
051        }
052    
053        /**
054         * Sets the errorMessages attribute value.
055         * 
056         * @param errorMessages The errorMessages to set.
057         */
058        public void setErrorMessages(List<Message> errorMessages) {
059            this.errorMessages = errorMessages;
060        }
061    
062        /**
063         * Gets the status attribute.
064         * 
065         * @return Returns the status.
066         */
067        public EnterpriseFeederStatus getStatus() {
068            return status;
069        }
070    
071        /**
072         * Sets the status attribute value.
073         * 
074         * @param status The status to set.
075         */
076        public void setStatus(EnterpriseFeederStatus status) {
077            this.status = status;
078        }
079    
080        public void setFileNames(File dataFile, File reconFile, File doneFile) {
081            if (dataFile != null) {
082                dataFileName = dataFile.getName();
083            }
084            if (reconFile != null) {
085                reconFileName = reconFile.getName();
086            }
087            if (doneFile != null) {
088                doneFileName = doneFile.getName();
089            }
090        }
091    
092        /**
093         * Gets the doneFileName attribute. 
094         * @return Returns the doneFileName.
095         */
096        public String getDoneFileName() {
097            return doneFileName;
098        }
099    
100        /**
101         * Gets the reconFileName attribute. 
102         * @return Returns the reconFileName.
103         */
104        public String getReconFileName() {
105            return reconFileName;
106        }
107    
108        /**
109         * Gets the dataFileName attribute. 
110         * @return Returns the dataFileName.
111         */
112        public String getDataFileName() {
113            return dataFileName;
114        }
115    }