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.module.endow.document.web.struts;
017    
018    import org.kuali.kfs.module.endow.businessobject.EndowmentTransactionLine;
019    import org.kuali.kfs.module.endow.document.SecurityTransferDocument;
020    
021    
022    public class SecurityTransferDocumentForm extends EndowmentTransactionLinesDocumentFormBase {
023    
024        public SecurityTransferDocumentForm() {
025            super();
026    
027            showSourceImport = false;
028            // transaction amount is read only for this document; the filed is empty initially
029            newSourceTransactionLine.setTransactionAmount(null);
030            newTargetTransactionLine.setTransactionAmount(null);
031        }
032    
033        @Override
034        protected String getDefaultDocumentTypeName() {
035            return "EST";
036        }
037    
038        /**
039         * This method gets the asset increase document
040         * 
041         * @return the AssetIncreaseDocument
042         */
043        public SecurityTransferDocument getSecurityTransferDocument() {
044            return (SecurityTransferDocument) getDocument();
045        }
046    
047        /**
048         * @see org.kuali.kfs.module.endow.document.web.struts.EndowmentTransactionLinesDocumentFormBase#setNewSourceTransactionLine(org.kuali.kfs.module.endow.businessobject.EndowmentTransactionLine)
049         */
050        @Override
051        public void setNewSourceTransactionLine(EndowmentTransactionLine newSourceTransactionLine) {
052            super.setNewSourceTransactionLine(newSourceTransactionLine);
053    
054            // transaction amount is read only for this document; the filed is empty initially
055            newSourceTransactionLine.setTransactionAmount(null);
056        }
057    
058        /**
059         * @see org.kuali.kfs.module.endow.document.web.struts.EndowmentTransactionLinesDocumentFormBase#setNewTargetTransactionLine(org.kuali.kfs.module.endow.businessobject.EndowmentTransactionLine)
060         */
061        @Override
062        public void setNewTargetTransactionLine(EndowmentTransactionLine newTargetTransactionLine) {
063            super.setNewTargetTransactionLine(newTargetTransactionLine);
064    
065            // transaction amount is read only for this document; the filed is empty initially
066            newTargetTransactionLine.setTransactionAmount(null);
067        }
068    
069        /**
070         * @see org.kuali.kfs.module.endow.document.web.struts.EndowmentTransactionLinesDocumentFormBase#getShowFromTransactionLine()
071         */
072        public boolean getShowFromTransactionLine() {
073            SecurityTransferDocument document = getSecurityTransferDocument();
074            if (document.getSourceTransactionLines() != null && document.getSourceTransactionLines().size() > 0)
075                return false;
076            else
077                return true;
078        }
079    }