From 29533a0981c6c3536d6415c492a9de8fae3cd467 Mon Sep 17 00:00:00 2001
From: Helena Jank <jank@uni-potsdam.de>
Date: Tue, 28 Apr 2015 13:49:55 +0200
Subject: [PATCH] - undid latest changes to aggregator (extension of
 unsatisfied attributes) + added synonyms to attribute type

---
 js/modules/aggregator/aggregator.js   |  9 ------
 js/modules/attribute/attributeType.js | 41 +++++++++++++++++++++++++--
 2 files changed, 39 insertions(+), 11 deletions(-)

diff --git a/js/modules/aggregator/aggregator.js b/js/modules/aggregator/aggregator.js
index bb5b76c..6463b6a 100644
--- a/js/modules/aggregator/aggregator.js
+++ b/js/modules/aggregator/aggregator.js
@@ -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).
 		 */
         '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        	
             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.");
diff --git a/js/modules/attribute/attributeType.js b/js/modules/attribute/attributeType.js
index 18f78b3..5c34207 100644
--- a/js/modules/attribute/attributeType.js
+++ b/js/modules/attribute/attributeType.js
@@ -32,10 +32,17 @@ define(['easejs',
 			 * @protected
 			 * @type {ParameterList}
 			 * @memberof AttributeType#
-			 * @desc Name of the Attribute
+			 * @desc additional parameters of the Attribute
 			 */
 			'protected parameterList' : [],
-
+			/**
+			 * @alias synonymList
+			 * @protected
+			 * @type {Array}
+			 * @memberof AttributeType#
+			 * @desc Alternative names of the Attribute
+			 */
+			'protected synonymList' : [],
 			/**
 			 * Constructor: Initializes the ParameterList.
 			 * 
@@ -104,6 +111,20 @@ define(['easejs',
     			this.addParameter(_parameter);
     			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.
@@ -196,6 +217,22 @@ define(['easejs',
             'public hasParameters' : function() {
                 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.
-- 
GitLab