public class MultiSegmentExpander extends Object implements EMFFormsDMRSegmentExpander
EMFFormsDMRSegmentExpander
implementation for VMultiDomainModelReferenceSegments
.NOT_APPLICABLE
Constructor and Description |
---|
MultiSegmentExpander() |
Modifier and Type | Method and Description |
---|---|
protected void |
activate(org.osgi.framework.BundleContext bundleContext)
Called by the framework when the component gets activated.
|
protected void |
deactivate(org.osgi.framework.BundleContext bundleContext)
Called by the framework when the component gets deactivated.
|
double |
isApplicable(VDomainModelReferenceSegment segment)
Returns how suitable this
EMFFormsDMRSegmentExpander is for the given
VDomainModelReferenceSegment . |
boolean |
needsToExpandLastSegment()
Returns whether a supported
segment needs to be expanded when it is the last
segment of a VDomainModelReferenceSegment . |
Optional<org.eclipse.emf.ecore.EObject> |
prepareDomainObject(VDomainModelReferenceSegment segment,
org.eclipse.emf.ecore.EObject domainObject)
Prepares a
domain object for the given VDomainModelReferenceSegment . |
protected void |
setReportService(ReportService reportService)
Called by the framework to set the
ReportService . |
protected void setReportService(ReportService reportService)
ReportService
.reportService
- The ReportService
protected void activate(org.osgi.framework.BundleContext bundleContext)
bundleContext
- The BundleContext
protected void deactivate(org.osgi.framework.BundleContext bundleContext)
bundleContext
- The BundleContext
public Optional<org.eclipse.emf.ecore.EObject> prepareDomainObject(VDomainModelReferenceSegment segment, org.eclipse.emf.ecore.EObject domainObject) throws EMFFormsExpandingFailedException
domain object
for the given VDomainModelReferenceSegment
. Thereby, the feature
defined by the segment is analyzed and if it is a reference, the missing target object will be created. Thereby,
the segment is not changed. The target of the segment's feature is returned. This is the created EObject
if it was created by this method or the already existing target of the segment's feature.
Example:
DMR: A -a-> B
The domain model is instance of A but does not reference an instance of B. The segment contains the feature 'a'.
=> An instance of B is created and referenced by the domain model. B is returned by this expander.
prepareDomainObject
in interface EMFFormsDMRSegmentExpander
segment
- The VDomainModelReferenceSegment
for which the domain object
should be
prepared.domainObject
- The domain object
to prepare.EObject
was created, it is returned,
otherwise the already existing target is returned. May return nothing. If the given segment was not the
DMR's last segment, this causes the DMR expansion process to fail.EMFFormsExpandingFailedException
- if the domain expansion fails.EMFFormsDMRSegmentExpander.prepareDomainObject(org.eclipse.emf.ecp.view.spi.model.VDomainModelReferenceSegment,
org.eclipse.emf.ecore.EObject)
public double isApplicable(VDomainModelReferenceSegment segment)
EMFFormsDMRSegmentExpander
EMFFormsDMRSegmentExpander
is for the given
VDomainModelReferenceSegment
.isApplicable
in interface EMFFormsDMRSegmentExpander
segment
- The VDomainModelReferenceSegment
for which an domain object
should
be prepared.EMFFormsDMRSegmentExpander
is to expand a domain object
for the given VDomainModelReferenceSegment
. Returns NOT_APPLICABLE if it's not
applicable.public boolean needsToExpandLastSegment()
EMFFormsDMRSegmentExpander
segment
needs to be expanded when it is the last
segment of a VDomainModelReferenceSegment
.needsToExpandLastSegment
in interface EMFFormsDMRSegmentExpander
Copyright © 2019. All rights reserved.