diff options
Diffstat (limited to 'openecomp-be/api/openecomp-sdc-rest-webapp/togglz-rest/togglz-rest-services/src/main/java/org/openecomp/sdcrests/togglz/rest/services')
-rw-r--r-- | openecomp-be/api/openecomp-sdc-rest-webapp/togglz-rest/togglz-rest-services/src/main/java/org/openecomp/sdcrests/togglz/rest/services/TogglzFeaturesImpl.java | 22 |
1 files changed, 22 insertions, 0 deletions
diff --git a/openecomp-be/api/openecomp-sdc-rest-webapp/togglz-rest/togglz-rest-services/src/main/java/org/openecomp/sdcrests/togglz/rest/services/TogglzFeaturesImpl.java b/openecomp-be/api/openecomp-sdc-rest-webapp/togglz-rest/togglz-rest-services/src/main/java/org/openecomp/sdcrests/togglz/rest/services/TogglzFeaturesImpl.java index 5b7240be54..fd1c4dbd0c 100644 --- a/openecomp-be/api/openecomp-sdc-rest-webapp/togglz-rest/togglz-rest-services/src/main/java/org/openecomp/sdcrests/togglz/rest/services/TogglzFeaturesImpl.java +++ b/openecomp-be/api/openecomp-sdc-rest-webapp/togglz-rest/togglz-rest-services/src/main/java/org/openecomp/sdcrests/togglz/rest/services/TogglzFeaturesImpl.java @@ -19,9 +19,14 @@ package org.openecomp.sdcrests.togglz.rest.services; import org.openecomp.sdc.common.togglz.ToggleableFeature; import org.openecomp.sdcrests.togglz.rest.TogglzFeatures; import org.openecomp.sdcrests.togglz.rest.mapping.MapToggleableFeatureToDto; +import org.openecomp.sdcrests.togglz.types.FeatureDto; import org.openecomp.sdcrests.togglz.types.FeatureSetDto; import org.springframework.context.annotation.Scope; import org.springframework.stereotype.Service; +import org.togglz.core.Feature; +import org.togglz.core.context.FeatureContext; +import org.togglz.core.repository.FeatureState; +import org.togglz.core.util.NamedFeature; import javax.inject.Named; import javax.ws.rs.core.Response; @@ -38,5 +43,22 @@ public class TogglzFeaturesImpl implements TogglzFeatures { new MapToggleableFeatureToDto().doMapping(Arrays.asList(ToggleableFeature.values()), featureSetDto); return Response.ok(featureSetDto).build(); } + + @Override + public Response setFeatureState(String featureName, boolean state) { + Feature feature = new NamedFeature(featureName); + FeatureState featureState = new FeatureState(feature,state); + FeatureContext.getFeatureManager().setFeatureState(featureState); + return Response.ok().build(); + } + + @Override + public Response getFeatureState(String featureName) { + boolean active = ToggleableFeature.valueOf(featureName).isActive(); + FeatureDto featureDto = new FeatureDto(featureName,active); + + return Response.ok(featureDto).build(); + } + } |