diff options
author | sheetalm <sheetal.mudholkar@amdocs.com> | 2018-04-12 13:20:36 +0530 |
---|---|---|
committer | Vitaly Emporopulo <Vitaliy.Emporopulo@amdocs.com> | 2018-04-12 16:21:28 +0000 |
commit | 894285bfa9ccacde35b1e94e07856b53971e2559 (patch) | |
tree | d7174842de984017163eeec5834d34bc46db7cd3 /services/activity-spec/activity-spec-web/activity-spec-service/src/main/java/org/openecomp/activityspec/api | |
parent | d60b2a40c15c5952f8a31e2d2aa4be2cf4837fc8 (diff) |
Activity Spec - change in package and group names
1 Package structure will now be org.onap.sdc.activityspec instead of
org.openecomp.activityspec
2 Same applies for group names
3 This is done to fix issue with pushing docker images to nexus
repository
4 In ONAP in order for you to push to nexus you need to match the package
and artifact name to the repository
Change-Id: I1266c66fa0d0a85acd9ca1164647b996433eb960
Issue-ID: SDC-1048
Signed-off-by: sheetalm <sheetal.mudholkar@amdocs.com>
Diffstat (limited to 'services/activity-spec/activity-spec-web/activity-spec-service/src/main/java/org/openecomp/activityspec/api')
18 files changed, 0 insertions, 789 deletions
diff --git a/services/activity-spec/activity-spec-web/activity-spec-service/src/main/java/org/openecomp/activityspec/api/rest/ActivitySpecs.java b/services/activity-spec/activity-spec-web/activity-spec-service/src/main/java/org/openecomp/activityspec/api/rest/ActivitySpecs.java deleted file mode 100644 index ae9e1583fd..0000000000 --- a/services/activity-spec/activity-spec-web/activity-spec-service/src/main/java/org/openecomp/activityspec/api/rest/ActivitySpecs.java +++ /dev/null @@ -1,84 +0,0 @@ -/* - * Copyright © 2016-2018 European Support Limited - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -package org.openecomp.activityspec.api.rest; - -import io.swagger.annotations.Api; -import io.swagger.annotations.ApiOperation; -import io.swagger.annotations.ApiParam; -import org.openecomp.activityspec.api.rest.types.ActivitySpecActionRequestDto; -import org.openecomp.activityspec.api.rest.types.ActivitySpecRequestDto; -import org.springframework.validation.annotation.Validated; - -import javax.validation.Valid; -import javax.ws.rs.Consumes; -import javax.ws.rs.GET; -import javax.ws.rs.POST; -import javax.ws.rs.PUT; -import javax.ws.rs.Path; -import javax.ws.rs.PathParam; -import javax.ws.rs.Produces; -import javax.ws.rs.QueryParam; -import javax.ws.rs.core.MediaType; -import javax.ws.rs.core.Response; - -@Path("/v1.0/activity-spec/") -@Produces(MediaType.APPLICATION_JSON) -@Consumes(MediaType.APPLICATION_JSON) -@Api(value = "Activity Specs") -@Validated -public interface ActivitySpecs { - @POST - @Path("/") - @ApiOperation(value = "Create Activity Spec") - Response createActivitySpec(@Valid ActivitySpecRequestDto request); - - @GET - @Path("/{id}/versions/{versionId}") - @ApiOperation(value = "Get Activity Spec") - Response getActivitySpec(@ApiParam(value = "Activity Spec Id") @PathParam("id") - String id, - @ApiParam(value = "Version Id") @PathParam("versionId") - String versionId); - - @PUT - @Path("/{id}/versions/{versionId}") - @ApiOperation(value = "Update Activity Spec") - Response updateActivitySpec(@Valid ActivitySpecRequestDto request, - @ApiParam(value = "Activity Spec Id") @PathParam("id") - String id, - @ApiParam(value = "Version Id") @PathParam("versionId") - String versionId); - - @PUT - @Path("/{id}/versions/{versionId}/actions") - @ApiOperation(value = "Actions on a activity spec", - notes = "Performs one of the following actions on a activity spec: |" - + "CERTIFY: Certifies activity spec.|" - + "DEPRECATE: Deprecates activity spec.|" - + "DELETE: Deletes activity spec.") - Response actOnActivitySpec(ActivitySpecActionRequestDto request, - @ApiParam(value = "Activity Spec Id") @PathParam("id") String id, - @ApiParam(value = "Version Id") @PathParam("versionId") String versionId); - - @GET - @Path("/") - @ApiOperation(value = "Get list of activity specs ", - responseContainer = "List") - Response list(@ApiParam( - value = "List activity specs based on status filter") - @QueryParam("status") String versionStatus); -} diff --git a/services/activity-spec/activity-spec-web/activity-spec-service/src/main/java/org/openecomp/activityspec/api/rest/mapping/MapActivityParameterToDto.java b/services/activity-spec/activity-spec-web/activity-spec-service/src/main/java/org/openecomp/activityspec/api/rest/mapping/MapActivityParameterToDto.java deleted file mode 100644 index bd644ff4d6..0000000000 --- a/services/activity-spec/activity-spec-web/activity-spec-service/src/main/java/org/openecomp/activityspec/api/rest/mapping/MapActivityParameterToDto.java +++ /dev/null @@ -1,31 +0,0 @@ -/* - * Copyright © 2016-2018 European Support Limited - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -package org.openecomp.activityspec.api.rest.mapping; - -import org.openecomp.activityspec.be.datatypes.ActivitySpecParameter; -import org.openecomp.activityspec.api.rest.types.ActivitySpecParameterDto; -import org.openecomp.sdcrests.mapping.MappingBase; - -public class MapActivityParameterToDto extends MappingBase<ActivitySpecParameter, - ActivitySpecParameterDto> { - @Override - public void doMapping(ActivitySpecParameter source, ActivitySpecParameterDto target) { - target.setName(source.getName()); - target.setType(source.getType()); - target.setValue(source.getValue()); - } -} diff --git a/services/activity-spec/activity-spec-web/activity-spec-service/src/main/java/org/openecomp/activityspec/api/rest/mapping/MapActivitySpecRequestDtoToActivitySpecEntity.java b/services/activity-spec/activity-spec-web/activity-spec-service/src/main/java/org/openecomp/activityspec/api/rest/mapping/MapActivitySpecRequestDtoToActivitySpecEntity.java deleted file mode 100644 index 2364d59629..0000000000 --- a/services/activity-spec/activity-spec-web/activity-spec-service/src/main/java/org/openecomp/activityspec/api/rest/mapping/MapActivitySpecRequestDtoToActivitySpecEntity.java +++ /dev/null @@ -1,53 +0,0 @@ -/* - * Copyright © 2016-2018 European Support Limited - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -package org.openecomp.activityspec.api.rest.mapping; - -import java.util.ArrayList; -import org.openecomp.activityspec.be.dao.types.ActivitySpecEntity; -import org.openecomp.activityspec.be.datatypes.ActivitySpecParameter; -import org.openecomp.activityspec.api.rest.types.ActivitySpecRequestDto; -import org.openecomp.sdcrests.mapping.MappingBase; - -import java.util.Objects; -import java.util.stream.Collectors; - -public class MapActivitySpecRequestDtoToActivitySpecEntity - extends MappingBase<ActivitySpecRequestDto, - ActivitySpecEntity> { - - @Override - public void doMapping(ActivitySpecRequestDto source, ActivitySpecEntity target) { - target.setName(source.getName()); - target.setDescription(source.getDescription()); - target.setCategoryList(source.getCategoryList() == null ? new ArrayList<String>() - : source.getCategoryList()); - if (Objects.nonNull(source.getInputs())) { - target.setInputs(source.getInputs().stream() - .map(activitySpecParameterDto -> new MapDtoToActivityParameter() - .applyMapping(activitySpecParameterDto, ActivitySpecParameter.class)) - .collect(Collectors.toList())); - } - if (Objects.nonNull(source.getOutputs())) { - target.setOutputs(source.getOutputs().stream() - .map(activitySpecParameterDto -> new MapDtoToActivityParameter() - .applyMapping(activitySpecParameterDto, ActivitySpecParameter.class)) - .collect(Collectors.toList())); - } - target.setType(source.getType()); - target.setContent(source.getContent()); - } -} diff --git a/services/activity-spec/activity-spec-web/activity-spec-service/src/main/java/org/openecomp/activityspec/api/rest/mapping/MapActivitySpecToActivitySpecCreateResponse.java b/services/activity-spec/activity-spec-web/activity-spec-service/src/main/java/org/openecomp/activityspec/api/rest/mapping/MapActivitySpecToActivitySpecCreateResponse.java deleted file mode 100644 index 13c881404f..0000000000 --- a/services/activity-spec/activity-spec-web/activity-spec-service/src/main/java/org/openecomp/activityspec/api/rest/mapping/MapActivitySpecToActivitySpecCreateResponse.java +++ /dev/null @@ -1,32 +0,0 @@ -/* - * Copyright © 2016-2018 European Support Limited - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -package org.openecomp.activityspec.api.rest.mapping; - -import java.util.Objects; -import org.openecomp.activityspec.be.dao.types.ActivitySpecEntity; -import org.openecomp.activityspec.api.rest.types.ActivitySpecCreateResponse; -import org.openecomp.sdcrests.mapping.MappingBase; - -public class MapActivitySpecToActivitySpecCreateResponse extends MappingBase<ActivitySpecEntity, - ActivitySpecCreateResponse> { - - @Override - public void doMapping(ActivitySpecEntity source, ActivitySpecCreateResponse target) { - target.setId(source.getId()); - target.setVersionId(Objects.nonNull(source.getVersion()) ? source.getVersion().getId() : null); - } -} diff --git a/services/activity-spec/activity-spec-web/activity-spec-service/src/main/java/org/openecomp/activityspec/api/rest/mapping/MapActivitySpecToActivitySpecGetResponse.java b/services/activity-spec/activity-spec-web/activity-spec-service/src/main/java/org/openecomp/activityspec/api/rest/mapping/MapActivitySpecToActivitySpecGetResponse.java deleted file mode 100644 index 697e1bd667..0000000000 --- a/services/activity-spec/activity-spec-web/activity-spec-service/src/main/java/org/openecomp/activityspec/api/rest/mapping/MapActivitySpecToActivitySpecGetResponse.java +++ /dev/null @@ -1,51 +0,0 @@ -/* - * Copyright © 2016-2018 European Support Limited - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -package org.openecomp.activityspec.api.rest.mapping; - -import org.openecomp.activityspec.be.dao.types.ActivitySpecEntity; -import org.openecomp.activityspec.api.rest.types.ActivitySpecGetResponse; -import org.openecomp.activityspec.api.rest.types.ActivitySpecParameterDto; -import org.openecomp.sdcrests.mapping.MappingBase; - -import java.util.Objects; -import java.util.stream.Collectors; - -public class MapActivitySpecToActivitySpecGetResponse extends MappingBase<ActivitySpecEntity, - ActivitySpecGetResponse> { - - @Override - public void doMapping(ActivitySpecEntity source, ActivitySpecGetResponse target) { - target.setName(source.getName()); - target.setDescription(source.getDescription()); - target.setCategoryList(source.getCategoryList()); - if (Objects.nonNull(source.getInputs())) { - target.setInputs(source.getInputs().stream().map( - activitySpecParameter -> new MapActivityParameterToDto() - .applyMapping(activitySpecParameter, ActivitySpecParameterDto - .class)).collect(Collectors.toList())); - } - if (Objects.nonNull(source.getOutputs())) { - target.setOutputs(source.getOutputs().stream().map( - activitySpecParameter -> new MapActivityParameterToDto() - .applyMapping(activitySpecParameter, ActivitySpecParameterDto - .class)).collect(Collectors.toList())); - } - target.setStatus(source.getStatus()); - target.setType(source.getType()); - target.setContent(source.getContent()); - } -} diff --git a/services/activity-spec/activity-spec-web/activity-spec-service/src/main/java/org/openecomp/activityspec/api/rest/mapping/MapDtoToActivityParameter.java b/services/activity-spec/activity-spec-web/activity-spec-service/src/main/java/org/openecomp/activityspec/api/rest/mapping/MapDtoToActivityParameter.java deleted file mode 100644 index ccffaead76..0000000000 --- a/services/activity-spec/activity-spec-web/activity-spec-service/src/main/java/org/openecomp/activityspec/api/rest/mapping/MapDtoToActivityParameter.java +++ /dev/null @@ -1,31 +0,0 @@ -/* - * Copyright © 2016-2018 European Support Limited - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -package org.openecomp.activityspec.api.rest.mapping; - -import org.openecomp.activityspec.be.datatypes.ActivitySpecParameter; -import org.openecomp.activityspec.api.rest.types.ActivitySpecParameterDto; -import org.openecomp.sdcrests.mapping.MappingBase; - -public class MapDtoToActivityParameter extends MappingBase<ActivitySpecParameterDto, - ActivitySpecParameter> { - @Override - public void doMapping(ActivitySpecParameterDto source, ActivitySpecParameter target) { - target.setName(source.getName()); - target.setType(source.getType()); - target.setValue(source.getValue()); - } -} diff --git a/services/activity-spec/activity-spec-web/activity-spec-service/src/main/java/org/openecomp/activityspec/api/rest/mapping/MapItemToListResponseDto.java b/services/activity-spec/activity-spec-web/activity-spec-service/src/main/java/org/openecomp/activityspec/api/rest/mapping/MapItemToListResponseDto.java deleted file mode 100644 index c85d5af427..0000000000 --- a/services/activity-spec/activity-spec-web/activity-spec-service/src/main/java/org/openecomp/activityspec/api/rest/mapping/MapItemToListResponseDto.java +++ /dev/null @@ -1,45 +0,0 @@ -/* - * Copyright © 2016-2018 European Support Limited - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -package org.openecomp.activityspec.api.rest.mapping; - -import org.openecomp.activityspec.api.rest.types.ActivitySpecListResponseDto; -import org.openecomp.sdc.versioning.dao.types.VersionStatus; -import org.openecomp.sdc.versioning.types.Item; -import org.openecomp.sdcrests.mapping.MappingBase; - -import java.util.List; -import java.util.Map; -import java.util.Objects; -import java.util.Set; - -import static org.openecomp.activityspec.utils.ActivitySpecConstant.CATEGORY_ATTRIBUTE_NAME; - -public class MapItemToListResponseDto extends MappingBase<Item, ActivitySpecListResponseDto> { - @Override - public void doMapping(Item source, ActivitySpecListResponseDto target) { - target.setId(source.getId()); - target.setName(source.getName()); - target.setCategoryList((List<String>) source.getProperties().get( - CATEGORY_ATTRIBUTE_NAME)); - final Map<VersionStatus, Integer> versionStatusCounters = source.getVersionStatusCounters(); - if (Objects.nonNull(versionStatusCounters) && !versionStatusCounters.isEmpty()) { - final Set<VersionStatus> versionStatuses = versionStatusCounters.keySet(); - target.setStatus(versionStatuses.stream().findFirst().isPresent() - ? versionStatuses.stream().findFirst().get().name() : null); - } - } -} diff --git a/services/activity-spec/activity-spec-web/activity-spec-service/src/main/java/org/openecomp/activityspec/api/rest/services/ActivitySpecsImpl.java b/services/activity-spec/activity-spec-web/activity-spec-service/src/main/java/org/openecomp/activityspec/api/rest/services/ActivitySpecsImpl.java deleted file mode 100644 index db2db40f6e..0000000000 --- a/services/activity-spec/activity-spec-web/activity-spec-service/src/main/java/org/openecomp/activityspec/api/rest/services/ActivitySpecsImpl.java +++ /dev/null @@ -1,117 +0,0 @@ -/* - * Copyright © 2016-2018 European Support Limited - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -package org.openecomp.activityspec.api.rest.services; - -import org.openecomp.activityspec.api.rest.ActivitySpecs; -import org.openecomp.activityspec.api.rest.mapping.MapActivitySpecRequestDtoToActivitySpecEntity; -import org.openecomp.activityspec.api.rest.mapping.MapActivitySpecToActivitySpecCreateResponse; -import org.openecomp.activityspec.api.rest.mapping.MapActivitySpecToActivitySpecGetResponse; -import org.openecomp.activityspec.api.rest.mapping.MapItemToListResponseDto; -import org.openecomp.activityspec.api.rest.types.ActivitySpecActionRequestDto; -import org.openecomp.activityspec.api.rest.types.ActivitySpecCreateResponse; -import org.openecomp.activityspec.api.rest.types.ActivitySpecGetResponse; -import org.openecomp.activityspec.api.rest.types.ActivitySpecListResponseDto; -import org.openecomp.activityspec.api.rest.types.ActivitySpecRequestDto; -import org.openecomp.activityspec.api.rest.types.InternalEmptyObject; -import org.openecomp.activityspec.be.ActivitySpecManager; -import org.openecomp.activityspec.be.dao.impl.ActivitySpecDaoZusammenImpl; -import org.openecomp.activityspec.be.dao.types.ActivitySpecEntity; -import org.openecomp.activityspec.be.impl.ActivitySpecManagerImpl; -import org.openecomp.core.dao.UniqueValueDaoFactory; -import org.openecomp.core.zusammen.api.ZusammenAdaptorFactory; -import org.openecomp.sdc.versioning.ItemManagerFactory; -import org.openecomp.sdc.versioning.VersioningManagerFactory; -import org.openecomp.sdc.versioning.dao.types.Version; - -import org.openecomp.sdcrests.wrappers.GenericCollectionWrapper; -import org.springframework.context.annotation.Scope; -import org.springframework.stereotype.Service; -import org.springframework.validation.annotation.Validated; - -import javax.ws.rs.core.Response; - -@Service("activitySpecs") -@Scope(value = "singleton") -@Validated -public class ActivitySpecsImpl implements ActivitySpecs { - - - private final ActivitySpecManager activitySpecManager = - new ActivitySpecManagerImpl(ItemManagerFactory.getInstance().createInterface(), - VersioningManagerFactory.getInstance().createInterface(), - new ActivitySpecDaoZusammenImpl(ZusammenAdaptorFactory.getInstance().createInterface()), - UniqueValueDaoFactory.getInstance().createInterface()); - - @Override - public Response createActivitySpec(ActivitySpecRequestDto request) { - ActivitySpecEntity activitySpec = new MapActivitySpecRequestDtoToActivitySpecEntity() - .applyMapping(request, ActivitySpecEntity.class); - - activitySpec = activitySpecManager.createActivitySpec(activitySpec); - ActivitySpecCreateResponse createActivitySpecResponse = - new MapActivitySpecToActivitySpecCreateResponse().applyMapping(activitySpec, - ActivitySpecCreateResponse.class); - - return Response.ok(createActivitySpecResponse).build(); - } - - @Override - public Response getActivitySpec(String activitySpecId, String versionId) { - ActivitySpecEntity activitySpec = new ActivitySpecEntity(); - activitySpec.setId(activitySpecId); - activitySpec.setVersion(new Version(versionId)); - final ActivitySpecEntity retrieved = activitySpecManager.get(activitySpec); - ActivitySpecGetResponse getResponse = new MapActivitySpecToActivitySpecGetResponse() - .applyMapping(retrieved, ActivitySpecGetResponse.class); - return Response.ok(getResponse).build(); - } - - @Override - public Response updateActivitySpec(ActivitySpecRequestDto request, String activitySpecId, - String versionId) { - ActivitySpecEntity activitySpec = new MapActivitySpecRequestDtoToActivitySpecEntity() - .applyMapping(request, ActivitySpecEntity.class); - - activitySpec.setId(activitySpecId); - activitySpec.setVersion(new Version(versionId)); - - activitySpecManager.update(activitySpec); - - return Response.ok(new InternalEmptyObject()).build(); - } - - @Override - public Response actOnActivitySpec(ActivitySpecActionRequestDto request, String activitySpecId, - String versionId) { - activitySpecManager.actOnAction(activitySpecId, versionId, request.getAction()); - return Response.ok(new InternalEmptyObject()).build(); - } - - @Override - public Response list(String versionStatus) { - - GenericCollectionWrapper<ActivitySpecListResponseDto> results = new GenericCollectionWrapper<>(); - MapItemToListResponseDto mapper = new MapItemToListResponseDto(); - activitySpecManager.list(versionStatus).stream() - .sorted((o1, o2) -> o2.getModificationTime().compareTo(o1.getModificationTime())) - .forEach(activitySpecItem -> results.add(mapper.applyMapping(activitySpecItem, - ActivitySpecListResponseDto.class))); - - return Response.ok(results).build(); - } - -} diff --git a/services/activity-spec/activity-spec-web/activity-spec-service/src/main/java/org/openecomp/activityspec/api/rest/types/ActivitySpecAction.java b/services/activity-spec/activity-spec-web/activity-spec-service/src/main/java/org/openecomp/activityspec/api/rest/types/ActivitySpecAction.java deleted file mode 100644 index bedcfcb2da..0000000000 --- a/services/activity-spec/activity-spec-web/activity-spec-service/src/main/java/org/openecomp/activityspec/api/rest/types/ActivitySpecAction.java +++ /dev/null @@ -1,23 +0,0 @@ -/* - * Copyright © 2016-2018 European Support Limited - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -package org.openecomp.activityspec.api.rest.types; - -public enum ActivitySpecAction { - CERTIFY, - DEPRECATE, - DELETE -}
\ No newline at end of file diff --git a/services/activity-spec/activity-spec-web/activity-spec-service/src/main/java/org/openecomp/activityspec/api/rest/types/ActivitySpecActionRequestDto.java b/services/activity-spec/activity-spec-web/activity-spec-service/src/main/java/org/openecomp/activityspec/api/rest/types/ActivitySpecActionRequestDto.java deleted file mode 100644 index c9012120f1..0000000000 --- a/services/activity-spec/activity-spec-web/activity-spec-service/src/main/java/org/openecomp/activityspec/api/rest/types/ActivitySpecActionRequestDto.java +++ /dev/null @@ -1,22 +0,0 @@ -/* - * Copyright © 2016-2018 European Support Limited - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -package org.openecomp.activityspec.api.rest.types; - -@lombok.Data -public class ActivitySpecActionRequestDto { - private ActivitySpecAction action; -} diff --git a/services/activity-spec/activity-spec-web/activity-spec-service/src/main/java/org/openecomp/activityspec/api/rest/types/ActivitySpecCreateResponse.java b/services/activity-spec/activity-spec-web/activity-spec-service/src/main/java/org/openecomp/activityspec/api/rest/types/ActivitySpecCreateResponse.java deleted file mode 100644 index 9a654f780c..0000000000 --- a/services/activity-spec/activity-spec-web/activity-spec-service/src/main/java/org/openecomp/activityspec/api/rest/types/ActivitySpecCreateResponse.java +++ /dev/null @@ -1,24 +0,0 @@ -/* - * Copyright © 2016-2018 European Support Limited - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -package org.openecomp.activityspec.api.rest.types; - -@lombok.Data -public class ActivitySpecCreateResponse { - private String id; - private String versionId; -} - diff --git a/services/activity-spec/activity-spec-web/activity-spec-service/src/main/java/org/openecomp/activityspec/api/rest/types/ActivitySpecGetResponse.java b/services/activity-spec/activity-spec-web/activity-spec-service/src/main/java/org/openecomp/activityspec/api/rest/types/ActivitySpecGetResponse.java deleted file mode 100644 index 9453935559..0000000000 --- a/services/activity-spec/activity-spec-web/activity-spec-service/src/main/java/org/openecomp/activityspec/api/rest/types/ActivitySpecGetResponse.java +++ /dev/null @@ -1,31 +0,0 @@ -/* - * Copyright © 2016-2018 European Support Limited - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -package org.openecomp.activityspec.api.rest.types; - -import java.util.List; - -@lombok.Data -public class ActivitySpecGetResponse { - private String name; - private String description; - private List<String> categoryList; - private List<ActivitySpecParameterDto> inputs; - private List<ActivitySpecParameterDto> outputs; - private String status; - private String type; - private String content; -} diff --git a/services/activity-spec/activity-spec-web/activity-spec-service/src/main/java/org/openecomp/activityspec/api/rest/types/ActivitySpecListResponseDto.java b/services/activity-spec/activity-spec-web/activity-spec-service/src/main/java/org/openecomp/activityspec/api/rest/types/ActivitySpecListResponseDto.java deleted file mode 100644 index 782143f620..0000000000 --- a/services/activity-spec/activity-spec-web/activity-spec-service/src/main/java/org/openecomp/activityspec/api/rest/types/ActivitySpecListResponseDto.java +++ /dev/null @@ -1,28 +0,0 @@ -/* - * Copyright © 2016-2018 European Support Limited - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -package org.openecomp.activityspec.api.rest.types; - -import java.util.List; - -@lombok.Data -public class ActivitySpecListResponseDto { - private String id; - private String version; - String name; - List<String> categoryList; - private String status; -} diff --git a/services/activity-spec/activity-spec-web/activity-spec-service/src/main/java/org/openecomp/activityspec/api/rest/types/ActivitySpecParameterDto.java b/services/activity-spec/activity-spec-web/activity-spec-service/src/main/java/org/openecomp/activityspec/api/rest/types/ActivitySpecParameterDto.java deleted file mode 100644 index 76e8262984..0000000000 --- a/services/activity-spec/activity-spec-web/activity-spec-service/src/main/java/org/openecomp/activityspec/api/rest/types/ActivitySpecParameterDto.java +++ /dev/null @@ -1,24 +0,0 @@ -/* - * Copyright © 2016-2018 European Support Limited - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -package org.openecomp.activityspec.api.rest.types; - -@lombok.Data -public class ActivitySpecParameterDto { - private String name; - private String type; - private String value; -} diff --git a/services/activity-spec/activity-spec-web/activity-spec-service/src/main/java/org/openecomp/activityspec/api/rest/types/ActivitySpecRequestDto.java b/services/activity-spec/activity-spec-web/activity-spec-service/src/main/java/org/openecomp/activityspec/api/rest/types/ActivitySpecRequestDto.java deleted file mode 100644 index 08b07b8031..0000000000 --- a/services/activity-spec/activity-spec-web/activity-spec-service/src/main/java/org/openecomp/activityspec/api/rest/types/ActivitySpecRequestDto.java +++ /dev/null @@ -1,39 +0,0 @@ -/* - * Copyright © 2016-2017 European Support Limited - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -package org.openecomp.activityspec.api.rest.types; - -import io.swagger.annotations.ApiModel; -import org.hibernate.validator.constraints.NotBlank; - -import javax.validation.constraints.Pattern; -import java.util.List; - -@ApiModel(value = "ActivitySpecRequest") -@lombok.Data -public class ActivitySpecRequestDto { - - @NotBlank(message = "Mandatory %s field is missing/null") - @Pattern(regexp = "^[a-zA-Z0-9-]*$", message = "%s should match with \"^[a-zA-Z0-9-]*$\" pattern") - private String name; - private String description; - - private List<String> categoryList; - private List<ActivitySpecParameterDto> inputs; - private List<ActivitySpecParameterDto> outputs; - private String type; - private String content; -} diff --git a/services/activity-spec/activity-spec-web/activity-spec-service/src/main/java/org/openecomp/activityspec/api/rest/types/InternalEmptyObject.java b/services/activity-spec/activity-spec-web/activity-spec-service/src/main/java/org/openecomp/activityspec/api/rest/types/InternalEmptyObject.java deleted file mode 100644 index 2faf7bcafa..0000000000 --- a/services/activity-spec/activity-spec-web/activity-spec-service/src/main/java/org/openecomp/activityspec/api/rest/types/InternalEmptyObject.java +++ /dev/null @@ -1,27 +0,0 @@ -/* - * Copyright © 2016-2018 European Support Limited - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -package org.openecomp.activityspec.api.rest.types; - -import org.codehaus.jackson.annotate.JsonAutoDetect; - -/** - * Object of this class can be used to create empty Response body like "{}" - */ -@JsonAutoDetect -public class InternalEmptyObject { - -} diff --git a/services/activity-spec/activity-spec-web/activity-spec-service/src/main/java/org/openecomp/activityspec/api/server/filters/ActivitySpecSessionContextFilter.java b/services/activity-spec/activity-spec-web/activity-spec-service/src/main/java/org/openecomp/activityspec/api/server/filters/ActivitySpecSessionContextFilter.java deleted file mode 100644 index 715d0961e6..0000000000 --- a/services/activity-spec/activity-spec-web/activity-spec-service/src/main/java/org/openecomp/activityspec/api/server/filters/ActivitySpecSessionContextFilter.java +++ /dev/null @@ -1,83 +0,0 @@ -/* - * Copyright © 2016-2018 European Support Limited - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -package org.openecomp.activityspec.api.server.filters; - -import java.io.IOException; -import javax.servlet.Filter; -import javax.servlet.FilterChain; -import javax.servlet.FilterConfig; -import javax.servlet.ServletException; -import javax.servlet.ServletRequest; -import javax.servlet.ServletResponse; -import javax.servlet.http.HttpServletRequest; -import javax.servlet.http.HttpServletResponse; -import javax.ws.rs.core.HttpHeaders; -import javax.ws.rs.core.MediaType; -import javax.ws.rs.core.Response.Status; -import org.apache.commons.lang.StringUtils; -import org.openecomp.sdc.common.session.SessionContextProvider; -import org.openecomp.sdc.common.session.SessionContextProviderFactory; - -import static org.openecomp.activityspec.utils.ActivitySpecConstant.TENANT; -import static org.openecomp.activityspec.utils.ActivitySpecConstant.USER; -import static org.openecomp.activityspec.utils.ActivitySpecConstant.USER_ID_HEADER_PARAM; - -public class ActivitySpecSessionContextFilter implements Filter { - - private static final String MESSAGE_USER_MAY_NOT_BE_NULL = "{\"message\": \"User ID can not be null\"}"; - - @Override - public void init(FilterConfig filterConfig) { - //No ActivitySpec specific initialization required - } - - @Override - public void doFilter(ServletRequest servletRequest, ServletResponse servletResponse, - FilterChain filterChain) throws IOException, ServletException { - - final String userHeader = ((HttpServletRequest) servletRequest).getHeader(USER_ID_HEADER_PARAM); - - // Not a real security, just make sure the request - // has passed some authentication gateway - if (StringUtils.isEmpty(userHeader)) { - sendErrorResponse(servletResponse); - return; - } - - SessionContextProvider contextProvider = SessionContextProviderFactory.getInstance().createInterface(); - - try { - // use the system-wide user and tenant - contextProvider.create(USER, TENANT); - filterChain.doFilter(servletRequest, servletResponse); - } finally { - contextProvider.close(); - } - } - - private void sendErrorResponse(ServletResponse servletResponse) throws IOException { - HttpServletResponse httpServletResponse = (HttpServletResponse) servletResponse; - httpServletResponse.setHeader(HttpHeaders.CONTENT_TYPE, MediaType.APPLICATION_JSON); - httpServletResponse.setStatus(Status.UNAUTHORIZED.getStatusCode()); - servletResponse.getOutputStream().write(MESSAGE_USER_MAY_NOT_BE_NULL.getBytes()); - } - - @Override - public void destroy() { - //No ActivitySpec specific destroy required - } -} diff --git a/services/activity-spec/activity-spec-web/activity-spec-service/src/main/java/org/openecomp/activityspec/api/server/listeners/ActivitySpecAppStartupListener.java b/services/activity-spec/activity-spec-web/activity-spec-service/src/main/java/org/openecomp/activityspec/api/server/listeners/ActivitySpecAppStartupListener.java deleted file mode 100644 index 8ddb7f3493..0000000000 --- a/services/activity-spec/activity-spec-web/activity-spec-service/src/main/java/org/openecomp/activityspec/api/server/listeners/ActivitySpecAppStartupListener.java +++ /dev/null @@ -1,44 +0,0 @@ -/* - * Copyright © 2016-2018 European Support Limited - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -package org.openecomp.activityspec.api.server.listeners; - -import org.openecomp.sdc.common.session.SessionContextProviderFactory; -import org.springframework.web.context.ContextLoaderListener; - -import javax.servlet.ServletContextEvent; -import javax.servlet.ServletContextListener; - -import static org.openecomp.activityspec.utils.ActivitySpecConstant.TENANT; -import static org.openecomp.activityspec.utils.ActivitySpecConstant.USER; - -public class ActivitySpecAppStartupListener implements ServletContextListener { - - ContextLoaderListener springListener; - - @Override - public void contextInitialized(ServletContextEvent servletContextEvent) { - SessionContextProviderFactory.getInstance().createInterface().create(USER, - TENANT); - springListener = new ContextLoaderListener(); - springListener.initWebApplicationContext(servletContextEvent.getServletContext()); - } - - @Override - public void contextDestroyed(ServletContextEvent servletContextEvent) { - springListener.closeWebApplicationContext(servletContextEvent.getServletContext()); - } -} |