1:
31: package ;
32:
33: import ;
34: import ;
35:
36: import ;
37:
38:
43: public class SubReport extends ReportDefinition
44: {
45: private HashMap exportParameters;
46: private HashMap inputParameters;
47:
48: public SubReport()
49: {
50: setType("sub-report");
51: exportParameters = new HashMap();
52: inputParameters = new HashMap();
53: }
54:
55: public void addExportParameter (final String outerName,
56: final String innerName)
57: {
58: exportParameters.put(outerName, innerName);
59: }
60:
61: public void removeExportParameter (final String outerName)
62: {
63: exportParameters.remove(outerName);
64: }
65:
66: public String getExportParameter (final String outerName)
67: {
68: return (String) exportParameters.get(outerName);
69: }
70:
71: public String[] getExportParameters ()
72: {
73: return (String[])
74: exportParameters.keySet().toArray(new String[exportParameters.size()]);
75: }
76:
77: public String[] getPeerExportParameters ()
78: {
79: return (String[])
80: exportParameters.values().toArray(new String[exportParameters.size()]);
81: }
82:
83: public ParameterMapping[] getExportMappings ()
84: {
85: final Map.Entry[] inputEntries = (Map.Entry[])
86: exportParameters.entrySet().toArray(new Map.Entry[exportParameters.size()]);
87: final ParameterMapping[] mapping =
88: new ParameterMapping[exportParameters.size()];
89:
90: for (int i = 0; i < inputEntries.length; i++)
91: {
92: final Map.Entry entry = inputEntries[i];
93: mapping[i] = new ParameterMapping
94: ((String) entry.getKey(), (String) entry.getValue());
95: }
96: return mapping;
97: }
98:
99: public void addInputParameter (final String outerName,
100: final String innerName)
101: {
102: inputParameters.put(outerName, innerName);
103: }
104:
105: public void removeInputParameter (final String outerName)
106: {
107: inputParameters.remove(outerName);
108: }
109:
110: public String getInnerParameter (final String outerName)
111: {
112: return (String) inputParameters.get(outerName);
113: }
114:
115: public String[] getInputParameters ()
116: {
117: return (String[])
118: inputParameters.keySet().toArray(new String[inputParameters.size()]);
119: }
120:
121: public String[] getPeerInputParameters ()
122: {
123: return (String[])
124: inputParameters.values().toArray(new String[inputParameters.size()]);
125: }
126:
127: public ParameterMapping[] getInputMappings ()
128: {
129: final Map.Entry[] inputEntries = (Map.Entry[])
130: inputParameters.entrySet().toArray(new Map.Entry[inputParameters.size()]);
131: final ParameterMapping[] mapping =
132: new ParameterMapping[inputParameters.size()];
133:
134: for (int i = 0; i < inputEntries.length; i++)
135: {
136: final Map.Entry entry = inputEntries[i];
137: mapping[i] = new ParameterMapping
138: ((String) entry.getKey(), (String) entry.getValue());
139: }
140: return mapping;
141: }
142:
143: public boolean isGlobalImport()
144: {
145: return "*".equals(inputParameters.get("*"));
146: }
147:
148: public boolean isGlobalExport()
149: {
150: return "*".equals(exportParameters.get("*"));
151: }
152:
153:
154: public Object clone()
155: throws CloneNotSupportedException
156: {
157: final SubReport report = (SubReport) super.clone();
158: report.inputParameters = (HashMap) inputParameters.clone();
159: report.exportParameters = (HashMap) exportParameters.clone();
160: return report;
161: }
162: }