Class Mapping<TRootModel extends org.eclipse.emf.ecore.EObject,TInput>
- java.lang.Object
-
- com._1c.g5.v8.dt.form.mapping.core.Mapping<TRootModel,TInput>
-
- Type Parameters:
TRootModel
- the root projection model typeTInput
- the root domain model type
- Direct Known Subclasses:
FormCommandInterfaceMapping
,FormIndependentCommandMapping
,FormItemsMapping
,FormParameterizedCommandMapping
public abstract class Mapping<TRootModel extends org.eclipse.emf.ecore.EObject,TInput> extends Object
The class creating and filling specific projection model.
-
-
Constructor Summary
Constructors Modifier Constructor Description protected
Mapping(Supplier<TInput> inputSupplier, Class<TRootModel> rootClass)
Initializes a new instance.protected
Mapping(TInput input, Class<TRootModel> rootClass)
Deprecated.
-
Method Summary
All Methods Instance Methods Abstract Methods Concrete Methods Modifier and Type Method Description protected void
addRelation(Object from, IMappingModel<? extends org.eclipse.emf.ecore.EObject> to)
Creates a relation between projection model and domain model.void
buildRootModel()
Starts the projection model loading.protected void
clearAllRelation()
This method removes all relation between mapping models and domain models.protected abstract void
clearRoot(TRootModel model)
The method clear root mapping model.protected DtObjectMap.IComparer<Object>
createComparer()
Creates a comparer forDtObjectMap
of relation between domain model and projection.protected abstract TRootModel
createRoot()
The method creates a new root projection model.void
dispose()
Disposes the current mapping and detach controller of it.protected abstract void
fillModel(TRootModel model, TInput input)
Methods fill projection model.void
fullUpdate()
This method full update all mapping model asynchronously.<TResult> TResult
get(IQuery<TResult,TRootModel> query)
The method allows to take data from projective model on means query object(IQuery
).TRootModel
getCompletedRoot()
Gets completed root projection model ornull
in case if it has not been created yet.IMappingModel<? extends org.eclipse.emf.ecore.EObject>
getRelatedModel(Object domain)
Get related projection model by domain modelClass<TRootModel>
getRootClass()
Class of root projection model.protected TRootModel
getRootModel()
Gets or creates root projection model synchronously.abstract void
handleEvent(AbstractEvent event)
The event processing.boolean
isDisposed()
Gets a value indicating that the current mapping has been already disposed.protected void
pushEvent(AbstractEvent event)
Fire all mapping model listeners through the current mapping contoller.protected void
removeRelation(Object from)
Removes all relation between projection model and domain model.protected void
removeRelation(Object from, IMappingModel<? extends org.eclipse.emf.ecore.EObject> mapping)
Removes a relation between projection model and domain model.void
setController(MappingController controller)
Sets a controller.
-
-
-
Constructor Detail
-
Mapping
@Deprecated protected Mapping(TInput input, Class<TRootModel> rootClass)
Deprecated.Constructor. Initialize require fields.- Parameters:
input
- the root domain modelrootClass
- the root class
-
Mapping
protected Mapping(Supplier<TInput> inputSupplier, Class<TRootModel> rootClass)
Initializes a new instance.- Parameters:
inputSupplier
- the root domain model supplier, can't benull
rootClass
- the root class, can't benull
-
-
Method Detail
-
getCompletedRoot
public TRootModel getCompletedRoot()
Gets completed root projection model ornull
in case if it has not been created yet.- Returns:
- the root object of projection model, can be
null
-
buildRootModel
public void buildRootModel()
Starts the projection model loading.
-
getRootClass
public Class<TRootModel> getRootClass()
Class of root projection model.- Returns:
- the class of root projection model
-
setController
public void setController(MappingController controller)
Sets a controller.- Parameters:
controller
- the controller, can benull
-
handleEvent
public abstract void handleEvent(AbstractEvent event)
The event processing. To the help of this method there is an evolution of a projection model.- Parameters:
event
- the event for processing, can't benull
-
getRelatedModel
public IMappingModel<? extends org.eclipse.emf.ecore.EObject> getRelatedModel(Object domain)
Get related projection model by domain model- Parameters:
domain
- the domain model- Returns:
- the projection model
- See Also:
CommonQuery#first()
-
get
public <TResult> TResult get(IQuery<TResult,TRootModel> query)
The method allows to take data from projective model on means query object(IQuery
).- Parameters:
query
- the query object.- Returns:
- the result.
-
fullUpdate
public void fullUpdate()
This method full update all mapping model asynchronously.
-
isDisposed
public boolean isDisposed()
Gets a value indicating that the current mapping has been already disposed.- Returns:
true
if has been already disposed, otherwise -false
-
dispose
public void dispose()
Disposes the current mapping and detach controller of it.
-
getRootModel
protected TRootModel getRootModel()
Gets or creates root projection model synchronously.Use
getCompletedRoot()
to avoid the root creation.- Returns:
- the root object of projection model, can be
null
-
addRelation
protected void addRelation(Object from, IMappingModel<? extends org.eclipse.emf.ecore.EObject> to)
Creates a relation between projection model and domain model.- Parameters:
from
- the domain model, can't benull
to
- the relation model, can't benull
-
removeRelation
protected void removeRelation(Object from)
Removes all relation between projection model and domain model.- Parameters:
from
- the domain model, can't benull
-
removeRelation
protected void removeRelation(Object from, IMappingModel<? extends org.eclipse.emf.ecore.EObject> mapping)
Removes a relation between projection model and domain model.- Parameters:
from
- the domain model, can't benull
mapping
- the mapping model, can't benull
-
clearAllRelation
protected void clearAllRelation()
This method removes all relation between mapping models and domain models.
-
pushEvent
protected void pushEvent(AbstractEvent event)
Fire all mapping model listeners through the current mapping contoller.- Parameters:
event
- the mapping model event, can't benull
-
createComparer
protected DtObjectMap.IComparer<Object> createComparer()
Creates a comparer forDtObjectMap
of relation between domain model and projection.- Returns:
- the new comparer, never
null
-
createRoot
protected abstract TRootModel createRoot()
The method creates a new root projection model.- Returns:
- the root model of mapping, never
null
-
fillModel
protected abstract void fillModel(TRootModel model, TInput input)
Methods fill projection model.- Parameters:
model
- the root projection model for filling, can't benull
input
- the root domain model, can't benull
-
clearRoot
protected abstract void clearRoot(TRootModel model)
The method clear root mapping model.- Parameters:
model
- the root mapping model, can't benull
-
-