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 com.metaboss.enterprise.bo.BOException;
18: import com.metaboss.sdlctools.domains.enterprisemodel.BOPropertyDescriptor;
19: import com.metaboss.sdlctools.domains.enterprisemodel.BOPropertyDescriptorList;
20: import com.metaboss.sdlctools.domains.enterprisemodel.storage.STPropertyDescriptor;
21: import com.oldboss.framework.bo.impl.BOObjectImpl;
22:
23: public class BOPropertyDescriptorListImpl extends BOObjectImpl
24: implements BOPropertyDescriptorList {
25: private BOMetaBossDomainImpl mMetaBossDomainImpl = null;
26: private BOPropertyDescriptor mParentDescriptor = null;
27: private BOPropertyDescriptor[] mDescriptors = null;
28:
29: /* Instance creator */
30: public static BOPropertyDescriptorList createInstanceForExisting(
31: BOMetaBossDomainImpl pMetaBossDomainImpl,
32: BOPropertyDescriptor pParentDescriptor,
33: STPropertyDescriptor[] pDescriptors) throws BOException {
34: BOPropertyDescriptorListImpl lImpl = new BOPropertyDescriptorListImpl();
35: lImpl.mMetaBossDomainImpl = pMetaBossDomainImpl;
36: lImpl.mParentDescriptor = pParentDescriptor;
37: if (pDescriptors != null && pDescriptors.length > 0) {
38: lImpl.mDescriptors = new BOPropertyDescriptor[pDescriptors.length];
39: for (int i = 0; i < pDescriptors.length; i++)
40: lImpl.mDescriptors[i] = BOPropertyDescriptorImpl
41: .createInstanceForExisting(pMetaBossDomainImpl,
42: pParentDescriptor, pDescriptors[i]);
43: } else
44: lImpl.mDescriptors = new BOPropertyDescriptor[0];
45: lImpl.setupForExisting();
46: return lImpl;
47: }
48:
49: /* Private constructor restricts instance creation from outside */
50: private BOPropertyDescriptorListImpl() throws BOException {
51: }
52:
53: /* Retrieves the parent property descriptior or null if this is a top level property. */
54: public BOPropertyDescriptor getParentPropertyDescriptor()
55: throws BOException {
56: return mParentDescriptor;
57: }
58:
59: /* Return true if this list is empty, false otherwise */
60: public boolean isEmpty() throws BOException {
61: return mDescriptors.length == 0;
62: }
63:
64: /* Retrieves all property descriptors. */
65: public BOPropertyDescriptor[] getAllPropertyDescriptors()
66: throws BOException {
67: return mDescriptors;
68: }
69: }
|