close

Filter

loading table of contents...

Studio Developer Manual / Version 2010

Table Of Contents

7.27.3 Implementing the Studio RemoteBeans

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.103. 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.104. 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.105. Remote Bean URI path


matches the REST URL of the Java controller entity class.

In the last step, Studio has to 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.106. 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