Skip to content
Snippets Groups Projects
Commit 29533a09 authored by Helena Jank's avatar Helena Jank
Browse files

- undid latest changes to aggregator (extension of unsatisfied attributes)

+ added synonyms to attribute type
parent 8be5fd14
No related branches found
No related tags found
No related merge requests found
...@@ -618,15 +618,6 @@ define(['easejs', 'MathUuid','widget', ...@@ -618,15 +618,6 @@ define(['easejs', 'MathUuid','widget',
* @param {Array} _componentTypes An array of components classes that should be searched for (e.g. Widget, Interpreter and Aggregator). * @param {Array} _componentTypes An array of components classes that should be searched for (e.g. Widget, Interpreter and Aggregator).
*/ */
'private getComponentsForUnsatisfiedAttributeTypes': function(_unsatisfiedAttributes, _all, _componentTypes) { 'private getComponentsForUnsatisfiedAttributeTypes': function(_unsatisfiedAttributes, _all, _componentTypes) {
var attrs = _unsatisfiedAttributes.getItems();
var translations = this.discoverer.getTranslations();
for (attribute in attrs) {
for (translation in translations) {
_unsatisfiedAttributes.put(translations[translation].getSynonym(attrs[attribute]));
}
}
// ask the discoverer for components that satisfy the requested components // ask the discoverer for components that satisfy the requested components
var relevantComponents = this.discoverer.getComponentsByAttributes(_unsatisfiedAttributes, _all, _componentTypes); var relevantComponents = this.discoverer.getComponentsByAttributes(_unsatisfiedAttributes, _all, _componentTypes);
console.log("I found "+relevantComponents.length+" component(s) of type "+_componentTypes+" that might satisfy the requested attributes."); console.log("I found "+relevantComponents.length+" component(s) of type "+_componentTypes+" that might satisfy the requested attributes.");
......
...@@ -32,10 +32,17 @@ define(['easejs', ...@@ -32,10 +32,17 @@ define(['easejs',
* @protected * @protected
* @type {ParameterList} * @type {ParameterList}
* @memberof AttributeType# * @memberof AttributeType#
* @desc Name of the Attribute * @desc additional parameters of the Attribute
*/ */
'protected parameterList' : [], 'protected parameterList' : [],
/**
* @alias synonymList
* @protected
* @type {Array}
* @memberof AttributeType#
* @desc Alternative names of the Attribute
*/
'protected synonymList' : [],
/** /**
* Constructor: Initializes the ParameterList. * Constructor: Initializes the ParameterList.
* *
...@@ -104,6 +111,20 @@ define(['easejs', ...@@ -104,6 +111,20 @@ define(['easejs',
this.addParameter(_parameter); this.addParameter(_parameter);
return this; return this;
}, },
/**
* Builder for synonyms from translations, called by discoverer's buildAttribute().
*
* @public
* @alias withSynonyms
* @memberof AttributeType#
* @param {Translations} _translations Translations
* @returns {AttributeType}
*/
'public withSynonyms' : function(_translations){
this.setSynonyms(_translations);
return this;
},
/** /**
* Returns the name. * Returns the name.
...@@ -196,6 +217,22 @@ define(['easejs', ...@@ -196,6 +217,22 @@ define(['easejs',
'public hasParameters' : function() { 'public hasParameters' : function() {
return this.parameterList.size() > 0; return this.parameterList.size() > 0;
}, },
/**
* Adds a list of synonyms.
*
* @public
* @alias setSynonyms
* @memberof AttributeType#
* @param {Array} _synonyms Array of synonyms
*/
'public setSynonyms' : function(_synonyms){
for (synIndex in _synonyms) {
// TODO: needs to be adjusted to match actual type
this.synonymList.push(_synonyms[synIndex]);
}
},
/** /**
* Compares this instance with the given one. * Compares this instance with the given one.
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment