1 /*global $k*/ 2 3 /** 4 * @class Represents a type of instances 5 * @extends $k.Type 6 **/ 7 $k.InstanceType = function() { }; 8 9 /** 10 * Returns all instances of this type and all subtypes. 11 * Avoid using this function if possible, use queries instead 12 * 13 * @function 14 * @returns {$k.Instance[]} 15 **/ 16 $k.InstanceType.prototype.allInstances = function() { }; 17 18 /** 19 * Create a new instance of this type 20 * 21 * @function 22 * @param {string} [param] The name of the new instance 23 * @param {string} [language] Language of the value. If not defined, the current language will be used. 24 * Ignored if the attribute is not translated 25 * @returns {$k.Instance} The created instance 26 * @throws {$k.exception.SchemaError} If the type is abstract 27 * @throws {$k.exception.AccessDenied} If creating an instance is not allowed 28 * @throws {$k.exception.TransactionError} If no write transaction is active 29 **/ 30 $k.InstanceType.prototype.createInstance = function(param, language) { }; 31 32 /** 33 * Create a new subtype 34 * 35 * @function 36 * @param {string} [param] The name of the new type 37 * @param {string} [language] Language of the value. If not defined, the current language will be used. 38 * Ignored if the attribute is not translated 39 * @returns {$k.Type} The created type 40 * @throws {$k.exception.SchemaError} If subtypes cannot be created 41 * @throws {$k.exception.AccessDenied} If creating a subtype is not allowed 42 * @throws {$k.exception.TransactionError} If no write transaction is active 43 **/ 44 $k.InstanceType.prototype.createSubtype = function(param, language) { }; 45 46 /** 47 * Returns the types that can be extended by this type or a subtype. 48 * Does not check if this type allows to create extensions 49 * 50 * @function 51 * @returns {$k.InstanceType[]} 52 * @see $k.Type#canCreateExtensions 53 **/ 54 $k.InstanceType.prototype.extendedTypes = function() { }; 55 56 /** 57 * Returns the types that can extend instances of this type. 58 * Does not check if these types allow to create extensions 59 * 60 * @function 61 * @returns {$k.InstanceType[]} 62 * @see $k.Type#canCreateExtensions 63 **/ 64 $k.InstanceType.prototype.extensionTypes = function() { }; 65 66 /** 67 * Returns all direct instances of this type. 68 * Avoid using this function if possible, use queries instead 69 * 70 * @function 71 * @returns {$k.Instance[]} 72 **/ 73 $k.InstanceType.prototype.instances = function() { }; 74 75