Search in sources :

Example 1 with ResourceOptionsDto

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

the class AuthorizationRestServiceImpl method availableOperations.

public ResourceOptionsDto availableOperations(UriInfo context) {
    UriBuilder baseUriBuilder = context.getBaseUriBuilder().path(relativeRootResourcePath).path(AuthorizationRestService.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 (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)

Example 2 with ResourceOptionsDto

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

the class UserResourceImpl method availableOperations.

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

Example 3 with ResourceOptionsDto

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

the class GroupMembersResourceImpl method availableOperations.

public ResourceOptionsDto availableOperations(UriInfo context) {
    ResourceOptionsDto dto = new ResourceOptionsDto();
    URI uri = context.getBaseUriBuilder().path(relativeRootResourcePath).path(GroupRestService.PATH).path(resourceId).path(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 4 with ResourceOptionsDto

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

the class AuthorizationResourceImpl method availableOperations.

public ResourceOptionsDto availableOperations(UriInfo context) {
    ResourceOptionsDto dto = new ResourceOptionsDto();
    URI uri = context.getBaseUriBuilder().path(relativeRootResourcePath).path(AuthorizationRestService.PATH).path(resourceId).build();
    dto.addReflexiveLink(uri, HttpMethod.GET, "self");
    if (isAuthorized(DELETE)) {
        dto.addReflexiveLink(uri, HttpMethod.DELETE, "delete");
    }
    if (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 5 with ResourceOptionsDto

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

the class GroupResourceImpl method availableOperations.

public ResourceOptionsDto availableOperations(UriInfo context) {
    ResourceOptionsDto dto = new ResourceOptionsDto();
    // add links if operations are authorized
    URI uri = context.getBaseUriBuilder().path(rootResourcePath).path(GroupRestService.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)

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