Ticket #932 (closed Enhancement: fixed)

Opened 6 years ago

Last modified 6 years ago

Webservice: attach directives to arbitrary responses

Reported by: jri Owned by: jri
Priority: Major Milestone: Release 4.8
Component: DeepaMehta Standard Distribution Version: 4.7
Keywords: Cc: dgf, Malte, JuergeN
Complexity: 3 Area: Application Framework / API
Module: deepamehta-webservice

Description

At the moment directives are send back to the client only for update and delete operations. Since we have association auto-typing (#931) directives must be send for create operations as well. So, a response must be able to transport both at the same time, an entity (the created object) and a list of directives.

Consider e.g. the case when an Address is associated with an Event and the event has already another address. This assignment is deleted then. If this assignment (=association) is visible on the canvas it must be removed.

Change History

comment:1 Changed 6 years ago by jri

  • Status changed from new to accepted

comment:2 Changed 6 years ago by Jörg Richter <jri@…>

In cfe27e5610f14a121b53580d393b00a79ca212c4/deepamehta:

Webservice: introduce DirectivesResponse? (#932).

A DirectivesResponse object combines a JSONEnabled object and a list of directives.

See #932

comment:3 Changed 6 years ago by Jörg Richter <jri@…>

In acb230cc25053ee1c82980874907603212a3a2e3/deepamehta:

Webservice: fix edit and assign-workspace (#932).

BREAKING CHANGES

As of DM 4.8 Directives is not JSONEnabled anymore.

When your resource method returns Directives it must return DirectivesResponse (also in package de.deepamehta.core.service) instead.

return Directives.get();
-->
return new DirectivesResponse();

See #932

comment:4 Changed 6 years ago by Jörg Richter <jri@…>

In fbbed9d8a568db987e4daa92c18c76a96e58d1eb/deepamehta:

Webservice: create() sends directives (#932).

Directives are sent for create operations as well.

Note: while the Core Service's createTopic() and createAssociation() methods still return a Topic or an Association respectively, the corresponding Webservice method returns a DirectivesResponse object. A DirectivesResponse wraps a DeepaMehtaObject (the created object) and a set of directives.

Consider e.g. the case when an Address is associated with an Event and the event has already another address. DM deletes the former assignment then, and removes it from the canvas as well, if displayed. In this case a DELETE_ASSOCIATION directive is sent as a response to a createAssociation() call. The DB and Webclient view are in-sync.

The REST API is still compatible. The response of a POST /core/topic or POST /core/association request is still the created object, but extended with an additional directives property (an array):

{
  id: ...,
  uri: ...,
  type_uri: ...,
  value: ...,
  childs: ...,
  directives: [...]
}

See #932

comment:5 Changed 6 years ago by jri

  • Status changed from accepted to closed
  • Resolution set to fixed
Note: See TracTickets for help on using tickets.