Class MultiSegmentExpander
- java.lang.Object
-
- org.eclipse.emfforms.internal.core.services.segments.multi.MultiSegmentExpander
-
- All Implemented Interfaces:
EMFFormsDMRSegmentExpander
public class MultiSegmentExpander extends java.lang.Object implements EMFFormsDMRSegmentExpander
EMFFormsDMRSegmentExpander
implementation forVMultiDomainModelReferenceSegments
.- Author:
- Lucas Koehler
-
-
Field Summary
-
Fields inherited from interface org.eclipse.emfforms.spi.core.services.domainexpander.EMFFormsDMRSegmentExpander
NOT_APPLICABLE
-
-
Constructor Summary
Constructors Constructor Description MultiSegmentExpander()
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method 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 thisEMFFormsDMRSegmentExpander
is for the givenVDomainModelReferenceSegment
.boolean
needsToExpandLastSegment()
Returns whether a supportedsegment
needs to be expanded when it is the last segment of aVDomainModelReferenceSegment
.java.util.Optional<org.eclipse.emf.ecore.EObject>
prepareDomainObject(VDomainModelReferenceSegment segment, org.eclipse.emf.ecore.EObject domainObject)
Prepares adomain object
for the givenVDomainModelReferenceSegment
.protected void
setReportService(ReportService reportService)
Called by the framework to set theReportService
.
-
-
-
Method Detail
-
setReportService
protected void setReportService(ReportService reportService)
Called by the framework to set theReportService
.- Parameters:
reportService
- TheReportService
-
activate
protected void activate(org.osgi.framework.BundleContext bundleContext)
Called by the framework when the component gets activated.- Parameters:
bundleContext
- TheBundleContext
-
deactivate
protected void deactivate(org.osgi.framework.BundleContext bundleContext)
Called by the framework when the component gets deactivated.- Parameters:
bundleContext
- TheBundleContext
-
prepareDomainObject
public java.util.Optional<org.eclipse.emf.ecore.EObject> prepareDomainObject(VDomainModelReferenceSegment segment, org.eclipse.emf.ecore.EObject domainObject) throws EMFFormsExpandingFailedException
Prepares adomain object
for the givenVDomainModelReferenceSegment
. 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 createdEObject
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.- Specified by:
prepareDomainObject
in interfaceEMFFormsDMRSegmentExpander
- Parameters:
segment
- TheVDomainModelReferenceSegment
for which thedomain object
should be prepared.domainObject
- Thedomain object
to prepare.- Returns:
- The new target of the segment's feature. If an
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. - Throws:
EMFFormsExpandingFailedException
- if the domain expansion fails.- See Also:
EMFFormsDMRSegmentExpander.prepareDomainObject(org.eclipse.emf.ecp.view.spi.model.VDomainModelReferenceSegment, org.eclipse.emf.ecore.EObject)
-
isApplicable
public double isApplicable(VDomainModelReferenceSegment segment)
Description copied from interface:EMFFormsDMRSegmentExpander
Returns how suitable thisEMFFormsDMRSegmentExpander
is for the givenVDomainModelReferenceSegment
.- Specified by:
isApplicable
in interfaceEMFFormsDMRSegmentExpander
- Parameters:
segment
- TheVDomainModelReferenceSegment
for which andomain object
should be prepared.- Returns:
- a value indicating how suitable this
EMFFormsDMRSegmentExpander
is to expand adomain object
for the givenVDomainModelReferenceSegment
. Returns NOT_APPLICABLE if it's not applicable.
-
needsToExpandLastSegment
public boolean needsToExpandLastSegment()
Description copied from interface:EMFFormsDMRSegmentExpander
Returns whether a supportedsegment
needs to be expanded when it is the last segment of aVDomainModelReferenceSegment
.- Specified by:
needsToExpandLastSegment
in interfaceEMFFormsDMRSegmentExpander
- Returns:
- Whether the last segment needs to be expanded
-
-