JavaScript Extension Development API for Oracle Visual Builder Cloud Service - Classic Applications

Class: bop/js/api/resource/Resource

An object representing a single Resource so that it is possible to relate a given REST request to a particularly entity in the model. For example this is used by the BOPAuthenticator on the server side to provide a whitelist of all resources exposed by a particular BOP.

Version:
  • 17.1.1
Source:

Methods

(static) create(data) → {bop/js/api/resource/Resource}

stable API

A factory method that creates a resource.

Parameters:
Name Type Description
data Object

An Object literal with following properties.

Properties
Name Type Description
id String

Unique ID of the created Resource.

template String

The URI template to use for this resource, will be appended to the baseUri parameter if the BOP exports CustomParameter so naned.

entity String

Unique ID of the referenced Entity.

Version:
  • 17.1.1
Source:
Returns:

A new resource based on the passed in data

Type
bop/js/api/resource/Resource
Example

Example of typical implementation a typical resource creating, providing the required attributes for id, template and entity id.

var parent = Resource.create({
     id: 'employee_collection',
     template: '/employee',
     entity: 'my.custom.bop.Employee'
 });

(static) createChild(parent, data) → {bop/js/api/resource/Resource}

stable API

A factory method that creates a resource relative to the parent resource.

Parameters:
Name Type Description
parent bop/js/api/resource/Resource

The parent resource to create the resource relative to

data Object

An Object literal with following properties.

Properties
Name Type Attributes Description
id String

Unique ID of the created Resource.

template String

The URI template to use for this resource that is appended to the template for any parent resource.

entity String <optional>

Override the entity id of the parent resource.

Version:
  • 17.1.1
Source:
Returns:

A new resource based on the passed in data

Type
bop/js/api/resource/Resource
Example

Example of typical implementation a typical child resource created relative to a parent resource.

var parent = Resource.create({
     id: 'employee_collection',
     template: '/employee',
     entity: 'my.custom.bop.Employee'
 });
 var child = Resource.createChild(parent, {
     id: 'employee_instance',
     template: '{id}'
 });