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

Source: bop/js/spi/resource/ResourceProvider.js

define([], function() {

    'use strict';

    /**
     * SPI object representing a single Resource Provider.
     *
     * <p>
     * Provides list of {@link bop/js/api/resource/Resource Resources} (an abstract representation of resource invoked by {@link operation/js/api/Operation Operations})
     * which are provided by the relevant {@link bop/js/spi/BOP BOP}. If they are not provided then the user will see 403 errors when the requested resources fail to pass
     * the whitelist provide by this list of resources and enforced by the default authenticators.
     * </p>
     *
     * <p>
     * The BOP does not need to provide this information if it is not making use of the ABCS default {@link bop/js/api/operation/BOPAuthenticator} methods and entity level role based security.
     * </p>
     *
     * @version 17.1.1
     * @AbcsExtension stable
     * @exports bop/js/spi/resource/ResourceProvider
     *
     * @constructor
     * @private
     *
     * @see {@link bop/js/spi/BOP BOP}
     * @see {@link bop/js/spi/operation/OperationProvider OperationProvider}
     *
     * @example
     * <caption>
     *  Example of typical implementation of custom {@link bop/js/spi/resource/ResourceProvider ResourceProvider} used inside of the custom {@link bop/js/spi/BOP BOP}.
     * </caption>
     *
     * define([
     *     'bop/js/api/resource/Resource',
     *     'bop/js/spi/resource/ResourceProvider'
     * ], function (
     *     Resource,
     *     ResourceProvider
     * ) {
     *
     *     var CustomResourceProvider = function () {
     *         var parent = Resource.create({
     *             id : 'employee_collection',
     *             template : '/employee',
     *             entity : 'my.custom.bop.Employee'
     *         });
     *         var child = Resource.createChild(parent, {
     *             id : 'employee_instance',
     *             template : '{id}',
     *         });
     *
     *         this._resources = [parent, child];
     *     };
     *
     *     CustomResourceProvider.prototype.getResources = function() {
     *         return this._resources;
     *     };
     *
     *     return CustomResourceProvider;
     * });
     */
    var ResourceProvider = function() {
        AbcsLib.checkThis(this);
    };

    /**
     * Gets the array of {@link bop/js/api/resource/Resource Resources} provided by this {@link bop/js/spi/resource/ResourceProvider ResourceProvider}.
     *
     * @version 17.1.1
     * @AbcsExtension stable
     *
     * @returns {bop/js/api/resource/Resource[]}
     */
    ResourceProvider.prototype.getResources = function() {
        return [];
    };

    return ResourceProvider;

});