Home » Modeling » EMF "Technology" (Ecore Tools, EMFatic, etc) » EMFStore Conflict Detection
|
Re: EMFStore Conflict Detection [message #1401530 is a reply to message #1400766] |
Tue, 15 July 2014 19:23 |
Edgar Mueller Messages: 89 Registered: March 2011 |
Member |
|
|
Hi Scott,
yes there is a way to customize conflict detection and handling.
What you will need to do is to register a custom ReservationSetModifier,
which allows you to make various kind of reservations on features during
an update to indicate which feature will be modified by an operation. If
two or more reservations happen to be on the same feature, a conflict
will be raised. Thus you should be able to encode your requirements to
raise a conflict in case your elements are not unique.
Your reservation set modifier will probably look something like this:
public class MyReservationSetModifier implements ReservationSetModifier {
@Override
public ReservationSet addCustomReservation(
AbstractOperation operation,
ReservationSet reservationSet,
ModelElementIdToEObjectMapping mapping) {
if (CompositeOperation.class.isInstance(operation)) {
for (AbstractOperation subOp :
CompositeOperation.class.cast(
operation).getSubOperations()) {
addCustomReservation(subOp, reservationSet, mapping);
}
return reservationSet;
} else if (CreateDeleteOperation.class.isInstance(operation)) {
for (AbstractOperation subOp :
CreateDeleteOperation.class.cast(
operation).getSubOperations()) {
addCustomReservation(subOp, reservationSet, mapping);
}
return reservationSet;
}
// TODO: check for desired operation and make custom reservations
return reservationSet;
}
Because conflict detection and handling is considered to be internal
API, we don't provide extension points for it, such that you will need
to register your custom reservation set modifier via the internal
ExtensionRegistry:
ExtensionRegistry.INSTANCE.set(
ReservationSetModifier.ID,
new MyReservationSetModifier());
Hope this helps!
Cheers,
Edgar
Am 14.07.2014 19:32, schrieb scott@xxxxxxxx:
> When updating and committing in EMFStore, I would like to ensure their
> are no duplicates added to a containment list ---- that duplicates (as
> defined by an application) are detected as conflicts. Today if two users
> add elements to a containment reference with the same application "key",
> EMFStore merges them both in to the same list.
>
> Is there any way to customize the conflict detection behavior so that
> EMFStore can detect user-defined duplicate model elements in a
> containment list?
>
> Thanks,
>
> Scott
--
Edgar Mueller
Get Professional Eclipse Support: http://eclipsesource.com/munich
|
|
|
Re: EMFStore Conflict Detection [message #1401531 is a reply to message #1400766] |
Tue, 15 July 2014 19:23 |
Edgar Mueller Messages: 89 Registered: March 2011 |
Member |
|
|
Hi Scott,
yes there is a way to customize conflict detection and handling.
What you will need to do is to register a custom ReservationSetModifier,
which allows you to make various kind of reservations on features during
an update to indicate which feature will be modified by an operation. If
two or more reservations happen to be on the same feature, a conflict
will be raised. Thus you should be able to encode your requirements to
raise a conflict in case your elements are not unique.
Your reservation set modifier will probably look something like this:
public class MyReservationSetModifier implements ReservationSetModifier {
@Override
public ReservationSet addCustomReservation(
AbstractOperation operation,
ReservationSet reservationSet,
ModelElementIdToEObjectMapping mapping) {
if (CompositeOperation.class.isInstance(operation)) {
for (AbstractOperation subOp :
CompositeOperation.class.cast(
operation).getSubOperations()) {
addCustomReservation(subOp, reservationSet, mapping);
}
return reservationSet;
} else if (CreateDeleteOperation.class.isInstance(operation)) {
for (AbstractOperation subOp :
CreateDeleteOperation.class.cast(
operation).getSubOperations()) {
addCustomReservation(subOp, reservationSet, mapping);
}
return reservationSet;
}
// TODO: check for desired operation and make custom reservations
return reservationSet;
}
Because conflict detection and handling is considered to be internal
API, we don't provide extension points for it, such that you will need
to register your custom reservation set modifier via the internal
ExtensionRegistry:
ExtensionRegistry.INSTANCE.set(
ReservationSetModifier.ID,
new MyReservationSetModifier());
Hope this helps!
Cheers,
Edgar
Am 14.07.2014 19:32, schrieb scott@xxxxxxxx:
> When updating and committing in EMFStore, I would like to ensure their
> are no duplicates added to a containment list ---- that duplicates (as
> defined by an application) are detected as conflicts. Today if two users
> add elements to a containment reference with the same application "key",
> EMFStore merges them both in to the same list.
>
> Is there any way to customize the conflict detection behavior so that
> EMFStore can detect user-defined duplicate model elements in a
> containment list?
>
> Thanks,
>
> Scott
--
Edgar Mueller
Get Professional Eclipse Support: http://eclipsesource.com/munich
|
|
|
Re: EMFStore Conflict Detection [message #1401545 is a reply to message #1401530] |
Tue, 15 July 2014 19:59 |
Scott Dybiec Messages: 148 Registered: July 2009 |
Senior Member |
|
|
You guys are geniuses. I'll give it a try and let you know how it goes.
Thanks for the quick response.
Scott
On 7/15/2014 3:23 PM, Edgar Mueller wrote:
> Hi Scott,
>
> yes there is a way to customize conflict detection and handling.
> What you will need to do is to register a custom ReservationSetModifier,
> which allows you to make various kind of reservations on features during
> an update to indicate which feature will be modified by an operation. If
> two or more reservations happen to be on the same feature, a conflict
> will be raised. Thus you should be able to encode your requirements to
> raise a conflict in case your elements are not unique.
>
> Your reservation set modifier will probably look something like this:
>
> public class MyReservationSetModifier implements ReservationSetModifier {
>
> @Override
> public ReservationSet addCustomReservation(
> AbstractOperation operation,
> ReservationSet reservationSet,
> ModelElementIdToEObjectMapping mapping) {
>
> if (CompositeOperation.class.isInstance(operation)) {
> for (AbstractOperation subOp :
> CompositeOperation.class.cast(
> operation).getSubOperations()) {
>
> addCustomReservation(subOp, reservationSet, mapping);
> }
> return reservationSet;
> } else if (CreateDeleteOperation.class.isInstance(operation)) {
> for (AbstractOperation subOp :
> CreateDeleteOperation.class.cast(
> operation).getSubOperations()) {
>
> addCustomReservation(subOp, reservationSet, mapping);
> }
> return reservationSet;
> }
>
> // TODO: check for desired operation and make custom reservations
>
> return reservationSet;
> }
>
> Because conflict detection and handling is considered to be internal
> API, we don't provide extension points for it, such that you will need
> to register your custom reservation set modifier via the internal
> ExtensionRegistry:
>
> ExtensionRegistry.INSTANCE.set(
> ReservationSetModifier.ID,
> new MyReservationSetModifier());
>
> Hope this helps!
>
> Cheers,
> Edgar
>
>
> Am 14.07.2014 19:32, schrieb scott@xxxxxxxx:
>> When updating and committing in EMFStore, I would like to ensure their
>> are no duplicates added to a containment list ---- that duplicates (as
>> defined by an application) are detected as conflicts. Today if two users
>> add elements to a containment reference with the same application "key",
>> EMFStore merges them both in to the same list.
>>
>> Is there any way to customize the conflict detection behavior so that
>> EMFStore can detect user-defined duplicate model elements in a
>> containment list?
>>
>> Thanks,
>>
>> Scott
>
>
|
|
|
Goto Forum:
Current Time: Tue Mar 19 10:24:10 GMT 2024
Powered by FUDForum. Page generated in 0.02877 seconds
|