23
23
import com .optimizely .ab .config .EventType ;
24
24
import com .optimizely .ab .config .Experiment ;
25
25
import com .optimizely .ab .config .FeatureFlag ;
26
- import com .optimizely .ab .config .LiveVariable ;
27
- import com .optimizely .ab .config .LiveVariableUsageInstance ;
26
+ import com .optimizely .ab .config .FeatureVariable ;
27
+ import com .optimizely .ab .config .FeatureVariableUsageInstance ;
28
28
import com .optimizely .ab .config .ProjectConfig ;
29
29
import com .optimizely .ab .config .Variation ;
30
30
import com .optimizely .ab .config .parser .ConfigParseException ;
@@ -203,9 +203,9 @@ public Variation activate(@Nonnull Experiment experiment,
203
203
204
204
@ Nullable
205
205
private Variation activate (@ Nonnull ProjectConfig projectConfig ,
206
- @ Nonnull Experiment experiment ,
207
- @ Nonnull String userId ,
208
- @ Nonnull Map <String , ?> attributes ) {
206
+ @ Nonnull Experiment experiment ,
207
+ @ Nonnull String userId ,
208
+ @ Nonnull Map <String , ?> attributes ) {
209
209
if (!isValid ) {
210
210
logger .error ("Optimizely instance is not valid, failing activate call." );
211
211
return null ;
@@ -310,12 +310,12 @@ public void track(@Nonnull String eventName,
310
310
311
311
// create the conversion event request parameters, then dispatch
312
312
LogEvent conversionEvent = eventFactory .createConversionEvent (
313
- projectConfig ,
314
- userId ,
315
- eventType .getId (),
316
- eventType .getKey (),
317
- copiedAttributes ,
318
- eventTags );
313
+ projectConfig ,
314
+ userId ,
315
+ eventType .getId (),
316
+ eventType .getKey (),
317
+ copiedAttributes ,
318
+ eventTags );
319
319
320
320
logger .info ("Tracking event \" {}\" for user \" {}\" ." , eventName , userId );
321
321
@@ -348,7 +348,7 @@ public void track(@Nonnull String eventName,
348
348
*/
349
349
@ Nonnull
350
350
public Boolean isFeatureEnabled (@ Nonnull String featureKey ,
351
- @ Nonnull String userId ) {
351
+ @ Nonnull String userId ) {
352
352
return isFeatureEnabled (featureKey , userId , Collections .<String , String >emptyMap ());
353
353
}
354
354
@@ -365,8 +365,8 @@ public Boolean isFeatureEnabled(@Nonnull String featureKey,
365
365
*/
366
366
@ Nonnull
367
367
public Boolean isFeatureEnabled (@ Nonnull String featureKey ,
368
- @ Nonnull String userId ,
369
- @ Nonnull Map <String , ?> attributes ) {
368
+ @ Nonnull String userId ,
369
+ @ Nonnull Map <String , ?> attributes ) {
370
370
if (!isValid ) {
371
371
logger .error ("Optimizely instance is not valid, failing isFeatureEnabled call." );
372
372
return false ;
@@ -451,7 +451,7 @@ public Boolean getFeatureVariableBoolean(@Nonnull String featureKey,
451
451
variableKey ,
452
452
userId ,
453
453
attributes ,
454
- LiveVariable .VariableType .BOOLEAN
454
+ FeatureVariable .VariableType .BOOLEAN
455
455
);
456
456
if (variableValue != null ) {
457
457
return Boolean .parseBoolean (variableValue );
@@ -500,7 +500,7 @@ public Double getFeatureVariableDouble(@Nonnull String featureKey,
500
500
variableKey ,
501
501
userId ,
502
502
attributes ,
503
- LiveVariable .VariableType .DOUBLE
503
+ FeatureVariable .VariableType .DOUBLE
504
504
);
505
505
if (variableValue != null ) {
506
506
try {
@@ -554,7 +554,7 @@ public Integer getFeatureVariableInteger(@Nonnull String featureKey,
554
554
variableKey ,
555
555
userId ,
556
556
attributes ,
557
- LiveVariable .VariableType .INTEGER
557
+ FeatureVariable .VariableType .INTEGER
558
558
);
559
559
if (variableValue != null ) {
560
560
try {
@@ -608,15 +608,15 @@ public String getFeatureVariableString(@Nonnull String featureKey,
608
608
variableKey ,
609
609
userId ,
610
610
attributes ,
611
- LiveVariable .VariableType .STRING );
611
+ FeatureVariable .VariableType .STRING );
612
612
}
613
613
614
614
@ VisibleForTesting
615
615
String getFeatureVariableValueForType (@ Nonnull String featureKey ,
616
616
@ Nonnull String variableKey ,
617
617
@ Nonnull String userId ,
618
618
@ Nonnull Map <String , ?> attributes ,
619
- @ Nonnull LiveVariable .VariableType variableType ) {
619
+ @ Nonnull FeatureVariable .VariableType variableType ) {
620
620
if (featureKey == null ) {
621
621
logger .warn ("The featureKey parameter must be nonnull." );
622
622
return null ;
@@ -633,7 +633,7 @@ String getFeatureVariableValueForType(@Nonnull String featureKey,
633
633
return null ;
634
634
}
635
635
636
- LiveVariable variable = featureFlag .getVariableKeyToLiveVariableMap ().get (variableKey );
636
+ FeatureVariable variable = featureFlag .getVariableKeyToFeatureVariableMap ().get (variableKey );
637
637
if (variable == null ) {
638
638
logger .info ("No feature variable was found for key \" {}\" in feature flag \" {}\" ." ,
639
639
variableKey , featureKey );
@@ -650,10 +650,10 @@ String getFeatureVariableValueForType(@Nonnull String featureKey,
650
650
Map <String , ?> copiedAttributes = copyAttributes (attributes );
651
651
FeatureDecision featureDecision = decisionService .getVariationForFeature (featureFlag , userId , copiedAttributes );
652
652
if (featureDecision .variation != null ) {
653
- LiveVariableUsageInstance liveVariableUsageInstance =
654
- featureDecision .variation .getVariableIdToLiveVariableUsageInstanceMap ().get (variable .getId ());
655
- if (liveVariableUsageInstance != null ) {
656
- variableValue = liveVariableUsageInstance .getValue ();
653
+ FeatureVariableUsageInstance featureVariableUsageInstance =
654
+ featureDecision .variation .getVariableIdToFeatureVariableUsageInstanceMap ().get (variable .getId ());
655
+ if (featureVariableUsageInstance != null ) {
656
+ variableValue = featureVariableUsageInstance .getValue ();
657
657
} else {
658
658
variableValue = variable .getDefaultValue ();
659
659
}
0 commit comments