com.togethersoft.openapi.model.util
Class ChildrenProviderAdapter


public abstract class ChildrenProviderAdapter
implements ChildrenProvider, UniqueNameProvider

This class is an adapter for children providers. To implement generic children
provider it is necessary to extend this class and correctly implement abstract
methods. Such provider if registered will participate only in
Entity.children() method invocation. If you wish your provider
to participate in such methods as Entity.childNodes() or
Entity.childLinks() you should implement corresponding empty
interfaces (ChildNodesProvider, ChildLinksProvider).

Author:
TogetherSoft

Method Summary
 booleancanCreateUniqueName(Entity parent, String shapeType)
           
 booleancanDelete(PropertyMap propertyMap)
           
 abstract StringEnumerationchildren(Entity parent)
          This method should return enumeration of unique names of elements which
are children of the given entity.
 StringcreateUniqueName(Entity parent, String shapeType)
           
 voiddelete(PropertyMap propertyMap)
           
 abstract booleanisApplicable(Entity parent)
          This method should return true if this provider can
return children of the given entity
 abstract booleanisApplicable(String uniqueName)
          This method should return true if an element having the
given uniqueName exists in the model.
 abstract booleanisApplicable(PropertyMap propertyMap)
          This method should return true if this provider can somehow
deal with the given property map deleting.
 abstract booleanisDeleted(PropertyMap propertyMap)
          This method should return actual information.

Method Detail

canCreateUniqueName

public boolean canCreateUniqueName(Entity parent, String shapeType)

canDelete

public boolean canDelete(PropertyMap propertyMap)

children

public abstract StringEnumeration children(Entity parent)
This method should return enumeration of unique names of elements which
are children of the given entity. It is guaraneteed that model calls
this method only if previous call of isApplicable(Entity)
for the same value of argument returned true (it means
that you can do all necessary fast checks in
isApplicable(Entity) and do not check them once again in
children(Entity).
Parameters:
parent Entity whose children are calculated

createUniqueName

public String createUniqueName(Entity parent, String shapeType)

delete

public void delete(PropertyMap propertyMap)

isApplicable

public abstract boolean isApplicable(Entity parent)
This method should return true if this provider can
return children of the given entity
Parameters:
parent Entity whose children are calculated

isApplicable

public abstract boolean isApplicable(String uniqueName)
This method should return true if an element having the
given uniqueName exists in the model. Here the word
"exists" does not mean "element is instantiated", "element has been once
accessed", etc. Meaning of existence here is "available in principle".
In general case this method is called when user invokes
Model.findElement(String).

isApplicable

public abstract boolean isApplicable(PropertyMap propertyMap)
This method should return true if this provider can somehow
deal with the given property map deleting. This method is always invoked
before isDeleted(), canDelete() and delete(). You can
do fast checks and tests of the parameter in this method.

isDeleted

public abstract boolean isDeleted(PropertyMap propertyMap)
This method should return actual information. If the given property map
is actually deleted then this method should return true
otherwise it should return false. Passes parameter can
be instance of either Element or Reference.
It is guaranteed that this method is invoked by model only if
isApplicable(PropertyMap) has returned true for
the same value of parameter. It means that you can do all fast checks
in isApplicable(PropertyMap) and not repeat them in this
method