org.netbeans.modules.bpel.model.impl
Class BpelContainerImpl

java.lang.Object
  extended by org.netbeans.modules.xml.xam.AbstractComponent<C>
      extended by org.netbeans.modules.xml.xam.dom.AbstractDocumentComponent<BpelEntity>
          extended by org.netbeans.modules.bpel.model.impl.BpelEntityImpl
              extended by org.netbeans.modules.bpel.model.impl.BpelContainerImpl
All Implemented Interfaces:
BpelContainer, BpelEntity, Component<BpelEntity>, DocumentComponent<BpelEntity>, DocumentModelAccess.NodeUpdater
Direct Known Subclasses:
DocumentationImpl, ExtensibleElementsImpl, ExtensionActivityImpl, LiteralImpl, LoggingEntityImpl, QueryImpl, ServiceRefImpl

public abstract class BpelContainerImpl
extends BpelEntityImpl
implements BpelContainer

Author:
ads

Nested Class Summary
(package private)  class BpelContainerImpl.CopyKey
           
(package private) static class BpelContainerImpl.Multiplicity
           
 
Nested classes/interfaces inherited from class org.netbeans.modules.bpel.model.impl.BpelEntityImpl
BpelEntityImpl.IdMapKey
 
Nested classes/interfaces inherited from class org.netbeans.modules.xml.xam.dom.AbstractDocumentComponent
AbstractDocumentComponent.PrefixAttribute
 
Field Summary
 
Fields inherited from interface org.netbeans.modules.bpel.model.api.BpelEntity
BUSINESS_PROCESS_1_1_NS_URI, BUSINESS_PROCESS_DRAFT_NS_URI, BUSINESS_PROCESS_NS_URI
 
Fields inherited from interface org.netbeans.modules.xml.xam.dom.DocumentComponent
TEXT_CONTENT_PROPERTY
 
Constructor Summary
protected BpelContainerImpl(BpelBuilderImpl builder, BpelElements elem)
           
protected BpelContainerImpl(BpelBuilderImpl builder, java.lang.String tagName)
           
protected BpelContainerImpl(BpelModelImpl model, org.w3c.dom.Element e)
           
 
Method Summary
protected
<T extends BpelEntity>
void
addChild(T entity, java.lang.Class<T> clazz)
          This method adds entity element to the end of children list in this container.
protected
<T extends BpelEntity>
void
addChildAfter(T entity, java.lang.Class<T> clazz, BpelTypes... types)
           
protected
<T extends BpelEntity>
void
addChildBefore(T entity, java.lang.Class<T> clazz, BpelTypes... types)
           
 boolean canPaste(Component child)
          Default implementation, subclass need to override if needed.
protected abstract  BpelEntity create(org.w3c.dom.Element element)
          This method should be implemented by each container .
protected
<T extends BpelEntity>
T
getChild(java.lang.Class<T> type)
           
protected
<T extends BpelEntity>
T
getChild(java.lang.Class<T> type, int i)
           
<T extends BpelEntity>
java.util.List<T>
getChildren(java.lang.Class<T> type)
           
protected
<T extends BpelEntity>
java.lang.Class<? extends BpelEntity>
getChildType(T entity)
          This method possibly needs to be overriden by some containers...
protected  BpelContainerImpl.Multiplicity getMultiplicity(BpelEntity entity)
          This method should be overriden in concrete implementation if entity can present in this container with not unbounded multiplicity.
<T extends BpelEntity>
int
indexOf(java.lang.Class<T> type, T entity)
          Returns index of entity in children list with specified type.
protected
<T extends BpelEntity>
boolean
insertAtAbsoluteIndex(T entity, java.lang.Class<T> clazz, int index)
          This method is used by SyncUpdateVisitor for inserting element with given index.
protected
<T extends BpelEntity>
void
insertAtIndex(T entity, java.lang.Class<T> clazz, int index, BpelTypes... types)
           
protected
<T extends BpelEntity>
void
insertAtIndexAfter(T entity, java.lang.Class<T> clazz, int index, BpelTypes... types)
           
(package private)  boolean isRegular(BpelEntity entity)
          This method is used for determening regularity of element.
protected  void populateChildren(java.util.List<BpelEntity> children)
           
<T extends BpelEntity>
void
remove(T entity)
          Common method for deleting child from this parent.
protected  void removeChild(java.lang.Class<? extends BpelEntity> classType)
           
protected  void removeChild(java.lang.Class<? extends BpelEntity> classType, int i)
           
protected
<T extends BpelEntity>
void
setArrayAfter(T[] entities, java.lang.Class<T> clazz, BpelTypes... types)
          This method removes all old elements in array and set new list of elements with specified clazz type.
protected
<T extends BpelEntity>
void
setArrayBefore(T[] entities, java.lang.Class<T> clazz, BpelTypes... types)
          This method removes all old elements in array and set new list of elements with specified clazz type.
protected
<T extends BpelEntity>
void
setChild(T newEl, java.lang.Class<T> classType, BpelTypes... types)
          This method will be used consistently when one need to insert element as child in some container.
