File tree Expand file tree Collapse file tree 4 files changed +47
-8
lines changed Expand file tree Collapse file tree 4 files changed +47
-8
lines changed Original file line number Diff line number Diff line change @@ -31,8 +31,8 @@ component singleton accessors="true" {
31
31
}
32
32
33
33
param strategyData .constraints = [];
34
- if ( ! strategy . satisfiesConstraints ( strategyData .constraints , getContext () ) ) {
35
- continue ;
34
+ if ( ! satisfiesConstraints ( strategyData .constraints ) ) {
35
+ continue ;
36
36
}
37
37
38
38
param strategyData .parameters = {};
@@ -123,6 +123,21 @@ component singleton accessors="true" {
123
123
return variables .client .get ( " /client/features" ).json ().features ;
124
124
}
125
125
126
+ private boolean function satisfiesConstraints ( required array constraints ) {
127
+ for ( var constraint in arguments .constraints ) {
128
+ var satisfies = strategy .satisfiesConstraint (
129
+ contextName = constraint .contextName ,
130
+ operator = constraint .operator ,
131
+ values = constraint .values ,
132
+ context = getContext ()
133
+ );
134
+ if ( ! satisfies ) {
135
+ return false ;
136
+ }
137
+ }
138
+ return true ;
139
+ }
140
+
126
141
private struct function getContext () {
127
142
param request .unleashContext = generateContext ();
128
143
return request .unleashContext ;
Original file line number Diff line number Diff line change 1
1
component implements = " IStrategy" singleton {
2
2
3
- public boolean function satisfiesConstraints ( array constraints , struct context ) {
3
+ public boolean function satisfiesConstraint (
4
+ required string contextName ,
5
+ required string operator ,
6
+ required array values ,
7
+ required struct context
8
+ ) {
4
9
return true ; // spike
5
10
}
6
11
7
- public boolean function isEnabled ( struct parameters , struct context ) {
12
+ public boolean function isEnabled (
13
+ required struct parameters ,
14
+ required struct context
15
+ ) {
8
16
return true ;
9
17
}
10
18
Original file line number Diff line number Diff line change 1
1
interface {
2
2
3
- public boolean function satisfiesConstraints ( array constraints , struct context );
3
+ public boolean function satisfiesConstraint (
4
+ required string contextName ,
5
+ required string operator ,
6
+ required array values ,
7
+ required struct context
8
+ );
4
9
5
- public boolean function isEnabled ( struct parameters , struct context );
10
+ public boolean function isEnabled (
11
+ required struct parameters ,
12
+ required struct context
13
+ );
6
14
7
15
}
Original file line number Diff line number Diff line change 1
1
component implements = " IStrategy" singleton {
2
2
3
- public boolean function satisfiesConstraints ( array constraints , struct context ) {
3
+ public boolean function satisfiesConstraint (
4
+ required string contextName ,
5
+ required string operator ,
6
+ required array values ,
7
+ required struct context
8
+ ) {
4
9
return true ; // spike
5
10
}
6
11
7
- public boolean function isEnabled ( struct parameters , struct context ) {
12
+ public boolean function isEnabled (
13
+ required struct parameters ,
14
+ required struct context
15
+ ) {
8
16
if ( ! arguments .parameters .keyExists ( " userIds" ) ) {
9
17
return true ;
10
18
}
You can’t perform that action at this time.
0 commit comments