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.domainimplementationmodel;
16:
17: import java.util.Iterator;
18:
19: import org.netbeans.mdr.storagemodel.StorableClass;
20:
21: import com.metaboss.sdlctools.models.impl.metabossmodel.ModelElementClassImpl;
22: import com.metaboss.sdlctools.models.metabossmodel.enterprisemodel.systemimplementationmodel.Domain;
23: import com.metaboss.sdlctools.models.metabossmodel.enterprisemodel.systemimplementationmodel.domainimplementationmodel.DomainRelationalStorageDefinition;
24: import com.metaboss.sdlctools.models.metabossmodel.enterprisemodel.systemimplementationmodel.domainimplementationmodel.DomainRelationalStorageDefinitionClass;
25: import com.metaboss.sdlctools.models.metabossmodel.technologylibrarymodel.RelationalStorageTechnology;
26:
27: public abstract class DomainRelationalStorageDefinitionClassImpl extends
28: ModelElementClassImpl implements
29: DomainRelationalStorageDefinitionClass {
30: // Required constructor
31: protected DomainRelationalStorageDefinitionClassImpl(
32: StorableClass storable) {
33: super (storable);
34: }
35:
36: /** @return found DomainRelationalStorageDefinition or throws exception if none found */
37: public DomainRelationalStorageDefinition getDomainRelationalStorageDefinition(
38: Domain pDomain,
39: RelationalStorageTechnology pRelationaStorageTechnology) {
40: DomainRelationalStorageDefinition lFoundDomainRelationalStorageDefinition = findDomainRelationalStorageDefinition(
41: pDomain, pRelationaStorageTechnology);
42: // Throw exception if nothing found
43: if (lFoundDomainRelationalStorageDefinition == null)
44: throw new IllegalArgumentException(
45: "Unable to locate DomainRelationalStorageDefinition for given domain and technology. DomainRef: "
46: + pDomain.getRef()
47: + ", RelationaStorageTechnologyRef: "
48: + pRelationaStorageTechnology.getRef());
49: return lFoundDomainRelationalStorageDefinition;
50: }
51:
52: /** @return found DomainRelationalStorageDefinition or null if none found */
53: public DomainRelationalStorageDefinition findDomainRelationalStorageDefinition(
54: Domain pDomain,
55: RelationalStorageTechnology pRelationalStorageTechnology) {
56: // Iterate through all model elements looking for the required reference
57: for (Iterator lAllDefinitions = refAllOfType().iterator(); lAllDefinitions
58: .hasNext();) {
59: DomainRelationalStorageDefinition lDomainRelationalStorageDefinition = (DomainRelationalStorageDefinition) lAllDefinitions
60: .next();
61: if (lDomainRelationalStorageDefinition.getDomain().equals(
62: pDomain)
63: && lDomainRelationalStorageDefinition
64: .getTechnology().equals(
65: pRelationalStorageTechnology))
66: return lDomainRelationalStorageDefinition;
67: }
68: return null;
69: }
70: }
|