001: /*
002: * The contents of this file are subject to the terms of the Common Development
003: * and Distribution License (the License). You may not use this file except in
004: * compliance with the License.
005: *
006: * You can obtain a copy of the License at http://www.netbeans.org/cddl.html
007: * or http://www.netbeans.org/cddl.txt.
008: *
009: * When distributing Covered Code, include this CDDL Header Notice in each file
010: * and include the License file at http://www.netbeans.org/cddl.txt.
011: * If applicable, add the following below the CDDL Header, with the fields
012: * enclosed by brackets [] replaced by your own identifying information:
013: * "Portions Copyrighted [year] [name of copyright owner]"
014: *
015: * The Original Software is NetBeans. The Initial Developer of the Original
016: * Software is Sun Microsystems, Inc. Portions Copyright 1997-2007 Sun
017: * Microsystems, Inc. All Rights Reserved.
018: */
019:
020: package org.netbeans.modules.bpel.model.impl;
021:
022: import org.netbeans.modules.bpel.model.api.BpelEntity;
023: import org.netbeans.modules.bpel.model.api.Flow;
024: import org.netbeans.modules.bpel.model.api.LinkContainer;
025: import org.netbeans.modules.bpel.model.api.support.BpelModelVisitor;
026: import org.netbeans.modules.bpel.model.xam.BpelElements;
027: import org.netbeans.modules.bpel.model.xam.BpelTypesEnum;
028: import org.w3c.dom.Element;
029:
030: /**
031: * @author ads
032: */
033: public class FlowImpl extends CompositeActivityImpl implements Flow {
034:
035: FlowImpl(BpelModelImpl model, Element e) {
036: super (model, e);
037: }
038:
039: FlowImpl(BpelBuilderImpl builder) {
040: super (builder, BpelElements.FLOW.getName());
041: }
042:
043: /*
044: * (non-Javadoc)
045: *
046: * @see org.netbeans.modules.soa.model.bpel20.api.Flow#getLinkContainer()
047: */
048: public LinkContainer getLinkContainer() {
049: return getChild(LinkContainer.class);
050: }
051:
052: /*
053: * (non-Javadoc)
054: *
055: * @see org.netbeans.modules.soa.model.bpel20.api.Flow#setLinkContainer(org.netbeans.modules.soa.model.bpel20.api.LinkContainer)
056: */
057: public void setLinkContainer(LinkContainer value) {
058: setChild(value, LinkContainer.class,
059: BpelTypesEnum.ACTIVITIES_GROUP);
060: }
061:
062: /*
063: * (non-Javadoc)
064: *
065: * @see org.netbeans.modules.soa.model.bpel20.api.Flow#removeLinkContainer()
066: */
067: public void removeLinkContainer() {
068: removeChild(LinkContainer.class);
069: }
070:
071: /*
072: * (non-Javadoc)
073: *
074: * @see org.netbeans.modules.soa.model.bpel20.api.BpelEntity#getElementType()
075: */
076: public Class<? extends BpelEntity> getElementType() {
077: return Flow.class;
078: }
079:
080: public void accept(BpelModelVisitor visitor) {
081: visitor.visit(this );
082: }
083:
084: @Override
085: protected BpelEntity create(Element element) {
086: if (BpelElements.LINKS.getName().equals(element.getLocalName())) {
087: return new LinkContainerImpl(getModel(), element);
088: }
089: return super .create(element);
090: }
091:
092: /* (non-Javadoc)
093: * @see org.netbeans.modules.bpel.model.impl.BpelContainerImpl#getMultiplicity(org.netbeans.modules.bpel.model.api.BpelEntity)
094: */
095: @Override
096: protected Multiplicity getMultiplicity(BpelEntity entity) {
097: if (getChildType(entity).equals(LinkContainer.class)) {
098: return Multiplicity.SINGLE;
099: }
100: return super.getMultiplicity(entity);
101: }
102:
103: }
|