Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Modeling » EMF "Technology" (Ecore Tools, EMFatic, etc)  » EMFStore Conflict Detection
EMFStore Conflict Detection [message #1400766] Mon, 14 July 2014 17:32 Go to next message
Scott Dybiec is currently offline Scott DybiecFriend
Messages: 148
Registered: July 2009
Senior Member
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
Re: EMFStore Conflict Detection [message #1401530 is a reply to message #1400766] Tue, 15 July 2014 19:23 Go to previous messageGo to next message
Edgar Mueller is currently offline Edgar MuellerFriend
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 Go to previous messageGo to next message
Edgar Mueller is currently offline Edgar MuellerFriend
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 Go to previous message
Scott Dybiec is currently offline Scott DybiecFriend
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
>
>
Previous Topic:[EMFStore]How to create model element ID
Next Topic:[ECP] Multiple views for the same EObject
Goto Forum:
  


Current Time: Tue Mar 19 10:24:10 GMT 2024

Powered by FUDForum. Page generated in 0.02877 seconds
.:: Contact :: Home ::.

Powered by: FUDforum 3.0.2.
Copyright ©2001-2010 FUDforum Bulletin Board Software

Back to the top