com.togethersoft.openapi.model.extension
Interface ReferenceProvider


public interface ReferenceProvider
extends Provider

Provider, which implements this interface is responsible for supplying functionality
of ReferenceCollections.
It is guaranteed, that before any other method is invoked, isApplicable method
with corresponding argument has been called and true has been returned.
Providers should keep list of references they provide on their own.

When it's neccessary to instantiate
reference (to return it from addReference or from references methods),
createReference method of ExtensionManager must be used.

Author:
TogetherSoft

Method Summary
 ReferenceaddReference(ReferenceCollection collection, Reference createdReference, Element element)
          This method is called, when addReference of ReferenceCollection was called.
 booleancanAddReference(ReferenceCollection collection, Element element)
          This method is called, when user invoked canAddReference opertaion of
ReferenceCollection or right before invoking of addReference
method.
 voidfinishSavingChanges(ReferenceDelta referenceDelta)
           
 booleanisApplicable(ReferenceCollection collection)
          This method is called before calling of any other method of provider for particular
ReferenceCollection.
 ReferenceEnumerationreferences(ReferenceCollection collection)
          This method must return list of References of collection.
 ReferenceDeltastartSavingChanges(ReferenceCollection collection)
           

Method Detail

addReference

public Reference addReference(ReferenceCollection collection, Reference createdReference, Element element)
This method is called, when addReference of ReferenceCollection was called.
It is guaranteed, that canAddReference method, called right before this, returned
true.
Provider must add reference for element to collection.
See notice about instantiation of new References in the interface description.

As multiple providers may be applicable to this collection, it's possible that
instance of Reference is already created by other provider. In this case it will
be passed to the method in createdReference argument and exactly this value must be
returned. Otherwise, new instance must be returned, if Reference was really added.
Parameters:
element element, which must be referenced
createdReference null or already instanced Reference
Returns: instance, passed as createdReference or new instance of
Reference, if createdReference is null

canAddReference

public boolean canAddReference(ReferenceCollection collection, Element element)
This method is called, when user invoked canAddReference opertaion of
ReferenceCollection or right before invoking of addReference
method.
Provider must return true if it is capable of adding reference to element
to collection

finishSavingChanges

public void finishSavingChanges(ReferenceDelta referenceDelta)

isApplicable

public boolean isApplicable(ReferenceCollection collection)
This method is called before calling of any other method of provider for particular
ReferenceCollection.
Provider must return true if it can work with this collection

references

public ReferenceEnumeration references(ReferenceCollection collection)
This method must return list of References of collection.
As instances of references must be returned, see notice about instantiation
in this interface description.

The result of collaborative execution of this method for multiple
providers registered in the model is a concatenation of the
enumerations returned by providers.


startSavingChanges

public ReferenceDelta startSavingChanges(ReferenceCollection collection)