View Javadoc
1   /*
2    * Copyright 2007 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.ole.sys.web.struts;
17  
18  import java.util.Date;
19  import java.util.List;
20  
21  import javax.servlet.http.HttpServletRequest;
22  
23  import org.apache.struts.action.ActionMapping;
24  import org.apache.struts.upload.FormFile;
25  import org.kuali.ole.module.purap.document.RequisitionDocument;
26  import org.kuali.ole.select.businessobject.OleLoadFailureRecords;
27  import org.kuali.ole.select.businessobject.OleLoadSumRecords;
28  import org.kuali.ole.select.document.AcquisitionBatchInputFileDocument;
29  import org.kuali.ole.sys.businessobject.AcquisitionBatchUpload;
30  import org.kuali.rice.krad.util.ObjectUtils;
31  import org.kuali.rice.kns.web.struts.form.KualiTransactionalDocumentFormBase;
32  import org.kuali.rice.kns.web.ui.HeaderField;
33  import org.kuali.rice.kew.api.WorkflowDocument;
34  
35  /**
36   * Struts action form for the batch upload screen.
37   */
38  public class AcquisitionBatchInputFileForm extends KualiTransactionalDocumentFormBase {
39      private FormFile uploadFile;
40      private AcquisitionBatchUpload acquisitionBatchUpload;
41      //private List<KeyLabelPair> userFiles;
42     // private String url;
43      private OleLoadSumRecords oleLoadSumRecords;
44      private List<OleLoadFailureRecords> oleLoadFailureRecordsList;
45      private String fileName;
46      private String titleKey;
47      //private String attachmentLink;
48      //private String fileContents;
49     
50      /*public String getAttachmentLink() {
51          return attachmentLink;
52      }
53  
54      public void setAttachmentLink(String attachmentLink) {
55          this.attachmentLink = attachmentLink;
56      }*/
57  
58      /**
59       * Gets the batchUpload attribute.
60       */
61      public AcquisitionBatchUpload getAcquisitionBatchUpload() {
62          return acquisitionBatchUpload;
63      }
64  
65      /**
66       * Sets the batchUpload attribute value.
67       */
68      public void setAcquisitionBatchUpload(AcquisitionBatchUpload batchUpload) {
69          this.acquisitionBatchUpload = batchUpload;
70      }
71  
72      /**
73       * Gets the uploadFile attribute.
74       */
75      public FormFile getUploadFile() {
76          return uploadFile;
77      }
78  
79      /**
80       * Sets the uploadFile attribute value.
81       */
82      public void setUploadFile(FormFile uploadFile) {
83          this.uploadFile = uploadFile;
84      }
85  
86      /**
87       * Gets the userFiles attribute.
88       */
89     /* public List<KeyLabelPair> getUserFiles() {
90          return userFiles;
91      }
92  
93      *//**
94       * Sets the userFiles attribute value.
95       *//*
96      public void setUserFiles(List<KeyLabelPair> userFiles) {
97          this.userFiles = userFiles;
98      }*/
99  
100     /**
101      * Gets the titleKey attribute.
102      */
103     public String getTitleKey() {
104         return titleKey;
105     }
106 
107     /**
108      * Sets the titleKey attribute value.
109      */
110     public void setTitleKey(String titleKey) {
111         this.titleKey = titleKey;
112     }
113 
114     /**
115      * Gets the url attribute. 
116      * @return Returns the url.
117      */
118    /* public String getUrl() {
119         return url;
120     }*/
121 
122     /**
123      * Sets the url attribute value.
124      * @param url The url to set.
125      */
126     /*public void setUrl(String url) {
127         this.url = url;
128     }*/
129    
130     public OleLoadSumRecords getOleLoadSumRecords() {
131         return oleLoadSumRecords;
132     }
133 
134     public void setOleLoadSumRecords(OleLoadSumRecords oleLoadSumRecords) {
135         this.oleLoadSumRecords = oleLoadSumRecords;
136     }
137 
138     public List<OleLoadFailureRecords> getOleLoadFailureRecordsList() {
139         return oleLoadFailureRecordsList;
140     }
141 
142     public void setOleLoadFailureRecordsList(List<OleLoadFailureRecords> oleLoadFailureRecordsList) {
143         this.oleLoadFailureRecordsList = oleLoadFailureRecordsList;
144     }
145     public String getFileName() {
146         return fileName;
147     }
148 
149     public void setFileName(String fileName) {
150         this.fileName = fileName;
151     }
152  
153     @Override
154     public String getRefreshCaller(){
155         return "refreshCaller";
156     }
157     
158     @Override
159     public void reset(ActionMapping mapping, HttpServletRequest request) {
160         super.reset(mapping, request);
161     }
162     
163     public AcquisitionBatchInputFileForm(){
164         super();
165         this.acquisitionBatchUpload = new AcquisitionBatchUpload();
166         setDocTypeName("OLE_ACQBTHUPLOAD");
167         setDocument(new AcquisitionBatchInputFileDocument());
168     }
169     
170     /*public String getFileContents() {
171         return fileContents;
172     }
173 
174     public void setFileContents(String fileContents) {
175         this.fileContents = fileContents;
176     }*/
177     
178     /**
179     * KRAD Conversion: Performs customization of an header fields.
180     * 
181     * Use of data dictionary for bo RequisitionDocument.
182     */
183     public void populateHeaderFields(WorkflowDocument workflowDocument) {
184         super.populateHeaderFields(workflowDocument);
185         if (ObjectUtils.isNotNull(this.oleLoadSumRecords)) {
186            String displayValue=getDocInfo().get(3).getDisplayValue();
187            getDocInfo().remove(3);
188            getDocInfo().add(new HeaderField("DataDictionary.OleLoadSumRecords.attributes.loadCreatedDate", displayValue));
189            getDocInfo().add(new HeaderField("DataDictionary.OleLoadSumRecords.attributes.acqLoadSumId", this.oleLoadSumRecords.getAcqLoadSumId().toString()));
190            
191        }
192         
193     }
194     
195 }