summaryrefslogtreecommitdiffstats
path: root/openecomp-be/api/openecomp-sdc-rest-webapp/togglz-rest
diff options
context:
space:
mode:
authorvasraz <vasyl.razinkov@est.tech>2021-03-22 15:33:06 +0000
committerChristophe Closset <christophe.closset@intl.att.com>2021-03-24 06:59:47 +0000
commitd378c37fbd1ecec7b43394926f1ca32a695e07de (patch)
tree5c8a085f8732f980d871d966ac49361644efa698 /openecomp-be/api/openecomp-sdc-rest-webapp/togglz-rest
parenta6ae7294ecd336d7e88f915710b08e2658eaee00 (diff)
Reformat openecomp-be
Signed-off-by: Vasyl Razinkov <vasyl.razinkov@est.tech> Issue-ID: SDC-3449 Change-Id: I13e02322f8e00820cc5a1d85752caaeda9bf10d1
Diffstat (limited to 'openecomp-be/api/openecomp-sdc-rest-webapp/togglz-rest')
-rw-r--r--openecomp-be/api/openecomp-sdc-rest-webapp/togglz-rest/togglz-rest-services/src/main/java/org/openecomp/sdcrests/togglz/rest/TogglzFeatures.java47
-rw-r--r--openecomp-be/api/openecomp-sdc-rest-webapp/togglz-rest/togglz-rest-services/src/main/java/org/openecomp/sdcrests/togglz/rest/mapping/MapToggleableFeatureToDto.java5
-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.java20
-rw-r--r--openecomp-be/api/openecomp-sdc-rest-webapp/togglz-rest/togglz-rest-types/src/main/java/org/openecomp/sdcrests/togglz/types/FeatureDto.java10
-rw-r--r--openecomp-be/api/openecomp-sdc-rest-webapp/togglz-rest/togglz-rest-types/src/main/java/org/openecomp/sdcrests/togglz/types/FeatureSetDto.java2
5 files changed, 41 insertions, 43 deletions
diff --git a/openecomp-be/api/openecomp-sdc-rest-webapp/togglz-rest/togglz-rest-services/src/main/java/org/openecomp/sdcrests/togglz/rest/TogglzFeatures.java b/openecomp-be/api/openecomp-sdc-rest-webapp/togglz-rest/togglz-rest-services/src/main/java/org/openecomp/sdcrests/togglz/rest/TogglzFeatures.java
index bdeefa46f2..ab010c288b 100644
--- a/openecomp-be/api/openecomp-sdc-rest-webapp/togglz-rest/togglz-rest-services/src/main/java/org/openecomp/sdcrests/togglz/rest/TogglzFeatures.java
+++ b/openecomp-be/api/openecomp-sdc-rest-webapp/togglz-rest/togglz-rest-services/src/main/java/org/openecomp/sdcrests/togglz/rest/TogglzFeatures.java
@@ -13,26 +13,27 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
-
package org.openecomp.sdcrests.togglz.rest;
import io.swagger.v3.oas.annotations.Operation;
-import io.swagger.v3.oas.annotations.info.Info;
import io.swagger.v3.oas.annotations.media.ArraySchema;
import io.swagger.v3.oas.annotations.media.Content;
import io.swagger.v3.oas.annotations.media.Schema;
import io.swagger.v3.oas.annotations.responses.ApiResponse;
import io.swagger.v3.oas.annotations.tags.Tag;
import io.swagger.v3.oas.annotations.tags.Tags;
+import javax.ws.rs.Consumes;
+import javax.ws.rs.GET;
+import javax.ws.rs.PUT;
+import javax.ws.rs.Path;
+import javax.ws.rs.PathParam;
+import javax.ws.rs.Produces;
+import javax.ws.rs.core.MediaType;
+import javax.ws.rs.core.Response;
import org.openecomp.sdcrests.togglz.types.FeatureDto;
import org.openecomp.sdcrests.togglz.types.FeatureSetDto;
import org.springframework.validation.annotation.Validated;
-import javax.ws.rs.*;
-import javax.ws.rs.core.MediaType;
-import javax.ws.rs.core.Response;
-
-
@Path("/v1.0/togglz")
@Produces(MediaType.APPLICATION_JSON)
@Consumes(MediaType.APPLICATION_JSON)
@@ -40,24 +41,22 @@ import javax.ws.rs.core.Response;
@Validated
public interface TogglzFeatures {
- @GET
- @Operation(description = "Get TOGGLZ Features", responses = @ApiResponse(content = @Content(array = @ArraySchema( schema = @Schema(implementation = FeatureSetDto.class)))))
- Response getFeatures();
-
-
- @PUT
- @Path("/state/{state}")
- @Operation(description = "Update feature toggle state for all features")
- Response setAllFeatures(@PathParam("state") boolean state);
+ @GET
+ @Operation(description = "Get TOGGLZ Features", responses = @ApiResponse(content = @Content(array = @ArraySchema(schema = @Schema(implementation = FeatureSetDto.class)))))
+ Response getFeatures();
+ @PUT
+ @Path("/state/{state}")
+ @Operation(description = "Update feature toggle state for all features")
+ Response setAllFeatures(@PathParam("state") boolean state);
- @PUT
- @Path("/{featureName}/state/{state}")
- @Operation(description = "Update feature toggle state")
- Response setFeatureState(@PathParam("featureName") String featureName, @PathParam("state") boolean state);
+ @PUT
+ @Path("/{featureName}/state/{state}")
+ @Operation(description = "Update feature toggle state")
+ Response setFeatureState(@PathParam("featureName") String featureName, @PathParam("state") boolean state);
- @GET
- @Path("/{featureName}/state")
- @Operation(description = "Get feature toggle state", responses = @ApiResponse(content = @Content(schema = @Schema(implementation = FeatureDto.class))))
- Response getFeatureState(@PathParam("featureName") String featureName);
+ @GET
+ @Path("/{featureName}/state")
+ @Operation(description = "Get feature toggle state", responses = @ApiResponse(content = @Content(schema = @Schema(implementation = FeatureDto.class))))
+ Response getFeatureState(@PathParam("featureName") String featureName);
}
diff --git a/openecomp-be/api/openecomp-sdc-rest-webapp/togglz-rest/togglz-rest-services/src/main/java/org/openecomp/sdcrests/togglz/rest/mapping/MapToggleableFeatureToDto.java b/openecomp-be/api/openecomp-sdc-rest-webapp/togglz-rest/togglz-rest-services/src/main/java/org/openecomp/sdcrests/togglz/rest/mapping/MapToggleableFeatureToDto.java
index c6fbed672e..47cd79bdf0 100644
--- a/openecomp-be/api/openecomp-sdc-rest-webapp/togglz-rest/togglz-rest-services/src/main/java/org/openecomp/sdcrests/togglz/rest/mapping/MapToggleableFeatureToDto.java
+++ b/openecomp-be/api/openecomp-sdc-rest-webapp/togglz-rest/togglz-rest-services/src/main/java/org/openecomp/sdcrests/togglz/rest/mapping/MapToggleableFeatureToDto.java
@@ -28,9 +28,8 @@ public class MapToggleableFeatureToDto extends MappingBase<Collection<Toggleable
@Override
public void doMapping(Collection<ToggleableFeature> source, FeatureSetDto target) {
- if (source != null && !source.isEmpty()){
- Set<FeatureDto> fDtos = source.stream().map(f -> new FeatureDto(f.name(), f.isActive()))
- .collect(Collectors.toSet());
+ if (source != null && !source.isEmpty()) {
+ Set<FeatureDto> fDtos = source.stream().map(f -> new FeatureDto(f.name(), f.isActive())).collect(Collectors.toSet());
target.setFeatures(fDtos);
} else {
target.setFeatures(Collections.emptySet());
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 4777d0a656..b4e9db695a 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
@@ -13,13 +13,16 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
-
package org.openecomp.sdcrests.togglz.rest.services;
+
+import java.util.Arrays;
+import javax.inject.Named;
+import javax.ws.rs.core.Response;
+import org.openecomp.sdc.be.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.openecomp.sdc.be.togglz.ToggleableFeature;
import org.springframework.context.annotation.Scope;
import org.springframework.stereotype.Service;
import org.togglz.core.Feature;
@@ -27,10 +30,6 @@ 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;
-import java.util.Arrays;
-
@Named
@Service("TogglzFeature")
@Scope(value = "prototype")
@@ -49,7 +48,7 @@ public class TogglzFeaturesImpl implements TogglzFeatures {
new MapToggleableFeatureToDto().doMapping(Arrays.asList(ToggleableFeature.values()), featureSetDto);
featureSetDto.getFeatures().forEach(featureDto -> {
Feature feature = new NamedFeature(featureDto.getName());
- FeatureState featureState = new FeatureState(feature,active);
+ FeatureState featureState = new FeatureState(feature, active);
FeatureContext.getFeatureManager().setFeatureState(featureState);
});
return Response.ok().build();
@@ -58,7 +57,7 @@ public class TogglzFeaturesImpl implements TogglzFeatures {
@Override
public Response setFeatureState(String featureName, boolean active) {
Feature feature = new NamedFeature(featureName);
- FeatureState featureState = new FeatureState(feature,active);
+ FeatureState featureState = new FeatureState(feature, active);
FeatureContext.getFeatureManager().setFeatureState(featureState);
return Response.ok().build();
}
@@ -66,10 +65,7 @@ public class TogglzFeaturesImpl implements TogglzFeatures {
@Override
public Response getFeatureState(String featureName) {
boolean active = ToggleableFeature.valueOf(featureName).isActive();
- FeatureDto featureDto = new FeatureDto(featureName,active);
-
+ FeatureDto featureDto = new FeatureDto(featureName, active);
return Response.ok(featureDto).build();
}
-
}
-
diff --git a/openecomp-be/api/openecomp-sdc-rest-webapp/togglz-rest/togglz-rest-types/src/main/java/org/openecomp/sdcrests/togglz/types/FeatureDto.java b/openecomp-be/api/openecomp-sdc-rest-webapp/togglz-rest/togglz-rest-types/src/main/java/org/openecomp/sdcrests/togglz/types/FeatureDto.java
index d6e2fbd669..786ee06c3a 100644
--- a/openecomp-be/api/openecomp-sdc-rest-webapp/togglz-rest/togglz-rest-types/src/main/java/org/openecomp/sdcrests/togglz/types/FeatureDto.java
+++ b/openecomp-be/api/openecomp-sdc-rest-webapp/togglz-rest/togglz-rest-types/src/main/java/org/openecomp/sdcrests/togglz/types/FeatureDto.java
@@ -18,7 +18,7 @@ package org.openecomp.sdcrests.togglz.types;
import java.util.Objects;
public class FeatureDto {
-
+
private final String name;
private final boolean active;
@@ -37,8 +37,12 @@ public class FeatureDto {
@Override
public boolean equals(Object o) {
- if (this == o) return true;
- if (!(o instanceof FeatureDto)) return false;
+ if (this == o) {
+ return true;
+ }
+ if (!(o instanceof FeatureDto)) {
+ return false;
+ }
FeatureDto that = (FeatureDto) o;
return Objects.equals(getName(), that.getName());
}
diff --git a/openecomp-be/api/openecomp-sdc-rest-webapp/togglz-rest/togglz-rest-types/src/main/java/org/openecomp/sdcrests/togglz/types/FeatureSetDto.java b/openecomp-be/api/openecomp-sdc-rest-webapp/togglz-rest/togglz-rest-types/src/main/java/org/openecomp/sdcrests/togglz/types/FeatureSetDto.java
index cf7ee71a35..6862041b63 100644
--- a/openecomp-be/api/openecomp-sdc-rest-webapp/togglz-rest/togglz-rest-types/src/main/java/org/openecomp/sdcrests/togglz/types/FeatureSetDto.java
+++ b/openecomp-be/api/openecomp-sdc-rest-webapp/togglz-rest/togglz-rest-types/src/main/java/org/openecomp/sdcrests/togglz/types/FeatureSetDto.java
@@ -18,7 +18,7 @@ package org.openecomp.sdcrests.togglz.types;
import java.util.Set;
public class FeatureSetDto {
-
+
private Set<FeatureDto> features;
public Set<FeatureDto> getFeatures() {