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: /**
021: *
022: */package org.netbeans.modules.bpel.model.impl;
023:
024: import org.netbeans.modules.bpel.model.api.BpelEntity;
025: import org.netbeans.modules.bpel.model.api.Condition;
026: import org.netbeans.modules.bpel.model.api.Source;
027: import org.netbeans.modules.bpel.model.api.support.BpelModelVisitor;
028: import org.netbeans.modules.bpel.model.xam.BpelElements;
029: import org.w3c.dom.Element;
030:
031: /**
032: * @author ads
033: *
034: */
035: public class SourceImpl extends TargetImpl implements Source {
036:
037: SourceImpl(BpelModelImpl model, Element e) {
038: super (model, e);
039: }
040:
041: SourceImpl(BpelBuilderImpl builder) {
042: super (builder, BpelElements.SOURCE.getName());
043: }
044:
045: /* (non-Javadoc)
046: * @see org.netbeans.modules.soa.model.bpel20.api.Source#getTransitionCondition()
047: */
048: public Condition getTransitionCondition() {
049: return getChild(Condition.class);
050: }
051:
052: /* (non-Javadoc)
053: * @see org.netbeans.modules.soa.model.bpel20.api.Source#setTransitionCondition(org.netbeans.modules.soa.model.bpel20.api.Condition)
054: */
055: public void setTransitionCondition(Condition condition) {
056: setChild(condition, Condition.class);
057: }
058:
059: /* (non-Javadoc)
060: * @see org.netbeans.modules.soa.model.bpel20.api.Source#removeTransitionCondition()
061: */
062: public void removeTransitionCondition() {
063: removeChild(Condition.class);
064: }
065:
066: /* (non-Javadoc)
067: * @see org.netbeans.modules.soa.model.bpel20.api.BpelEntity#getElementType()
068: */
069: public Class<? extends BpelEntity> getElementType() {
070: return Source.class;
071: }
072:
073: /* (non-Javadoc)
074: * @see org.netbeans.modules.soa.model.bpel20.impl.BpelEntityImpl#acceptThis(org.netbeans.modules.soa.model.bpel20.api.support.BpelModelVisitor)
075: */
076: @Override
077: public void accept(BpelModelVisitor visitor) {
078: visitor.visit((Source) this );
079: }
080:
081: /* (non-Javadoc)
082: * @see org.netbeans.modules.soa.model.bpel20.impl.ExtensibleElementsImpl#create(org.w3c.dom.Element)
083: */
084: @Override
085: protected BpelEntity create(Element element) {
086: if (BpelElements.TRANSITION_CONDITION.getName().equals(
087: element.getLocalName())) {
088: return new ConditionImpl(getModel(), element);
089: }
090: return super .create(element);
091: }
092:
093: /* (non-Javadoc)
094: * @see org.netbeans.modules.bpel.model.impl.BpelContainerImpl#getMultiplicity(org.netbeans.modules.bpel.model.api.BpelEntity)
095: */
096: @Override
097: protected Multiplicity getMultiplicity(BpelEntity entity) {
098: if (getChildType(entity).equals(Condition.class)) {
099: return Multiplicity.SINGLE;
100: }
101: return super.getMultiplicity(entity);
102: }
103:
104: }
|