01: // THIS SOFTWARE IS PROVIDED BY SOFTARIS PTY.LTD. AND OTHER METABOSS
02: // CONTRIBUTORS ``AS IS'' AND ANY EXPRESSED OR IMPLIED WARRANTIES, INCLUDING,
03: // BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
04: // FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL SOFTARIS PTY.LTD.
05: // OR OTHER METABOSS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
06: // INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
07: // LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA,
08: // OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
09: // LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
10: // NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE,
11: // EVEN IF SOFTARIS PTY.LTD. OR OTHER METABOSS CONTRIBUTORS ARE ADVISED OF THE
12: // POSSIBILITY OF SUCH DAMAGE.
13: //
14: // Copyright 2000-2005 © Softaris Pty.Ltd. All Rights Reserved.
15: package com.metaboss.sdlctools.models.impl.metabossmodel.enterprisemodel.systemimplementationmodel;
16:
17: import java.util.Collection;
18: import java.util.HashSet;
19: import java.util.Iterator;
20: import java.util.Set;
21:
22: import org.netbeans.mdr.storagemodel.StorableObject;
23:
24: import com.metaboss.sdlctools.models.impl.metabossmodel.ModelElementImpl;
25: import com.metaboss.sdlctools.models.metabossmodel.enterprisemodel.systemimplementationmodel.Entity;
26: import com.metaboss.sdlctools.models.metabossmodel.enterprisemodel.systemimplementationmodel.Report;
27: import com.metaboss.sdlctools.models.metabossmodel.enterprisemodel.systemimplementationmodel.ReportInputField;
28: import com.metaboss.sdlctools.models.metabossmodel.enterprisemodel.systemimplementationmodel.ReportOutputElement;
29: import com.metaboss.sdlctools.models.metabossmodel.enterprisemodel.systemimplementationmodel.ReportOutputField;
30:
31: public abstract class ReportImpl extends ModelElementImpl implements
32: Report {
33: // Required constructor
34: protected ReportImpl(StorableObject storable) {
35: super (storable);
36: }
37:
38: /** Returns count of output levels */
39: public int getOutputLevelsCount() {
40: // Iterate through output element levels and count them up
41: int lOutputLevelsCount = 0;
42: for (ReportOutputElement lOutputElement = getTopLevelOutputElement(); lOutputElement != null; lOutputElement = lOutputElement
43: .getSubElement())
44: lOutputLevelsCount++;
45: return lOutputLevelsCount;
46: }
47:
48: // Returns list of DataTypes, Structures and Messages used in the Servicemodule. This includes owned and referenced elements
49: public Collection getCombinedTypes() {
50: Set lCombinedTypes = new HashSet();
51: // Look at the special types
52: if (isPaginal()) {
53: lCombinedTypes.add(getReportSizeDataType());
54: lCombinedTypes.add(getReportPageOffsetDataType());
55: lCombinedTypes.add(getReportPageSizeDataType());
56: }
57: // Interrogate the input fields
58: for (Iterator lInputFieldsIterator = getInputFields()
59: .iterator(); lInputFieldsIterator.hasNext();) {
60: ReportInputField lInputField = (ReportInputField) lInputFieldsIterator
61: .next();
62: lCombinedTypes.add(lInputField.getDataType());
63: }
64: // Interrogate the output level
65: for (ReportOutputElement lOutputElement = getTopLevelOutputElement(); lOutputElement != null; lOutputElement = lOutputElement
66: .getSubElement()) {
67: for (Iterator lOutputEntitiesIterator = lOutputElement
68: .getOutputEntities().iterator(); lOutputEntitiesIterator
69: .hasNext();) {
70: Entity lOutputEntity = (Entity) lOutputEntitiesIterator
71: .next();
72: lCombinedTypes.addAll(lOutputEntity.getCombinedTypes());
73: }
74: for (Iterator lOutputFieldsIterator = lOutputElement
75: .getOutputFields().iterator(); lOutputFieldsIterator
76: .hasNext();) {
77: ReportOutputField lOutputField = (ReportOutputField) lOutputFieldsIterator
78: .next();
79: lCombinedTypes.add(lOutputField.getDataType());
80: }
81: }
82: return java.util.Collections
83: .unmodifiableCollection(lCombinedTypes);
84: }
85:
86: }
|