|
Re: [cdo] which class is responsible for deleting a model element [message #1097195 is a reply to message #1097150] |
Thu, 29 August 2013 11:04 |
|
Am 29.08.2013 11:49, schrieb saurav singh:
> I am very new to CDO. I shifted to CDO due to some drawbacks in EMF-STORE. Coming to the point i created a ecore model
> then generated a genmodel[cdo native] and then generated edit and editor codes. Now I created a CDO server and running
> a CDO client as well. I am able to add model elements and and deleting as well. Some model elements which seeks for a
> reference model element, we have a drop down menu which shows all the elements to set a reference. Now i also created
> a Junit class to access CDO. I am able to add, setting references to model from Junit class also like UI. But the
> problem is following-
>
> 1)let say we have two model elements A and B both have a attribute ID but A has a reference to B
>
> A - ID , reference to B
> B - ID
>
> now if I delete B from UI ( right click on B and then delete) then this automatically setting reference field in A to
> null
Yes, I'm not an EMF Edit expert but I think org.eclipse.emf.edit.command.RemoveCommand does that.
> which is correct behavior.
Correct according to your requirements ;-)
> But if I delete B from Junit class using resource.getContents().remove(B); where resource is a object of CDOResource
> then its creating problem. like its not setting reference to null which is causing the problem of Dangling reference.
That's not a CDO-specific behaviour. A "normal" EMF model behaves in exactly the same way unless you use EcoreUtil.delete().
Please note that EcoreUtil.delete() employs a UsageCrossReferencer which can be highly inadequate in the context of huge
models. CDO offers API such as CDOView.queryXRefs() that allows you to find incoming references without loading the
entire model into the client.
> Now this is creating some serious issue like i wont be able to change the resource to some other model element neither
> from UI nor from Junit class.In UI its not showing any drop down option in reference field. And now i wont be able to
> delete A from UI or Junit class because of the dangling issue. So my question is that Which API should I use to delete
> a model element from Junit class which the delete from the UI might be using so that this problem of dangling
> reference should not happen.
>
> 2) I am using MYSQL as back end database. And i guess MYSQL support all the features ( which includes auditing view).
Yes, the set of available CDO functionality is not impacted by the JDBC driver choice.
> But i m not able to get the audit view. What config changes should i make in configuration file of the server to make
> the audit view working
Your cdo-server.xml must contain this line *before* you start the server for the first time:
<property name="supportingAudits" value="true"/>
> 3) Is it possible to make queries based on reference. For example let say we want to search for all the model elements
> which are referring to a model element let say B.
See above ;-)
And then there's also support for OCL queries and native SQL queries (the latter are a little tricky in combination with
auditing!).
Cheers
/Eike
----
http://www.esc-net.de
http://thegordian.blogspot.com
http://twitter.com/eikestepper
Cheers
/Eike
----
http://www.esc-net.de
http://thegordian.blogspot.com
http://twitter.com/eikestepper
|
|
|
|
|
|
|
Powered by
FUDForum. Page generated in 0.03229 seconds