Search in sources :

Example 1 with DeploymentResourceResponseCollection

use of org.wso2.carbon.bpmn.rest.model.repository.DeploymentResourceResponseCollection in project carbon-business-process by wso2.

the class DeploymentService method getDeploymentResources.

@GET
@Path("/{deploymentId}/resources")
@Produces({ MediaType.APPLICATION_JSON, MediaType.APPLICATION_XML })
public Response getDeploymentResources(@PathParam("deploymentId") String deploymentId) {
    RepositoryService repositoryService = BPMNOSGIService.getRepositoryService();
    // Check if deployment exists
    Deployment deployment = repositoryService.createDeploymentQuery().deploymentId(deploymentId).singleResult();
    if (deployment == null) {
        throw new ActivitiObjectNotFoundException("Could not find a deployment with id '" + deploymentId + "'.", Deployment.class);
    }
    List<String> resourceList = repositoryService.getDeploymentResourceNames(deploymentId);
    DeploymentResourceResponseCollection deploymentResourceResponseCollection = new RestResponseFactory().createDeploymentResourceResponseList(deploymentId, resourceList, uriInfo.getBaseUri().toString());
    return Response.ok().entity(deploymentResourceResponseCollection).build();
}
Also used : RestResponseFactory(org.wso2.carbon.bpmn.rest.common.RestResponseFactory) DeploymentResourceResponseCollection(org.wso2.carbon.bpmn.rest.model.repository.DeploymentResourceResponseCollection) Deployment(org.activiti.engine.repository.Deployment) ActivitiObjectNotFoundException(org.activiti.engine.ActivitiObjectNotFoundException) RepositoryService(org.activiti.engine.RepositoryService) Path(javax.ws.rs.Path) Produces(javax.ws.rs.Produces) GET(javax.ws.rs.GET)

Aggregations

GET (javax.ws.rs.GET)1 Path (javax.ws.rs.Path)1 Produces (javax.ws.rs.Produces)1 ActivitiObjectNotFoundException (org.activiti.engine.ActivitiObjectNotFoundException)1 RepositoryService (org.activiti.engine.RepositoryService)1 Deployment (org.activiti.engine.repository.Deployment)1 RestResponseFactory (org.wso2.carbon.bpmn.rest.common.RestResponseFactory)1 DeploymentResourceResponseCollection (org.wso2.carbon.bpmn.rest.model.repository.DeploymentResourceResponseCollection)1