protected
<T extends BpelEntity>
void
setChildAtIndex(T entity, java.lang.Class<T> clazz, int index)
           
 
Methods inherited from class org.netbeans.modules.bpel.model.impl.BpelEntityImpl
accept, acceptChildren, checkDeleted, checkInTree, copy, copy, createReference, createSchemaReference, createWSDLReference, cut, getAttribute, getAttributeAccess, getAttributeValueOf, getBooleanAttribute, getBpelModel, getBpelReference, getBpelReferenceList, getCookie, getCookies, getCorrectedText, getDomainAttributes, getEntityName, getModel, getNamespaceContext, getParent, getQNameAttribute, getSchemaReference, getSchemaReferenceList, getText, getUID, getWSDLReference, getWSDLReferenceList, handleAttributeChange, isDeleted, isInTree, postGlobalEvent, postGlobalEvent, readLock, readUnlock, removeAttribute, removeCookie, removeReference, setAttribute, setBpelAttribute, setBpelAttribute, setBpelAttribute, setBpelReference, setBpelReferenceList, setCookie, setCookies, setDeleted, setInTree, setInTreeRecursively, setSchemaReference, setText, setText, setUID, setWSDLReference, setWSDLReferenceList, updateReference, writeLock, writeUnlock
 
Methods inherited from class org.netbeans.modules.xml.xam.dom.AbstractDocumentComponent
addPrefix, appendChildQuietly, createPrefixAttribute, ensureUnique, ensureValueNamespaceDeclared, findAttributePosition, findChildComponent, findChildComponentByIdentity, findDomainIndex, findPosition, fireChildAdded, fireChildRemoved, firePropertyChange, fireValueChanged, getAccess, getAnyAttribute, getAttributeMap, getChildElement, getChildElementText, getEffectiveParent, getLeadingText, getNamespaceURI, getNodeIndexOf, getPeer, getPrefixedName, getPrefixedName, getPrefixedName, getPrefixes, getQName, getQName, getText, getText, getTrailingText, getXmlFragment, getXmlFragmentInclusive, insertAtIndexQuietly, isInDocumentModel, lookupNamespaceURI, lookupNamespaceURI, lookupPrefix, referencesSameNode, removeAttributeQuietly, removeChildQuietly, removePrefix, resolveModel, setAnyAttribute, setAttributeQuietly, setChildElementText, setLeadingText, setQNameAttribute, setText, setTrailingText, setXmlFragment, updatePeer, updateReference, updateReference, updateReference, verifyWrite
 
Methods inherited from class org.netbeans.modules.xml.xam.AbstractComponent
addAfter, addBefore, addPropertyChangeListener, appendChild, checkNullOrDuplicateChild, getChildren, getChildren, insertAtIndex, insertAtIndex, isChildrenInitialized, removeChild, removeComponentListener, removePropertyChangeListener, setChild, setChild, setChildAfter, setChildBefore, setModel, setParent
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 
Methods inherited from interface org.netbeans.modules.bpel.model.api.BpelEntity
accept, accept, copy, cut, getBpelModel, getCookie, getElementType, getNamespaceContext, getParent, getUID, removeCookie, setCookie
 
Methods inherited from interface org.netbeans.modules.xml.xam.dom.DocumentComponent
findAttributePosition, findChildComponent, findPosition, getAttribute, getPeer, isInDocumentModel, referencesSameNode, setAttribute
 
Methods inherited from interface org.netbeans.modules.xml.xam.Component
copy, getChildren, getChildren, getModel
 

Constructor Detail

BpelContainerImpl

protected BpelContainerImpl(BpelModelImpl model,
                            org.w3c.dom.Element e)

BpelContainerImpl

protected BpelContainerImpl(BpelBuilderImpl builder,
                            java.lang.String tagName)

BpelContainerImpl

protected BpelContainerImpl(BpelBuilderImpl builder,
                            BpelElements elem)
Method Detail

canPaste

public boolean canPaste(Component child)
Description copied from class: AbstractComponent
Default implementation, subclass need to override if needed.

Specified by:
canPaste in interface Component<BpelEntity>
Overrides:
canPaste in class BpelEntityImpl

create

protected abstract BpelEntity create(org.w3c.dom.Element element)
This method should be implemented by each container . Container should recognize in element its child and create Bpel element respectively. Warning! Here exist some possibility for error. Each container should recognize only those children that could be inside it as specification said. One cannot create one static mehtod for recognition all BPEL elements because f.e. container VariableContainer could have ONLY Variable inside it. It cannot have "flow" tag inside it ( it can have "flow" but this is just extention element that will not be treated as BPEL element ).

Parameters:
element -
Returns:

indexOf

public <T extends BpelEntity> int indexOf(java.lang.Class<T> type,
                                          T entity)
Description copied from interface: BpelContainer
Returns index of entity in children list with specified type. If entity is not child of this container then it returns -1.

