Search in sources :

Example 6 with ResourceOptionsDto

use of org.camunda.bpm.engine.rest.dto.ResourceOptionsDto in project camunda-bpm-platform by camunda.

the class TenantResourceImpl method availableOperations.

public ResourceOptionsDto availableOperations(UriInfo context) {
    ResourceOptionsDto dto = new ResourceOptionsDto();
    // add links if operations are authorized
    URI uri = context.getBaseUriBuilder().path(rootResourcePath).path(TenantRestService.PATH).path(resourceId).build();
    dto.addReflexiveLink(uri, HttpMethod.GET, "self");
    if (!identityService.isReadOnly() && isAuthorized(DELETE)) {
        dto.addReflexiveLink(uri, HttpMethod.DELETE, "delete");
    }
    if (!identityService.isReadOnly() && isAuthorized(UPDATE)) {
        dto.addReflexiveLink(uri, HttpMethod.PUT, "update");
    }
    return dto;
}
Also used : ResourceOptionsDto(org.camunda.bpm.engine.rest.dto.ResourceOptionsDto) URI(java.net.URI)

Example 7 with ResourceOptionsDto

use of org.camunda.bpm.engine.rest.dto.ResourceOptionsDto in project camunda-bpm-platform by camunda.

the class FilterResourceImpl method availableOperations.

public ResourceOptionsDto availableOperations(UriInfo context) {
    ResourceOptionsDto dto = new ResourceOptionsDto();
    UriBuilder baseUriBuilder = context.getBaseUriBuilder().path(relativeRootResourcePath).path(FilterRestService.PATH).path(resourceId);
    URI baseUri = baseUriBuilder.build();
    if (isAuthorized(READ)) {
        dto.addReflexiveLink(baseUri, HttpMethod.GET, "self");
        URI singleResultUri = baseUriBuilder.clone().path("/singleResult").build();
        dto.addReflexiveLink(singleResultUri, HttpMethod.GET, "singleResult");
        dto.addReflexiveLink(singleResultUri, HttpMethod.POST, "singleResult");
        URI listUri = baseUriBuilder.clone().path("/list").build();
        dto.addReflexiveLink(listUri, HttpMethod.GET, "list");
        dto.addReflexiveLink(listUri, HttpMethod.POST, "list");
        URI countUri = baseUriBuilder.clone().path("/count").build();
        dto.addReflexiveLink(countUri, HttpMethod.GET, "count");
        dto.addReflexiveLink(countUri, HttpMethod.POST, "count");
    }
    if (isAuthorized(DELETE)) {
        dto.addReflexiveLink(baseUri, HttpMethod.DELETE, "delete");
    }
    if (isAuthorized(UPDATE)) {
        dto.addReflexiveLink(baseUri, HttpMethod.PUT, "update");
    }
    return dto;
}
Also used : ResourceOptionsDto(org.camunda.bpm.engine.rest.dto.ResourceOptionsDto) URI(java.net.URI)

Example 8 with ResourceOptionsDto

use of org.camunda.bpm.engine.rest.dto.ResourceOptionsDto in project camunda-bpm-platform by camunda.

the class TenantGroupMembersResourceImpl method availableOperations.

public ResourceOptionsDto availableOperations(UriInfo context) {
    ResourceOptionsDto dto = new ResourceOptionsDto();
    URI uri = context.getBaseUriBuilder().path(relativeRootResourcePath).path(TenantRestService.PATH).path(resourceId).path(TenantGroupMembersResource.PATH).build();
    dto.addReflexiveLink(uri, HttpMethod.GET, "self");
    if (!identityService.isReadOnly() && isAuthorized(DELETE)) {
        dto.addReflexiveLink(uri, HttpMethod.DELETE, "delete");
    }
    if (!identityService.isReadOnly() && isAuthorized(CREATE)) {
        dto.addReflexiveLink(uri, HttpMethod.PUT, "create");
    }
    return dto;
}
Also used : ResourceOptionsDto(org.camunda.bpm.engine.rest.dto.ResourceOptionsDto) URI(java.net.URI)

Example 9 with ResourceOptionsDto

use of org.camunda.bpm.engine.rest.dto.ResourceOptionsDto in project camunda-bpm-platform by camunda.

the class TenantUserMembersResourceImpl method availableOperations.

public ResourceOptionsDto availableOperations(UriInfo context) {
    ResourceOptionsDto dto = new ResourceOptionsDto();
    URI uri = context.getBaseUriBuilder().path(relativeRootResourcePath).path(TenantRestService.PATH).path(resourceId).path(TenantUserMembersResource.PATH).build();
    dto.addReflexiveLink(uri, HttpMethod.GET, "self");
    if (!identityService.isReadOnly() && isAuthorized(DELETE)) {
        dto.addReflexiveLink(uri, HttpMethod.DELETE, "delete");
    }
    if (!identityService.isReadOnly() && isAuthorized(CREATE)) {
        dto.addReflexiveLink(uri, HttpMethod.PUT, "create");
    }
    return dto;
}
Also used : ResourceOptionsDto(org.camunda.bpm.engine.rest.dto.ResourceOptionsDto) URI(java.net.URI)

Example 10 with ResourceOptionsDto

use of org.camunda.bpm.engine.rest.dto.ResourceOptionsDto in project camunda-bpm-platform by camunda.

the class TenantRestServiceImpl method availableOperations.

public ResourceOptionsDto availableOperations(UriInfo context) {
    UriBuilder baseUriBuilder = context.getBaseUriBuilder().path(relativeRootResourcePath).path(TenantRestService.PATH);
    ResourceOptionsDto resourceOptionsDto = new ResourceOptionsDto();
    // GET /
    URI baseUri = baseUriBuilder.build();
    resourceOptionsDto.addReflexiveLink(baseUri, HttpMethod.GET, "list");
    // GET /count
    URI countUri = baseUriBuilder.clone().path("/count").build();
    resourceOptionsDto.addReflexiveLink(countUri, HttpMethod.GET, "count");
    // POST /create
    if (!getIdentityService().isReadOnly() && isAuthorized(CREATE)) {
        URI createUri = baseUriBuilder.clone().path("/create").build();
        resourceOptionsDto.addReflexiveLink(createUri, HttpMethod.POST, "create");
    }
    return resourceOptionsDto;
}
Also used : ResourceOptionsDto(org.camunda.bpm.engine.rest.dto.ResourceOptionsDto) UriBuilder(javax.ws.rs.core.UriBuilder) URI(java.net.URI)

Aggregations

URI (java.net.URI)13 ResourceOptionsDto (org.camunda.bpm.engine.rest.dto.ResourceOptionsDto)13 UriBuilder (javax.ws.rs.core.UriBuilder)6 IdentityService (org.camunda.bpm.engine.IdentityService)2