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.technologylibrarymodel;
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.enterprisemodel.systemimplementationmodel.Domain;
24: import com.metaboss.sdlctools.models.metabossmodel.enterprisemodel.systemimplementationmodel.domainimplementationmodel.DomainRelationalStorageDefinition;
25: import com.metaboss.sdlctools.models.metabossmodel.technologylibrarymodel.RelationalStorageTechnology;
26:
27: public abstract class RelationalStorageTechnologyImpl extends
28: ModelElementImpl implements RelationalStorageTechnology {
29: // Required constructor
30: protected RelationalStorageTechnologyImpl(StorableObject storable) {
31: super (storable);
32: }
33:
34: /**
35: * @param pDomain
36: * @return requested Domain implementation definition throws exception if none found
37: */
38: public DomainRelationalStorageDefinition getDomainImplementationDefinition(
39: Domain pDomain) {
40: DomainRelationalStorageDefinition lFoundDomainImplementation = findDomainImplementationDefinition(pDomain);
41: // Throw exception if nothing found
42: if (lFoundDomainImplementation == null)
43: throw new IllegalArgumentException(
44: "Unable to locate implementation for domain. RelationalStorageTechnologyRef: "
45: + getRef() + ". DomainRef: "
46: + pDomain.getRef());
47: return lFoundDomainImplementation;
48: }
49:
50: /**
51: * @param pDomain
52: * @return requested Domain implementation definition or null if none found
53: */
54: public DomainRelationalStorageDefinition findDomainImplementationDefinition(
55: Domain pDomain) {
56: Collection lDomainImplementations = getDomainImplementationsOnTechnology();
57: if (!lDomainImplementations.isEmpty()) {
58: for (Iterator lDomainImplementationsIterator = lDomainImplementations
59: .iterator(); lDomainImplementationsIterator
60: .hasNext();) {
61: DomainRelationalStorageDefinition lDomainImplementation = (DomainRelationalStorageDefinition) lDomainImplementationsIterator
62: .next();
63: if (lDomainImplementation.getDomain().equals(pDomain))
64: return lDomainImplementation;
65: }
66: }
67: return null;
68: }
69:
70: }
|