1:
31: package ;
32:
33: import ;
34: import ;
35: import ;
36:
37:
42: public class ImportedVariablesDataRow extends StaticDataRow
43: {
44: private String[] outerNames;
45: private String[] innerNames;
46:
47: public ImportedVariablesDataRow(final GlobalMasterRow innerRow)
48: throws DataSourceException
49: {
50: final DataRow globalView = innerRow.getGlobalView();
51: final int cols = globalView.getColumnCount();
52: this.outerNames = new String[cols];
53: this.innerNames = outerNames;
54: final Object[] values = new Object[outerNames.length];
55: for (int i = 0; i < outerNames.length; i++)
56: {
57: outerNames[i] = globalView.getColumnName(i);
58: values[i] = globalView.get(i);
59: }
60: setData(outerNames, values);
61: }
62:
63:
71: public ImportedVariablesDataRow(final GlobalMasterRow innerRow,
72: final ParameterMapping[] parameterMappings)
73: throws DataSourceException
74: {
75: this.outerNames = new String[parameterMappings.length];
76: this.innerNames = new String[parameterMappings.length];
77: final Object[] values = new Object[parameterMappings.length];
78: final DataRow globalView = innerRow.getGlobalView();
79: for (int i = 0; i < parameterMappings.length; i++)
80: {
81: final ParameterMapping mapping = parameterMappings[i];
82: final String name = mapping.getAlias();
83: values[i] = globalView.get(name);
84: innerNames[i] = name;
85: outerNames[i] = mapping.getName();
86: }
87: setData(outerNames, values);
88: }
89:
90: protected ImportedVariablesDataRow(final ImportedVariablesDataRow dataRow)
91: {
92: super(dataRow);
93: outerNames = dataRow.outerNames;
94: innerNames = dataRow.innerNames;
95: }
96:
97: public ImportedVariablesDataRow advance (final GlobalMasterRow innerRow)
98: throws DataSourceException
99: {
100: final DataRow globalView = innerRow.getGlobalView();
101: final Object[] values = new Object[outerNames.length];
102: for (int i = 0; i < innerNames.length; i++)
103: {
104: final String name = innerNames[i];
105: values[i] = globalView.get(name);
106: }
107: final ImportedVariablesDataRow idr = new ImportedVariablesDataRow(this);
108: idr.setData(outerNames, values);
109: return idr;
110: }
111: }