Developer Forum »
Enable Odata on properties on native type
62 posts

In the ontology-module I am trying to enable odata on several properties for a native type (SystemUser). Every time the "full rebuild" is completed, only one of the properties is enabled even though I checked several. Is this a bug or am I doing something wrong?

181 posts

Hi!

I've been testing a bit now, both on build 1230 and 1477. Both work as expected when I specify that properties should be added to the OData endpoint.

Some pointers:

  • Enable OData for the installation System module -> Settings -> OData tab
  • If you do not check the Expore all properties and Expose all classes, you need to specify individually which properties should be included in the OData endpoint.
  • To do that, go to the Ontology module. For non-native types, go to the class settings first, and specify OData Read Access. Then, for each of the properties you want to expose in the OData endpoint, you have to open the settings tab, and check the "OData enabled" checkbox.
  • For native types, you have to follow the regular pattern of adding a change to the built-in type. First you have to add the change to the class, and set the "OData Read Access". Then you have to add the change properties you want to include in OData, and remember to check the "OData enabled" checkbox.
  • Then you have to do a full rebuild, so that the system can generate the OData object model that the OData endpoint uses. 
  • If everything is setup correctly, you should be able to go to the OData url and start do query the endpoint.
  Let me know if you're not able to get it working following the steps above.
31 posts

Hi,

My current build is 1509.

I am trying to enable OData for native property "Children" in a non-native class which inherites from Native.HierarchicalFolder. When I run full rebuild I get an error (see screenshot 1). If I ignore the error and continue with the rebuild, then I get the error seen in screenshot 2.

I have also tried to change the parent class (HierarchicalFolder) and enable "OData read access" in settings, and changing the Children property by using the button "Change existing property". This didn't work either, same error. Even if it did work, it wouldn't help me much. Because, what I'm trying to achieve is to enable OData access to the children of the new class which I have created for this purpose, not for all folders (nodes of type HierarchicalFolder).

However, enabling OData for non-native properties in the same class works fine, and I can also see their values in the OData stream.

Any suggestions?

Attachments
31 posts

Hi again! I found the solution.

Ok, so I re-read your post once more Vidar, and figured out that the problem was the class of the native property. So first I added a change to the native class and then I enabled OData on the property "Children" in my non-native class.

Here is a step-by-step:

  • In the Ontology module I selected View > Show native types
  • Since the property "Children" belongs to the native class "HierarchicalContent", in order to expose this property we first have to expose its class. This is done by opening the class and clicking "Change", then open "Changes" (right below the class) and enable "OData read access" in its Settings.
  • Now to expose the property "Children" in my class I had to create a new property of type "Change inherited" and select "Children" in the dropdown. Then go to the properties Settings tab and activate "OData enabled".
  • After a full rebuild, both the new class and its children were available in the OData stream.
  • My only concern is that "HierarchicalContent" is exposed. Most of the nodes inherit from this class and it would be bad if all of them were openly available through OData.

    If someone has a better solution I would love to hear about it.

    181 posts

    Hi!

    Great that you found the solution.

    Regarding your concern about exposing HierarchicalContent, I don't see a quiick solution, but we'll think about it.

    1