Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
C
contactJS
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Container Registry
Model registry
Operate
Environments
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
MOTIVATE
contactJS
Commits
242846bd
Commit
242846bd
authored
9 years ago
by
Helena Jank
Browse files
Options
Downloads
Patches
Plain Diff
# adjusted attribute's method equalsTypeOf including synonyms
# corrected discoverer: constructor and buildAttribute
parent
b65c1953
No related branches found
Branches containing commit
No related tags found
Tags containing commit
No related merge requests found
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
js/modules/attribute/attribute.js
+5
-1
5 additions, 1 deletion
js/modules/attribute/attribute.js
js/modules/discoverer/discoverer.js
+20
-6
20 additions, 6 deletions
js/modules/discoverer/discoverer.js
with
25 additions
and
7 deletions
js/modules/attribute/attribute.js
+
5
−
1
View file @
242846bd
...
@@ -240,6 +240,7 @@ define(['easejs',
...
@@ -240,6 +240,7 @@ define(['easejs',
* @public
* @public
* @alias getSynonyms
* @alias getSynonyms
* @memberof Attribute#
* @memberof Attribute#
* @returns {Array}
*/
*/
'
public getSynonyms
'
:
function
(){
'
public getSynonyms
'
:
function
(){
return
this
.
synonymList
;
return
this
.
synonymList
;
...
@@ -409,7 +410,10 @@ define(['easejs',
...
@@ -409,7 +410,10 @@ define(['easejs',
*/
*/
'
public equalsTypeOf
'
:
function
(
_attribute
)
{
'
public equalsTypeOf
'
:
function
(
_attribute
)
{
if
(
Class
.
isA
(
Attribute
,
_attribute
))
{
if
(
Class
.
isA
(
Attribute
,
_attribute
))
{
if
(
this
.
getName
()
==
_attribute
.
getName
()
&&
this
.
getType
()
==
_attribute
.
getType
()
&&
this
.
getParameters
().
equals
(
_attribute
.
getParameters
()))
{
var
name
=
_attribute
.
getName
();
if
((
this
.
getName
()
==
name
||
this
.
getSynonyms
().
indexOf
(
name
)
!=
-
1
)
&&
this
.
getType
()
==
_attribute
.
getType
()
&&
this
.
getParameters
().
equals
(
_attribute
.
getParameters
()))
{
return
true
;
return
true
;
}
}
}
}
...
...
This diff is collapsed.
Click to expand it.
js/modules/discoverer/discoverer.js
+
20
−
6
View file @
242846bd
...
@@ -4,8 +4,8 @@
...
@@ -4,8 +4,8 @@
* @module Discoverer
* @module Discoverer
* @fileOverview
* @fileOverview
*/
*/
define
([
'
easejs
'
,
'
attribute
List
'
,
'
widget
'
,
'
interpreter
'
,
'
aggregator
'
],
function
(
easejs
,
define
([
'
easejs
'
,
'
attribute
'
,
'
attributeList
'
,
'
parameter
'
,
'
translation
'
,
'
widget
'
,
'
interpreter
'
,
'
aggregator
'
],
function
(
easejs
,
Attribute
List
,
Widget
,
Interpreter
,
Aggregator
)
{
Attribute
,
AttributeList
,
Parameter
,
Translation
,
Widget
,
Interpreter
,
Aggregator
)
{
var
Class
=
easejs
.
Class
;
var
Class
=
easejs
.
Class
;
var
Discoverer
=
Class
(
'
Discoverer
'
,
{
var
Discoverer
=
Class
(
'
Discoverer
'
,
{
...
@@ -52,10 +52,12 @@ define([ 'easejs', 'attributeList', 'widget', 'interpreter', 'aggregator' ], fun
...
@@ -52,10 +52,12 @@ define([ 'easejs', 'attributeList', 'widget', 'interpreter', 'aggregator' ], fun
* @class Discoverer
* @class Discoverer
* @classdesc The Discoverer handles requests for components and attributes.
* @classdesc The Discoverer handles requests for components and attributes.
* @requires easejs
* @requires easejs
* @requires AttributeList
* @param _widgets
* @param _interpreters
* @param _translations
* @constructs Discoverer
* @constructs Discoverer
*/
*/
'
public __construct
'
:
function
(
_translations
)
{
'
public __construct
'
:
function
(
_widgets
,
_interpreters
,
_translations
)
{
this
.
translations
=
_translations
;
this
.
translations
=
_translations
;
},
},
...
@@ -252,9 +254,20 @@ define([ 'easejs', 'attributeList', 'widget', 'interpreter', 'aggregator' ], fun
...
@@ -252,9 +254,20 @@ define([ 'easejs', 'attributeList', 'widget', 'interpreter', 'aggregator' ], fun
return
this
.
translations
;
return
this
.
translations
;
},
},
/**
* Returns a newly built attribute.
*
* @public
* @alias buildAttribute
* @memberof Discoverer#
* @param {string} name the proposed name of the will-be attribute
* @param {string} type its type
* @param {Array} parameterList an array of arrays with two elements each: key and value
* @returns {Attribute}
*/
'
public buildAttribute
'
:
function
(
name
,
type
,
parameterList
)
{
'
public buildAttribute
'
:
function
(
name
,
type
,
parameterList
)
{
var
newAttribute
=
new
Attribute
().
withName
(
name
).
withType
(
type
);
var
newAttribute
=
new
Attribute
().
withName
(
name
).
withType
(
type
);
while
(
typeof
parameterList
!=
'
undefined
'
&&
parameterList
.
length
>
0
)
while
(
typeof
parameterList
!=
'
undefined
'
&&
parameterList
.
length
>
0
)
{
{
var
param
=
parameterList
.
pop
();
var
param
=
parameterList
.
pop
();
...
@@ -263,7 +276,8 @@ define([ 'easejs', 'attributeList', 'widget', 'interpreter', 'aggregator' ], fun
...
@@ -263,7 +276,8 @@ define([ 'easejs', 'attributeList', 'widget', 'interpreter', 'aggregator' ], fun
if
(
typeof
key
!=
'
undefined
'
&&
typeof
value
!=
'
undefined
'
)
if
(
typeof
key
!=
'
undefined
'
&&
typeof
value
!=
'
undefined
'
)
newAttribute
=
newAttribute
.
withParameter
(
new
Parameter
().
withKey
(
key
).
withValue
(
value
));
newAttribute
=
newAttribute
.
withParameter
(
new
Parameter
().
withKey
(
key
).
withValue
(
value
));
}
}
for
(
translation
in
this
.
translations
)
{
for
(
index
in
this
.
translations
)
{
var
translation
=
this
.
translations
[
index
];
if
(
translation
.
translates
(
newAttribute
))
if
(
translation
.
translates
(
newAttribute
))
newAttribute
=
newAttribute
.
withSynonym
(
translation
.
getSynonym
());
newAttribute
=
newAttribute
.
withSynonym
(
translation
.
getSynonym
());
}
}
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment