53 lines
1.3 KiB
JavaScript
53 lines
1.3 KiB
JavaScript
|
/**
|
||
|
* Raw ImageFactory API object - should always correspond with the ImageFactory Schema
|
||
|
* @param id
|
||
|
* @param name
|
||
|
* @param baseUrl String
|
||
|
* @param parentEntity
|
||
|
* @constructor
|
||
|
*/
|
||
|
R3.D3.API.ImageFactory = function(
|
||
|
id,
|
||
|
name,
|
||
|
baseUrl,
|
||
|
parentEntity
|
||
|
) {
|
||
|
if (R3.Utils.UndefinedOrNull(id)) {
|
||
|
id = R3.Utils.RandomId();
|
||
|
}
|
||
|
this.id = id;
|
||
|
|
||
|
if (R3.Utils.UndefinedOrNull(name)) {
|
||
|
name = 'ImageFactory (' + this.id + ')';
|
||
|
}
|
||
|
this.name = name;
|
||
|
|
||
|
if (R3.Utils.UndefinedOrNull(baseUrl)) {
|
||
|
baseUrl = '';
|
||
|
console.warn('No baseURL defined for image factory');
|
||
|
}
|
||
|
this.baseUrl = baseUrl;
|
||
|
|
||
|
if (R3.Utils.UndefinedOrNull(parentEntity)) {
|
||
|
parentEntity = null;
|
||
|
}
|
||
|
this.parentEntity = parentEntity;
|
||
|
};
|
||
|
|
||
|
R3.D3.API.ImageFactory.prototype = Object.create(R3.Component.prototype);
|
||
|
R3.D3.API.ImageFactory.prototype.constructor = R3.D3.API.ImageFactory;
|
||
|
|
||
|
/**
|
||
|
* Returns an API ImageFactory from an Object ImageFactory
|
||
|
* @param objectImageFactory
|
||
|
* @constructor
|
||
|
*/
|
||
|
R3.D3.API.ImageFactory.FromObject = function(objectImageFactory) {
|
||
|
return new R3.D3.API.ImageFactory(
|
||
|
objectImageFactory.id,
|
||
|
objectImageFactory.name,
|
||
|
objectImageFactory.baseUrl,
|
||
|
objectImageFactory.parentEntity
|
||
|
);
|
||
|
};
|