01: /*
02: * The contents of this file are subject to the terms of the Common Development
03: * and Distribution License (the License). You may not use this file except in
04: * compliance with the License.
05: *
06: * You can obtain a copy of the License at http://www.netbeans.org/cddl.html
07: * or http://www.netbeans.org/cddl.txt.
08: *
09: * When distributing Covered Code, include this CDDL Header Notice in each file
10: * and include the License file at http://www.netbeans.org/cddl.txt.
11: * If applicable, add the following below the CDDL Header, with the fields
12: * enclosed by brackets [] replaced by your own identifying information:
13: * "Portions Copyrighted [year] [name of copyright owner]"
14: *
15: * The Original Software is NetBeans. The Initial Developer of the Original
16: * Software is Sun Microsystems, Inc. Portions Copyright 1997-2007 Sun
17: * Microsystems, Inc. All Rights Reserved.
18: */
19:
20: package org.netbeans.modules.bpel.model.impl;
21:
22: import org.netbeans.modules.bpel.model.api.ActivityHolder;
23: import org.netbeans.modules.bpel.model.api.BpelEntity;
24: import org.netbeans.modules.bpel.model.api.ExtendableActivity;
25: import org.w3c.dom.Element;
26:
27: public abstract class ActivityHolderImpl extends ExtensibleElementsImpl
28: implements ActivityHolder {
29:
30: ActivityHolderImpl(BpelModelImpl model, Element e) {
31: super (model, e);
32: }
33:
34: ActivityHolderImpl(BpelBuilderImpl builder, String tagName) {
35: super (builder, tagName);
36: }
37:
38: /* (non-Javadoc)
39: * @see org.netbeans.modules.soa.model.bpel20.api.ActivityHolder#getActivity()
40: */
41: public ExtendableActivity getActivity() {
42: return getChild(ExtendableActivity.class);
43: }
44:
45: /* (non-Javadoc)
46: * @see org.netbeans.modules.soa.model.bpel20.api.ActivityHolder#setActivity(org.netbeans.modules.soa.model.bpel20.api.ExtendableActivity)
47: */
48: public void setActivity(ExtendableActivity activity) {
49: setChild(activity, ExtendableActivity.class);
50: }
51:
52: /*
53: * (non-Javadoc)
54: *
55: * @see org.netbeans.modules.soa.model.bpel20.api.ActivityHolder#removeActivity()
56: */
57: public void removeActivity() {
58: removeChild(ExtendableActivity.class);
59: }
60:
61: /*
62: * (non-Javadoc)
63: *
64: * @see org.netbeans.modules.soa.model.bpel.xdm.impl.BpelContainerImpl#create(org.w3c.dom.Element)
65: */
66: @Override
67: protected BpelEntity create(Element element) {
68: BpelEntity entity = Utils.createActivityGroup(getModel(),
69: element);
70: if (entity == null) {
71: return super .create(element);
72: }
73: return entity;
74: }
75:
76: /* (non-Javadoc)
77: * @see org.netbeans.modules.soa.model.bpel20.impl.BpelContainerImpl#getChildType(T)
78: */
79: @Override
80: protected <T extends BpelEntity> Class<? extends BpelEntity> getChildType(
81: T entity) {
82: if (entity instanceof ExtendableActivity) {
83: return ExtendableActivity.class;
84: }
85: return super .getChildType(entity);
86: }
87:
88: /* (non-Javadoc)
89: * @see org.netbeans.modules.bpel.model.impl.BpelContainerImpl#getMultiplicity(org.netbeans.modules.bpel.model.api.BpelEntity)
90: */
91: @Override
92: protected Multiplicity getMultiplicity(BpelEntity entity) {
93: if (getChildType(entity).equals(ExtendableActivity.class)) {
94: return Multiplicity.SINGLE;
95: }
96: return super.getMultiplicity(entity);
97: }
98:
99: }
|