Skip to content

Commit

Permalink
Remove blueprint backwards compatibility
Browse files Browse the repository at this point in the history
  • Loading branch information
cdebost committed Sep 6, 2017
1 parent ee90c1f commit 5ddfc42
Show file tree
Hide file tree
Showing 10 changed files with 27 additions and 29 deletions.
2 changes: 1 addition & 1 deletion core/core.js
Original file line number Diff line number Diff line change
Expand Up @@ -1637,7 +1637,7 @@ exports._objectDescriptorDescriptor = {
var info = Montage.getInfoForObject(this);
var self = info && !info.isInstance ? this : this.constructor;
if (!Object.getOwnPropertyDescriptor(self, "_objectDescriptor") || !self._objectDescriptor) {
var objectDescriptorModuleId = self.objectDescriptorModuleId || self.blueprintModuleId;
var objectDescriptorModuleId = self.objectDescriptorModuleId;
if (!objectDescriptorModuleId) {
throw new TypeError("ObjectDescriptor moduleId undefined for the module '" + JSON.stringify(self) + "'");
}
Expand Down
2 changes: 1 addition & 1 deletion core/meta/event-descriptor.js
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,7 @@ exports.EventDescriptor = Montage.specialize( /** @lends EventDescriptor# */ {
deserializeSelf: {
value:function (deserializer) {
this._name = deserializer.getProperty("name");
this._owner = deserializer.getProperty("objectDescriptor") || deserializer.getProperty("blueprint");
this._owner = deserializer.getProperty("objectDescriptor");
this.detailKeys = this._getPropertyWithDefaults(deserializer, "detailKeys");
this.helpKey = this._getPropertyWithDefaults(deserializer, "helpKey");
}
Expand Down
4 changes: 2 additions & 2 deletions core/meta/model.js
Original file line number Diff line number Diff line change
Expand Up @@ -70,11 +70,11 @@ var Model = exports.Model = Montage.specialize( /** @lends Model.prototype # */

this._name = deserializer.getProperty("name");
//copy contents into the objectDescriptors array
value = deserializer.getProperty("objectDescriptors") || deserializer.getProperty("blueprints");
value = deserializer.getProperty("objectDescriptors");
if (value) {
this._objectDescriptors = value;
}
this.modelInstanceModuleId = deserializer.getProperty("objectModelModuleId") || deserializer.getProperty("binderModuleId");
this.modelInstanceModuleId = deserializer.getProperty("objectModelModuleId");
}
},

Expand Down
7 changes: 3 additions & 4 deletions core/meta/object-descriptor-reference.js
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ exports.ObjectDescriptorReference = RemoteReference.specialize( {
}
return [
"objectDescriptor",
(this._reference.objectDescriptorName || this._reference.blueprintName || "unnamed").toLowerCase(),
(this._reference.objectDescriptorName || "unnamed").toLowerCase(),
"reference"
].join("_");
}
Expand All @@ -34,9 +34,8 @@ exports.ObjectDescriptorReference = RemoteReference.specialize( {
valueFromReference: {
value: function (references) {

// TODO: references.blueprintModule && references.binderReference are deprecated.
var objectDescriptorModule = references.objectDescriptorModule || references.blueprintModule,
modelReference = references.modelReference || references.binderReference,
var objectDescriptorModule = references.objectDescriptorModule,
modelReference = references.modelReference,
modelPromise = Promise.resolve(ModelModule.Model.group.defaultModel);
if (modelReference) {
modelPromise = ModelReference.prototype.valueFromReference(modelReference, require);
Expand Down
14 changes: 7 additions & 7 deletions core/meta/object-descriptor.js
Original file line number Diff line number Diff line change
Expand Up @@ -90,7 +90,7 @@ var ObjectDescriptor = exports.ObjectDescriptor = Montage.specialize( /** @lends
if (value) {
this._model = value;
}
this.objectDescriptorInstanceModule = deserializer.getProperty("objectDescriptorModule") || deserializer.getProperty("blueprintModule");
this.objectDescriptorInstanceModule = deserializer.getProperty("objectDescriptorModule");
parentReference = deserializer.getProperty("parent");
if (parentReference && parentReference.promise && parentReference.valueFromReference) {
deprecate.deprecationWarningOnce("parent reference via ObjectDescriptorReference", "direct reference with object syntax");
Expand All @@ -101,16 +101,16 @@ var ObjectDescriptor = exports.ObjectDescriptor = Montage.specialize( /** @lends

this.customPrototype = this._getPropertyWithDefaults(deserializer, "customPrototype");
//
value = deserializer.getProperty("propertyDescriptors") || deserializer.getProperty("propertyBlueprints");
value = deserializer.getProperty("propertyDescriptors");
if (value) {
this._propertyDescriptors = value;
}

value = deserializer.getProperty("propertyDescriptorGroups") || deserializer.getProperty("propertyBlueprintGroups");
value = deserializer.getProperty("propertyDescriptorGroups");
if (value) {
this._propertyDescriptorGroups = value;
}
value = deserializer.getProperty("eventDescriptors") || deserializer.getProperty("eventBlueprints");
value = deserializer.getProperty("eventDescriptors");
if (value) {
this._eventDescriptors = value;
}
Expand Down Expand Up @@ -321,7 +321,7 @@ var ObjectDescriptor = exports.ObjectDescriptor = Montage.specialize( /** @lends
},

/**
* Blueprint parent
* ObjectDescriptor parent
* @type {?ObjectDescriptor}
*/
parent: {
Expand Down Expand Up @@ -526,7 +526,7 @@ var ObjectDescriptor = exports.ObjectDescriptor = Montage.specialize( /** @lends

/**
* List of properties descriptor groups names
* @returns {Array.<PropertyBlueprint>}
* @returns {Array.<PropertyDescriptor>}
*/
propertyDescriptorGroups: {
get: function () {
Expand Down Expand Up @@ -598,7 +598,7 @@ var ObjectDescriptor = exports.ObjectDescriptor = Montage.specialize( /** @lends
* @function
* @param {string} property to add
* @param {string} name of the group
* @returns {Array.<PropertyBlueprint>} property descriptor group
* @returns {Array.<PropertyDescriptor>} property descriptor group
*/
addPropertyDescriptorToGroupNamed: {
value: function (propertyDescriptor, groupName) {
Expand Down
6 changes: 3 additions & 3 deletions core/meta/object-property.js
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ exports.ObjectProperty = Montage.specialize( /** @lends ObjectProperty# */ {
*
* @function
* @param {Object} prototype
* @param {Blueprint} blueprint
* @param {ObjectDescriptor} objectDescriptor
*/
apply: {
value: function (prototype, objectDescriptor) {
Expand Down Expand Up @@ -70,11 +70,11 @@ exports.ObjectProperty = Montage.specialize( /** @lends ObjectProperty# */ {
},

/**
* Add all the properties defined in the blueprint to the target prototype.
* Add all the properties defined in the objectDescriptor to the target prototype.
*
* @function
* @param {Object} prototype
* @param {Blueprint} blueprint
* @param {ObjectDescriptor} objectDescriptor
*/
addProperties: {
value: function (prototype, objectDescriptor) {
Expand Down
4 changes: 2 additions & 2 deletions core/meta/property-descriptor.js
Original file line number Diff line number Diff line change
Expand Up @@ -102,7 +102,7 @@ exports.PropertyDescriptor = Montage.specialize( /** @lends PropertyDescriptor#
deserializeSelf: {
value:function (deserializer) {
this._name = deserializer.getProperty("name");
this._owner = deserializer.getProperty("objectDescriptor") || deserializer.getProperty("blueprint");
this._owner = deserializer.getProperty("objectDescriptor");
this.cardinality = this._getPropertyWithDefaults(deserializer, "cardinality");
if (this.cardinality === -1) {
this.cardinality = Infinity;
Expand All @@ -114,7 +114,7 @@ exports.PropertyDescriptor = Montage.specialize( /** @lends PropertyDescriptor#
this.collectionValueType = this._getPropertyWithDefaults(deserializer, "collectionValueType");
this.valueObjectPrototypeName = this._getPropertyWithDefaults(deserializer, "valueObjectPrototypeName");
this.valueObjectModuleId = this._getPropertyWithDefaults(deserializer, "valueObjectModuleId");
this._valueDescriptorReference = this._getPropertyWithDefaults(deserializer, "valueDescriptor", "targetBlueprint");
this._valueDescriptorReference = this._getPropertyWithDefaults(deserializer, "valueDescriptor");
this.enumValues = this._getPropertyWithDefaults(deserializer, "enumValues");
this.defaultValue = this._getPropertyWithDefaults(deserializer, "defaultValue");
this.helpKey = this._getPropertyWithDefaults(deserializer, "helpKey");
Expand Down
8 changes: 4 additions & 4 deletions core/meta/user-interface-descriptor.js
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ Javier want to be able to define which columns should be used in a table, the ra
if a user resize a column, where does it get saved?
The table would ask the object what does it has for a table.
Needs groups of properties, like in blueprint
Needs groups of properties, like in objectDescriptor
When serializing their states, a table view that is data driven, the user tweaks needs to be stored by component unique id and by the type they displayed at the time of change
*/
Expand All @@ -27,7 +27,7 @@ When serializing their states, a table view that is data driven, the user tweaks
*/
exports.UserInterfaceDescriptor = Montage.specialize( /** @lends UserInterfaceDescriptor.prototype # */ {
/**
* The object a UserInterfaceDescriptor describes. This is intented be an ObjectDescriptor/blueprint or a PropertyDescriptor/PropertyBlueprint
* The object a UserInterfaceDescriptor describes. This is intented be an ObjectDescriptor or a PropertyDescriptor
*
* @type {object} descriptor
*/
Expand Down Expand Up @@ -102,8 +102,8 @@ exports.UserInterfaceDescriptor = Montage.specialize( /** @lends UserInterfaceDe
},

/**
* An array of UserInterfaceDescriptors that individually describe the PropertyDescriptors/PropertyBlueprints of this object's descriptor's PropertyDescriptors
* An ObjectDescriptor/Blueprint has groups of propery descriptors that should be respected in term of organization
* An array of UserInterfaceDescriptors that individually describe the PropertyDescriptors of this object's descriptor's PropertyDescriptors
* An ObjectDescriptor has groups of propery descriptors that should be respected in term of organization
*
* @type {Component} propertyUserInterfaceDescriptors
*/
Expand Down
4 changes: 2 additions & 2 deletions core/meta/validation-rule.js
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@ exports.PropertyValidationRule = Montage.specialize( /** @lends PropertyValidati
deserializeSelf: {
value: function (deserializer) {
this._name = deserializer.getProperty("name");
this._owner = deserializer.getProperty("objectDescriptor") || deserializer.getProperty("blueprint");
this._owner = deserializer.getProperty("objectDescriptor");
// this._validationSelector = deserializer.getProperty("validationSelector");
this._messageKey = deserializer.getProperty("messageKey");
// FIXME [PJYF Jan 8 2013] There is an API issue in the deserialization
Expand Down Expand Up @@ -152,7 +152,7 @@ exports.PropertyValidationRule = Montage.specialize( /** @lends PropertyValidati
evaluateRule: {
value: function (objectInstance) {
if (this._propertyValidationEvaluator === null) {
var propertyValidationSemantics = new PropertyValidationSemantics().initWithBlueprint(this.objectDescriptor);
var propertyValidationSemantics = new PropertyValidationSemantics().initWithObjectDescriptor(this.objectDescriptor);
this._propertyValidationEvaluator = propertyValidationSemantics.compile(this.selector.syntax);
}
return this._propertyValidationEvaluator(objectInstance);
Expand Down
5 changes: 2 additions & 3 deletions test/spec/meta/object-descriptor-spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -309,13 +309,12 @@ describe("meta/object-descriptor-spec", function () {
isInstance: { value: true }
});

expect(sub.objectDescriptorModuleId === "pass.meta" || sub.objectDescriptorModuleId === "pass.mjson").toBeTruthy();
expect(sub.objectDescriptorModuleId === "pass.mjson").toBeTruthy();
});

it("creates an objectDescriptor when the parent has no objectDescriptor", function (done) {
ObjectDescriptor.objectDescriptor.then(function (objectDescriptor){
expect( objectDescriptor.objectDescriptorInstanceModule.id === "core/meta/blueprint.meta" ||
objectDescriptor.objectDescriptorInstanceModule.id === "core/meta/object-descriptor.mjson").toBeTruthy();
expect(objectDescriptor.objectDescriptorInstanceModule.id).toEqual("core/meta/object-descriptor.mjson");
}, function (err) {
fail(err);
}).finally(function () {
Expand Down

0 comments on commit 5ddfc42

Please sign in to comment.