close

Filter

loading table of contents...

Studio Developer Manual / Version 2107

Table Of Contents

7.28.3 Implementing Studio Remote Beans

You can now create custom remote beans which are linked to the corresponding EntityControllers.

Every remote bean consist of an interface and an implementing class. For the note model, the files Note.as and NoteImpl.as would look like:

public interface Note extends RemoteBean {

  function getDescription():String;

  function getUser():String;

  function getNoteId():String;
}

Example 7.108. Interface of Note remote bean


with the implementing class

[RestResource(uriTemplate="notes/note/{id:[^/]+}")]
public class NoteImpl extends RemoteBeanImpl implements Note {

  public function NoteImpl(uri:String) {
    super(uri);
  }

  public function getDescription():String {
    return get('description');
  }

  public function getUser():String {
    return get('user');
  }

  public function getNoteId():String {
    return get('noteId');
  }
}

Example 7.109. Implementing class of Note remote bean


When implementing remote beans, you have to make sure that the URI path of the remote bean described in the header

[RestResource(uriTemplate="notes/note/{id:[^/]+}")]

Example 7.110. Remote Bean URI path


matches the REST URL of the Java controller entity class.

In the last step, Studio has to register this class as a RemoteBean. Studio comes with a plugin for that, so simply add the following line to the configuration section of your Studio plugin rules:

<editor:RegisterRestResource beanClass="{NoteImpl}"/>

Example 7.111. Register class as remote bean


You can now use your custom remote bean within components to render a note's description.

Search Results

Table Of Contents
warning

Your Internet Explorer is no longer supported.

Please use Mozilla Firefox, Google Chrome, or Microsoft Edge.