Problem regarding resolving proxy of cross model reference [message #715602] |
Sun, 14 August 2011 19:03 |
vaibhav Messages: 22 Registered: September 2010 |
Junior Member |
|
|
Hi ,
I have some problem regarding resolving proxies of cross emf references.Suppose class A has a cross references of class B with ecore attrributes "resolve proxies"= "false" .
1. A a = loadPersistedObject.load("C:\\LOCATION\\", "ABC");
2. System.out.println("before----------->"+a.getB().eIsProxy());
3. EObject resolveB = EcoreUtil.resolve(a.getB(), a);
4. System.out.println("after----------->"+a.getB().eIsProxy());
if i executed above code snippet i got following console output.
true.
true.
Well, in my usecase i need to achieve some thing like , after resolving proxies (means calling EcoreUtil.resolve(...)), i should get result of number 4 line within code snippet as "false", it means the proxy are resolved.
And After calling EcoreUtil.resolve(...), i can able to see the resolved object of Class B ,but "eisProxy()" still showing "true" .
Is there any ecore attribute i have to set or something else i have missed ?
Thanks in advance,
Regards,
Vaibhav
|
|
|
Re: Problem regarding resolving proxy of cross model reference [message #715610 is a reply to message #715602] |
Sun, 14 August 2011 20:07 |
Ed Merks Messages: 33140 Registered: July 2009 |
Senior Member |
|
|
Comments below
On 14/08/2011 12:03 PM, vaibhav wrote:
> Hi ,
> I have some problem regarding resolving proxies of cross emf
> references.Suppose class A has a cross references of class B with
> ecore attrributes "resolve proxies"= "false" .
Then the reference better be in the same document.
>
>
> 1. A a = loadPersistedObject.load("C:\\LOCATION\\", "ABC");
>
> 2. System.out.println("before----------->"+a.getB().eIsProxy());
> 3. EObject resolveB = EcoreUtil.resolve(a.getB(), a);
>
>
> 4. System.out.println("after----------->"+a.getB().eIsProxy());
>
>
>
> if i executed above code snippet i got following console output.
> true.
> true.
Is a.eResource().getResourceSet() != null?
>
>
> Well, in my usecase i need to achieve some thing like , after
> resolving proxies (means calling EcoreUtil.resolve(...)), i should
> get result of number 4 line within code snippet as "false", it means
> the proxy are resolved.
>
> And After calling EcoreUtil.resolve(...), i can able to see the
> resolved object of Class B ,but "eisProxy()" still showing "true" .
>
> Is there any ecore attribute i have to set or something else i have
> missed ?
Is it a cross document reference? Are you using absolute URIs to load
the resource?
>
> Thanks in advance,
> Regards,
> Vaibhav
>
>
Ed Merks
Professional Support: https://www.macromodeling.com/
|
|
|
|
|
|
|
|
Re: Problem regarding resolving proxy of cross model reference [message #715866 is a reply to message #715830] |
Mon, 15 August 2011 19:26 |
Ed Merks Messages: 33140 Registered: July 2009 |
Senior Member |
|
|
Comments below.
On 15/08/2011 10:16 AM, vaibhav wrote:
> Thanks Ed Merks i got it, but if i do enabled proxy resolution on the
> "b" feature, proxy got resolved while accessing the "b" reference
> from "a"(like a.getB()).
Yes, proxies are automatically resolved.
> Thats why i had put ecore attribute "resolving proxies"="false" on "b"
> feature.
So you don't want proxies to resolve...
>
> Because in my use case proxy should resolved on "b" feature, as an
> when we trying to do it manually means when we trying to resolve
> using ... EObject resolveB
> =EcoreUtil.resolve(a.getB(), a), and after resolving i should able
> to check whether proxy are resolve or not like this
> System.out.println("after----------->"+a.getB().eIsProxy());
The code you showed originally returns you the result of resolving the
proxy. It has no impact on the state of a. If you want a's state to
change, you'd have to call a.setB(resolveB).
>
>
> So is there are some way so that i can able to achieve this manually ?
Of course I have no idea why you don't want proxies to resolve
automatically.
>
>
> Thanks and Best Regards,
> Vaibhav
>
>
>
Ed Merks
Professional Support: https://www.macromodeling.com/
|
|
|
|
Re: Problem regarding resolving proxy of cross model reference [message #717859 is a reply to message #717817] |
Mon, 22 August 2011 14:40 |
Ed Merks Messages: 33140 Registered: July 2009 |
Senior Member |
|
|
Vaibbhav,
Comments below.
On 22/08/2011 6:02 AM, vaibhav wrote:
> Thanks for the reply,
>
> But there is just one more issue with the setB scenario. For me to
> explicitly call setB() on object a, I will have to open a write
> transaction on Object a which is also within the scope of an eclipse
> editor.
Yes and as I keep saying, I have no idea why you need to do this manually.
> I do not want to make the model dirty for a read operation until and
> unless the user has triggered a edit for it.
So what's wrong with proxies that automatically resolve?
> The use case is that the user has expanded a tree and i need to load
> some data of the children without the editor being made dirty yet.
> Basically I don't want to make the model dirty. Is there a way to
> achieve this?
Again, automatically resolving proxies seem ideal for this. Why not?
>
> Regards,
> Vaibbhav.
Ed Merks
Professional Support: https://www.macromodeling.com/
|
|
|
Powered by
FUDForum. Page generated in 0.03790 seconds