Class MappingSegmentExpander
- java.lang.Object
-
- org.eclipse.emfforms.internal.core.services.segments.mapping.MappingSegmentExpander
-
- All Implemented Interfaces:
EMFFormsDMRSegmentExpander
public class MappingSegmentExpander extends java.lang.Object implements EMFFormsDMRSegmentExpander
- Author:
- Lucas Koehler
-
-
Field Summary
-
Fields inherited from interface org.eclipse.emfforms.spi.core.services.domainexpander.EMFFormsDMRSegmentExpander
NOT_APPLICABLE
-
-
Constructor Summary
Constructors Constructor Description MappingSegmentExpander()
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description 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
-
isApplicable
public double isApplicable(VDomainModelReferenceSegment segment)
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. - See Also:
EMFFormsDMRSegmentExpander.isApplicable(org.eclipse.emf.ecp.view.spi.model.VDomainModelReferenceSegment)
-
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)
-
needsToExpandLastSegment
public boolean needsToExpandLastSegment()
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
- See Also:
EMFFormsDMRSegmentExpander.needsToExpandLastSegment()
-
-