diff options
author | 2017-09-08 13:27:46 -0400 | |
---|---|---|
committer | 2017-09-08 13:32:24 -0400 | |
commit | 62cd6aaaf74aa91ee0037c0e155c8e7284f07567 (patch) | |
tree | 68c0c53c9156f5aa3c6b3599ac940770f986633d /mso-api-handlers/mso-api-handler-infra/src/main/java/org/openecomp/mso/apihandlerinfra/OrchestrationRequests.java | |
parent | fa1a211d28a912892fcd888569df033900eb01ee (diff) |
1710 Rebase - Second Attempt
This commit rebases changes from openecomp-mso/internal-staging-1710 up to and including this codecloud commit:
54483fc6606ddb1591a2e9da61bff8712325f924
Wed Sep 6 18:12:56 2017 -0400
Rebasing was done on a branch on top of this commit in so/master in ONAP:
93fbdfbe46104f8859d4754040f979cb7997c157
Thu Sep 7 16:42:59 2017 +0000
Change-Id: I4ad9abf40da32bf5bdca43e868b8fa2dbcd9dc59
Issue-id: SO-107
Signed-off-by: Arthur Martella <amartell@research.att.com>
Diffstat (limited to 'mso-api-handlers/mso-api-handler-infra/src/main/java/org/openecomp/mso/apihandlerinfra/OrchestrationRequests.java')
-rw-r--r-- | mso-api-handlers/mso-api-handler-infra/src/main/java/org/openecomp/mso/apihandlerinfra/OrchestrationRequests.java | 48 |
1 files changed, 34 insertions, 14 deletions
diff --git a/mso-api-handlers/mso-api-handler-infra/src/main/java/org/openecomp/mso/apihandlerinfra/OrchestrationRequests.java b/mso-api-handlers/mso-api-handler-infra/src/main/java/org/openecomp/mso/apihandlerinfra/OrchestrationRequests.java index f42ba97e89..4f0bad9028 100644 --- a/mso-api-handlers/mso-api-handler-infra/src/main/java/org/openecomp/mso/apihandlerinfra/OrchestrationRequests.java +++ b/mso-api-handlers/mso-api-handler-infra/src/main/java/org/openecomp/mso/apihandlerinfra/OrchestrationRequests.java @@ -24,7 +24,12 @@ import java.util.ArrayList; import java.util.List; import java.util.Map; -import javax.ws.rs.*; +import javax.ws.rs.Consumes; +import javax.ws.rs.GET; +import javax.ws.rs.POST; +import javax.ws.rs.Path; +import javax.ws.rs.PathParam; +import javax.ws.rs.Produces; import javax.ws.rs.core.Context; import javax.ws.rs.core.MediaType; import javax.ws.rs.core.MultivaluedMap; @@ -33,16 +38,26 @@ import javax.ws.rs.core.UriInfo; import org.apache.http.HttpStatus; import org.codehaus.jackson.map.ObjectMapper; - import org.openecomp.mso.apihandler.common.ErrorNumbers; -import org.openecomp.mso.apihandlerinfra.serviceinstancebeans.*; +import org.openecomp.mso.apihandlerinfra.serviceinstancebeans.GetOrchestrationListResponse; +import org.openecomp.mso.apihandlerinfra.serviceinstancebeans.GetOrchestrationResponse; +import org.openecomp.mso.apihandlerinfra.serviceinstancebeans.InstanceReferences; +import org.openecomp.mso.apihandlerinfra.serviceinstancebeans.Request; +import org.openecomp.mso.apihandlerinfra.serviceinstancebeans.RequestDetails; +import org.openecomp.mso.apihandlerinfra.serviceinstancebeans.RequestList; +import org.openecomp.mso.apihandlerinfra.serviceinstancebeans.RequestStatus; +import org.openecomp.mso.apihandlerinfra.serviceinstancebeans.ServiceInstancesRequest; import org.openecomp.mso.logger.MessageEnum; import org.openecomp.mso.logger.MsoAlarmLogger; import org.openecomp.mso.logger.MsoLogger; import org.openecomp.mso.requestsdb.InfraActiveRequests; import org.openecomp.mso.requestsdb.RequestsDatabase; -@Path("/") +import com.wordnik.swagger.annotations.Api; +import com.wordnik.swagger.annotations.ApiOperation; + +@Path("/orchestrationRequests") +@Api(value="/orchestrationRequests",description="API Requests for Orchestration requests") public class OrchestrationRequests { public final static String MSO_PROP_APIHANDLER_INFRA = "MSO_PROP_APIHANDLER_INFRA"; @@ -51,6 +66,8 @@ public class OrchestrationRequests { private static MsoAlarmLogger alarmLogger = new MsoAlarmLogger (); + private RequestsDatabase requestsDB = RequestsDatabase.getInstance(); + /** * */ @@ -59,9 +76,10 @@ public class OrchestrationRequests { } @GET - @Path("/orchestrationRequests/{version:[vV][2-3]}/{requestId}") + @Path("/{version:[vV][2-5]}/{requestId}") + @ApiOperation(value="Find Orchestrated Requests for a given requestId",response=Response.class) @Produces(MediaType.APPLICATION_JSON) - public Response getOrchestrationRequest(@PathParam("requestId") String requestId) { + public Response getOrchestrationRequest(@PathParam("requestId") String requestId, @PathParam("version") String version) { GetOrchestrationResponse orchestrationResponse = new GetOrchestrationResponse(); @@ -72,7 +90,7 @@ public class OrchestrationRequests { InfraActiveRequests requestDB = null; try { - requestDB = RequestsDatabase.getRequestFromInfraActive(requestId); + requestDB = requestsDB.getRequestFromInfraActive(requestId); } catch (Exception e) { msoLogger.error (MessageEnum.APIH_DB_ACCESS_EXC, MSO_PROP_APIHANDLER_INFRA, "", "", MsoLogger.ErrorCode.AvailabilityError, "Exception while communciate with Request DB - Infra Request Lookup", e); @@ -112,9 +130,10 @@ public class OrchestrationRequests { } @GET - @Path("/orchestrationRequests/{version:[vV][2-3]}") + @Path("/{version:[vV][2-5]}") + @ApiOperation(value="Find Orchestrated Requests for a URI Information",response=Response.class) @Produces(MediaType.APPLICATION_JSON) - public Response getOrchestrationRequest(@Context UriInfo ui) { + public Response getOrchestrationRequest(@Context UriInfo ui, @PathParam("version") String version) { long startTime = System.currentTimeMillis (); @@ -131,7 +150,7 @@ public class OrchestrationRequests { Map<String, List<String>> orchestrationMap = msoRequest.getOrchestrationFilters(queryParams); - activeRequests = RequestsDatabase.getOrchestrationFiltersFromInfraActive(orchestrationMap); + activeRequests = requestsDB.getOrchestrationFiltersFromInfraActive(orchestrationMap); orchestrationList = new GetOrchestrationListResponse(); @@ -166,10 +185,11 @@ public class OrchestrationRequests { @POST - @Path("/orchestrationRequests/v3/{requestId}/unlock") + @Path("/{version: [vV][3-5]}/{requestId}/unlock") @Consumes(MediaType.APPLICATION_JSON) @Produces(MediaType.APPLICATION_JSON) - public Response unlockOrchestrationRequest(String requestJSON, @PathParam("requestId") String requestId) { + @ApiOperation(value="Unlock Orchestrated Requests for a given requestId",response=Response.class) + public Response unlockOrchestrationRequest(String requestJSON, @PathParam("requestId") String requestId, @PathParam("version") String version) { MsoRequest msoRequest = new MsoRequest (requestId); @@ -218,7 +238,7 @@ public class OrchestrationRequests { } try { - requestDB = RequestsDatabase.getRequestFromInfraActive(requestId); + requestDB = requestsDB.getRequestFromInfraActive(requestId); if(requestDB == null) { Response resp = msoRequest.buildServiceErrorResponse (HttpStatus.SC_NOT_FOUND, @@ -238,7 +258,7 @@ public class OrchestrationRequests { if(status == Status.IN_PROGRESS || status == Status.PENDING){ msoRequest.setStatus (org.openecomp.mso.apihandlerinfra.vnfbeans.RequestStatusType.UNLOCKED); reqStatus.setRequestState(Status.UNLOCKED.toString ()); - RequestsDatabase.updateInfraStatus (requestId, + requestsDB.updateInfraStatus (requestId, Status.UNLOCKED.toString (), Constants.MODIFIED_BY_APIHANDLER); |