Specified by:
indexOf in interface BpelContainer
Type Parameters:
T - Bpel entity type.
Parameters:
type - Bpel entity class.
entity - Child entity in this container.
Returns:
Index of entity.

remove

public <T extends BpelEntity> void remove(T entity)
Description copied from interface: BpelContainer
Common method for deleting child from this parent.

Specified by:
remove in interface BpelContainer
Type Parameters:
T - type of entity.
Parameters:
entity - element for remove.

getChildren

public <T extends BpelEntity> java.util.List<T> getChildren(java.lang.Class<T> type)
Specified by:
getChildren in interface Component<BpelEntity>
Overrides:
getChildren in class AbstractComponent<BpelEntity>
Parameters:
type - Interested children type to return.
Returns:
the contained elements, this is the model element representations of the DOM children.

getMultiplicity

protected BpelContainerImpl.Multiplicity getMultiplicity(BpelEntity entity)
This method should be overriden in concrete implementation if entity can present in this container with not unbounded multiplicity.


getChildType

protected <T extends BpelEntity> java.lang.Class<? extends BpelEntity> getChildType(T entity)
This method possibly needs to be overriden by some containers... F.e. it SHOULD to be overriden ActivityHolder and CompositeActivity because in these cases those containers contains elements as a whole they don't distinguish them by its own types ( Empty.class , etc. ). They need to count index for such children in common array ,not personal array.


getChild

protected <T extends BpelEntity> T getChild(java.lang.Class<T> type)
Overrides:
getChild in class AbstractComponent<BpelEntity>

getChild

protected <T extends BpelEntity> T getChild(java.lang.Class<T> type,
                                            int i)

setArrayAfter

protected <T extends BpelEntity> void setArrayAfter(T[] entities,
                                                    java.lang.Class<T> clazz,
                                                    BpelTypes... types)
This method removes all old elements in array and set new list of elements with specified clazz type. This method add entities array right AFTER elements with type in types array.


setArrayBefore

protected <T extends BpelEntity> void setArrayBefore(T[] entities,
                                                     java.lang.Class<T> clazz,
                                                     BpelTypes... types)
This method removes all old elements in array and set new list of elements with specified clazz type. This method add entities array right BEFORE elements with type in types array.


addChildBefore

protected <T extends BpelEntity> void addChildBefore(T entity,
                                                     java.lang.Class<T> clazz,
                                                     BpelTypes... types)

addChildAfter

protected <T extends BpelEntity> void addChildAfter(T entity,
                                                    java.lang.Class<T> clazz,
                                                    BpelTypes... types)

addChild

protected <T extends BpelEntity> void addChild(T entity,
                                               java.lang.Class<T> clazz)
This method adds entity element to the end of children list in this container. This is useful method when we have container with only one element types. Then we just need to append element.

Parameters:
entity -
clazz -

insertAtIndex

protected <T extends BpelEntity> void insertAtIndex(T entity,
                                                    java.lang.Class<T> clazz,
                                                    int index,
                                                    BpelTypes... types)

insertAtAbsoluteIndex

protected <T extends BpelEntity> boolean insertAtAbsoluteIndex(T entity,
                                                               java.lang.Class<T> clazz,
                                                               int index)
This method is used by SyncUpdateVisitor for inserting element with given index. Index is absolute index in common children list for this container. We need to recalculate this index respectively clazz type children list.

Returns:
false if inserting was not performed. So There should be "add" performed instead of insert. We don't know how to perform "add" because of ordering issue ( we possibly need to know class type for object that follow clazz type ).

insertAtIndexAfter

protected <T extends BpelEntity> void insertAtIndexAfter(T entity,
                                                         java.lang.Class<T> clazz,
                                                         int index,
                                                         BpelTypes... types)

setChildAtIndex

protected <T extends BpelEntity> void setChildAtIndex(T entity,
                                                      java.lang.Class<T> clazz,
                                                      int index)

setChild

protected <T extends BpelEntity> void setChild(T newEl,
                                               java.lang.Class<T> classType,
                                               BpelTypes... types)
This method will be used consistently when one need to insert element as child in some container. We need to keep some order for children in many containers and will always use types as "next" elements even if container doesn't have any children in types. Element will be added BEFORE elements in types array.


removeChild

protected void removeChild(java.lang.Class<? extends BpelEntity> classType)

removeChild

protected void removeChild(java.lang.Class<? extends BpelEntity> classType,
                           int i)

populateChildren

protected void populateChildren(java.util.List<BpelEntity> children)
Overrides:
populateChildren in class BpelEntityImpl

isRegular

final boolean isRegular(BpelEntity entity)
This method is used for determening regularity of element. Regular element means "correct" element from API point of view. There is possibility for element to be OM entity but is not valid element from API OM point of view. F.e. many activities in Process are not allowed. So only first activity is correct. All others are valid OM entity but not correctly located. User can always work with such non-regular entities from source editor. But design view based on OM will not allow to user work with such elements. This method helps determine such elements and it will be used for distinguishing elements that could be subject of events in OM and non-regular elements that will be not subjects of events.

Returns:
Is entity regular.