01: /*
02: * Copyright 2005-2006 The Kuali Foundation.
03: *
04: *
05: * Licensed under the Educational Community License, Version 1.0 (the "License");
06: * you may not use this file except in compliance with the License.
07: * You may obtain a copy of the License at
08: *
09: * http://www.opensource.org/licenses/ecl1.php
10: *
11: * Unless required by applicable law or agreed to in writing, software
12: * distributed under the License is distributed on an "AS IS" BASIS,
13: * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14: * See the License for the specific language governing permissions and
15: * limitations under the License.
16: */
17: package edu.iu.uis.eden.batch.web;
18:
19: import java.util.Collection;
20: import java.util.HashMap;
21: import java.util.Map;
22:
23: import org.apache.struts.action.ActionForm;
24:
25: /**
26: * Struts form that accepts uploaded files (in the form of <code>FormFile</code>s)
27: * @see edu.iu.uis.eden.batch.web.IngesterAction
28: * @see org.apache.struts.upload.FormFile
29: * @author Aaron Hamid (arh14 at cornell dot edu)
30: */
31: public class IngesterForm extends ActionForm {
32:
33: private static final long serialVersionUID = -2847217233600977960L;
34: // this is sort of weak but the alternative is to linearly
35: // pad a standard List will null items to make the accessors/mutators happy
36: // on get(index)/set(index, value) so they don't throw IndexOutOfBoundsException
37: private Map files = new HashMap();
38:
39: public Collection getFiles() {
40: return files.values();
41: }
42:
43: public void setFile(int index, Object value) {
44: files.put(new Integer(index), value);
45: }
46:
47: public Object getFile(int index) {
48: return files.get(new Integer(index));
49: }
50:
51: public void reset() {
52: files.clear();
53: }
54: }
|