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.domains.enterprisemodel.impl;
16:
17: import javax.naming.Context;
18: import javax.naming.InitialContext;
19: import javax.naming.NamingException;
20:
21: import com.metaboss.enterprise.bo.BOException;
22: import com.metaboss.enterprise.bo.BONamingAndDirectoryServiceInvocationException;
23: import com.metaboss.enterprise.bo.BOPersistenceServiceInvocationException;
24: import com.metaboss.enterprise.ps.PSException;
25: import com.metaboss.sdlctools.domains.enterprisemodel.BOField;
26: import com.metaboss.sdlctools.domains.enterprisemodel.BOReport;
27: import com.metaboss.sdlctools.domains.enterprisemodel.BOReportInputFieldList;
28: import com.metaboss.sdlctools.domains.enterprisemodel.storage.PSReport;
29: import com.metaboss.sdlctools.domains.enterprisemodel.storage.STField;
30: import com.oldboss.framework.bo.impl.BOObjectImpl;
31:
32: public class BOReportInputFieldListImpl extends BOObjectImpl implements
33: BOReportInputFieldList {
34: private BOMetaBossDomainImpl mMetaBossDomainImpl = null;
35: private BOReport mReport = null;
36:
37: /* Instance creator */
38: public static BOReportInputFieldList createInstanceForExisting(
39: BOMetaBossDomainImpl pMetaBossDomainImpl, BOReport pReport)
40: throws BOException {
41: BOReportInputFieldListImpl lImpl = new BOReportInputFieldListImpl();
42: lImpl.mMetaBossDomainImpl = pMetaBossDomainImpl;
43: lImpl.mReport = pReport;
44: lImpl.setupForExisting();
45: return lImpl;
46: }
47:
48: /* Private constructor restricts instance creation from outside */
49: private BOReportInputFieldListImpl() throws BOException {
50: }
51:
52: /* Retrieves all fields in this list */
53: public BOField[] getAllFields() throws BOException {
54: try {
55: // Get the instance of the enterprise ps home via jndi
56: Context ctx = new InitialContext();
57: PSReport lPs = (PSReport) ctx
58: .lookup(PSReport.COMPONENT_URL);
59:
60: STField[] lFields = lPs.getInputFields(mReport.getRef());
61: if (lFields == null || lFields.length == 0)
62: return new BOField[0];
63: BOField[] lReturn = new BOField[lFields.length];
64: for (int i = 0; i < lFields.length; i++) {
65: lReturn[i] = BOFieldImpl
66: .createInstanceForExistingReportInputField(
67: mMetaBossDomainImpl, mReport,
68: lFields[i]);
69: }
70: return lReturn;
71: } catch (NamingException e) {
72: throw new BONamingAndDirectoryServiceInvocationException(
73: "", e);
74: } catch (PSException e) {
75: throw new BOPersistenceServiceInvocationException("", e);
76: }
77: }
78: }
|