Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Modeling » EMF "Technology" (Ecore Tools, EMFatic, etc)  » [Texo] Problems unsetting attributes
[Texo] Problems unsetting attributes [message #1553161] Thu, 08 January 2015 14:36 Go to next message
Bastian Wagenfeld is currently offline Bastian WagenfeldFriend
Messages: 183
Registered: January 2013
Senior Member
Hi Martin,

I've got problems with unsetting (setting to null) attributes with the new 0.9.0 version. The version 0.1.0 works fine.
The details: The RCP holds an EMF resource with all needed objects. The object has values in it, that are set to null. Afterwards the resource is saved, but the object holds the old values. Changing those values is not a problem, only setting them to null. No error message is displayed.
The client uses the latest 0.9.0 version. If the server is running with 0.1.0 everything works fine.

Are you able to reproduce this?

Best regards
Bastian
Re: [Texo] Problems unsetting attributes [message #1553181 is a reply to message #1553161] Thu, 08 January 2015 14:54 Go to previous messageGo to next message
Martin Taal is currently offline Martin TaalFriend
Messages: 5468
Registered: July 2009
Senior Member
Hi Bastian,
For the 0.9.0 release I did not change much in Texo itself, it was mostly changes in testcases and build infrastructure
to make the build/tests work on Luna and latest EMF versions.

However, I changed behavior related to bidirectional ereferences.

The values you refer to, are they eattributes or ereferences?

Did you also update the EMF version? And a final question, were you on the latest Texo 0.1.0 version or an earlier one?

gr. Martin


On 08-01-15 15:36, Bastian Wagenfeld wrote:
> Hi Martin,
>
> I've got problems with unsetting (setting to null) attributes with the new 0.9.0 version. The version 0.1.0 works fine.
> The details: The RCP holds an EMF resource with all needed objects. The object has values in it, that are set to null.
> Afterwards the resource is saved, but the object holds the old values. Changing those values is not a problem, only
> setting them to null. No error message is displayed.
> The client uses the latest 0.9.0 version. If the server is running with 0.1.0 everything works fine.
> Are you able to reproduce this?
> Best regards
> Bastian


--

With Regards, Martin Taal

Springsite/Elver.org
Office: Hardwareweg 4, 3821 BV Amersfoort
Postal: Nassaulaan 7, 3941 EC Doorn
The Netherlands
Cell: +31 (0)6 288 48 943
Tel: +31 (0)84 420 2397
Fax: +31 (0)84 225 9307
Mail: mtaal@xxxxxxxx - mtaal@xxxxxxxx
Web: www.springsite.com - www.elver.org
Re: [Texo] Problems unsetting attributes [message #1554366 is a reply to message #1553181] Fri, 09 January 2015 06:38 Go to previous messageGo to next message
Bastian Wagenfeld is currently offline Bastian WagenfeldFriend
Messages: 183
Registered: January 2013
Senior Member
Hi,

now I see I wasn't right, that this only happens in the latest version, but my tests were not quite sufficient. And furthermore this occurs on the client. The EMFJsonConverter somehow removes the values that are marked as -<unset>. For example there is a Point with a max, min and average. The values are set like this:

{ "_eclass" : "request|ActionType",
  "_title" : "PointName",
  "delete" : [  ],
  "insert" : [  ],
  "update" : [ { "_eclass" : "inspections|Point",
        "_id" : "1512169",
        "_title" : "PointName",
        "_uri" : "http://localhost:8080/test/jsonws/inspections|Point/1512169#",
        "db_Id" : "1512169",
        "db_version" : "21",
        "max" : "7.0",
        "min" : "1.5",
        "average" : "6.0"
      } ]
}


If one value is unset (e.g. the min) the JSON only looks like:
{ "_eclass" : "request|ActionType",
  "_title" : "PointName",
  "delete" : [  ],
  "insert" : [  ],
  "update" : [ { "_eclass" : "inspections|Point",
        "_id" : "1512169",
        "_title" : "PointName",
        "_uri" : "http://localhost:8080/test/jsonws/inspections|Point/1512169#",
        "db_Id" : "1512169",
        "db_version" : "21",
        "max" : "7.0",
        "average" : "6.0"
      } ]
}


The whole attribute is missing.
I'm going to debug into this further and let you know, why this happens.

Best regards
Bastian
Re: [Texo] Problems unsetting attributes [message #1554397 is a reply to message #1554366] Fri, 09 January 2015 07:03 Go to previous messageGo to next message
Bastian Wagenfeld is currently offline Bastian WagenfeldFriend
Messages: 183
Registered: January 2013
Senior Member
Hi,

the method Object toJSON(Object source, final Object value, final EDataType eDataType) in class JSONValueConverter is called with value == null and eDataType of EDoubleObject. The condition if (eDataType.getEPackage() == EcorePackage.eINSTANCE) evaluates to true, so EcoreFactory.eINSTANCE.convertToString(eDataType, value) is entered, which returns null. I expected it to return JSONObject.NULL. But that part won't be reached. My solution would be to overwrite this class and shift
if (value == null) {
      return JSONObject.NULL;
    }
a little higher.

Best regards
Bastian
Re: [Texo] Problems unsetting attributes [message #1554676 is a reply to message #1554397] Fri, 09 January 2015 10:36 Go to previous messageGo to next message
Martin Taal is currently offline Martin TaalFriend
Messages: 5468
Registered: July 2009
Senior Member
Yes makes sense, can you enter a bugzilla? Then I will push the change shortly against that issue.

gr. Martin

On 09-01-15 08:03, Bastian Wagenfeld wrote:
> Hi,
>
> the method Object toJSON(Object source, final Object value, final EDataType eDataType) in class JSONValueConverter is
> called with value == null and eDataType of EDoubleObject. The condition if (eDataType.getEPackage() ==
> EcorePackage.eINSTANCE) evaluates to true, so EcoreFactory.eINSTANCE.convertToString(eDataType, value) is entered, which
> returns null. I expected it to return JSONObject.NULL. But that part won't be reached. My solution would be to overwrite
> this class and shift if (value == null) {
> return JSONObject.NULL;
> } a little higher.
> Best regards Bastian


--

With Regards, Martin Taal

Springsite/Elver.org
Office: Hardwareweg 4, 3821 BV Amersfoort
Postal: Nassaulaan 7, 3941 EC Doorn
The Netherlands
Cell: +31 (0)6 288 48 943
Tel: +31 (0)84 420 2397
Fax: +31 (0)84 225 9307
Mail: mtaal@xxxxxxxx - mtaal@xxxxxxxx
Web: www.springsite.com - www.elver.org
Re: [Texo] Problems unsetting attributes [message #1554743 is a reply to message #1554676] Fri, 09 January 2015 11:30 Go to previous messageGo to next message
Bastian Wagenfeld is currently offline Bastian WagenfeldFriend
Messages: 183
Registered: January 2013
Senior Member
Hi Martin,

created a case here: https://bugs.eclipse.org/bugs/show_bug.cgi?id=457133
Overriding the JSONEMFValueConverter and check for a null value earlier solves the problem.

Thanks
Bastian
Re: [Texo] Problems unsetting attributes [message #1559699 is a reply to message #1554743] Mon, 12 January 2015 06:34 Go to previous message
Bastian Wagenfeld is currently offline Bastian WagenfeldFriend
Messages: 183
Registered: January 2013
Senior Member
Hi Martin,

the fix works for me.

Thanks
Bastian
Previous Topic:[Teneo] Hibernate 4.3
Next Topic:[EMFForms] Render and RenderTester in different Bundles
Goto Forum:
  


Current Time: Thu Apr 02 14:08:51 GMT 2020

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

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

Back to the top