/**
*
* Copyright (C) 2021 Akorbi Digital RMP
*
* This file is part of RunMyProcess SDK-JS.
*
* RunMyProcess SDK-JS is free software: you can redistribute it and/or modify
* it under the terms of the Apache License Version 2.0 (the "License");
*
* You may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
/**
Create a new instance of Pool
@constructor
@property {User} author - Contains the author's information.
@property {String} title - pool's title
@property {String} subtitle - pool's subtitle
@property {Array} lanes - List of lanes
@see User
@see Resource
*/
function Pool(){
this.author = new User();
this.title;
this.subtitle;
this.lanes = [];
};
/**
@borrows
Inherits Resource
*/
Pool.prototype = new Resource();
/**
Overrides Resource's loadPreset method.
@method
@see Resource#loadPreset
*/
Pool.prototype.loadPreset = function () {
/**
Overrides Resource's generateUrl method to return the request url
@method
@see Resource#generateUrl
*/
this.generateUrl = function () {
return this.selfUrl;
};
};
/**
Overrides Resource's loadSet method to set local variables after request.
@method
@param {json} rObject - JSON representation of the loaded data.
@see Resource#loadSet
*/
Pool.prototype.loadSet = function (rObject) {
var father = this;
father.author.name = rObject.author.name;
father.author.selfUrl = rObject.author.uri;
father.title = rObject.title;
father.subtitle = rObject.subtitle.P_value;
var ent = father.entries;
for (var i = 0; i < ent.length; i++) {
var lane = new Lane();
lane.object = ent[i];
lane.id = ent[i].id;
lane.categories = lane.getArray(ent[i], "category");
lane.links = lane.getArray(ent[i], "link");
lane.selfUrl = ent[i].content.src;
lane.rights = lane.object.rights;
lane.title = ent[i].title;
lane.parent = father.linkObjectSearch('parent',ent[i].link);
lane.type = father.termSearch('context',ent[i].category).label;
father.lanes.push(lane);
};
};