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.designlibrarymodel;
16:
17: import java.util.Collection;
18: import java.util.Iterator;
19:
20: import org.netbeans.mdr.storagemodel.StorableObject;
21:
22: import com.metaboss.sdlctools.models.impl.metabossmodel.ModelElementImpl;
23: import com.metaboss.sdlctools.models.metabossmodel.datadictionarymodel.DataDictionary;
24: import com.metaboss.sdlctools.models.metabossmodel.designlibrarymodel.DesignLibrary;
25:
26: public abstract class DesignLibraryImpl extends ModelElementImpl
27: implements DesignLibrary {
28: // Required constructor
29: protected DesignLibraryImpl(StorableObject storable) {
30: super (storable);
31: }
32:
33: // Returns DataDictionary with specified name or throws exception if none found
34: public DataDictionary getDataDictionary(String pDataDictionaryName) {
35: DataDictionary lFoundDataDictionary = findDataDictionary(pDataDictionaryName);
36: // Throw exception if nothing found
37: if (lFoundDataDictionary == null)
38: throw new IllegalArgumentException(
39: "Unable to locate DataDictionary named '"
40: + pDataDictionaryName
41: + "' in the DesignLibrary. DesignLibraryRef: "
42: + getRef());
43: return lFoundDataDictionary;
44: }
45:
46: // Returns DataDictionary with specified name or null if none found
47: public DataDictionary findDataDictionary(String pDataDictionaryName) {
48: Collection lDataDictionaries = getDataDictionaries();
49: if (!lDataDictionaries.isEmpty()) {
50: for (Iterator lDataDictionariesIterator = lDataDictionaries
51: .iterator(); lDataDictionariesIterator.hasNext();) {
52: DataDictionary lDataDictionary = (DataDictionary) lDataDictionariesIterator
53: .next();
54: if (lDataDictionary.getName().equals(
55: pDataDictionaryName))
56: return lDataDictionary;
57: }
58: }
59: return null;
60: }
61:
62: }
|