Examples of FeatureNotFoundException


Examples of org.ff4j.exception.FeatureNotFoundException

        }
        MultivaluedMap<String, String> formData = new MultivaluedMapImpl();
        formData.add(POST_PARAMNAME_GROUPNAME, groupName);
        ClientResponse cRes = getStore().path(uid).path(OPERATION_ADDGROUP).post(ClientResponse.class, formData);
        if (Status.NOT_FOUND.getStatusCode() == cRes.getStatus()) {
            throw new FeatureNotFoundException(uid);
        }
        if (Status.NO_CONTENT.getStatusCode() != cRes.getStatus()) {
            throw new FeatureAccessException("Cannot add feature to group, an HTTP error " + cRes.getStatus() + " occured.");
        }
    }
View Full Code Here

Examples of org.ff4j.exception.FeatureNotFoundException

        if (Status.NOT_FOUND.getStatusCode() == cRes.getStatus()) {
            String errorMsg = cRes.getEntity(String.class);
            if (errorMsg.contains("group")) {
                throw new GroupNotFoundException(groupName);
            }
            throw new FeatureNotFoundException(uid);
        }
        if (Status.NO_CONTENT.getStatusCode() != cRes.getStatus()) {
            throw new FeatureAccessException("Cannot remove feature from group, an HTTP error " + cRes.getStatus() + " occured.");
        }
    }
View Full Code Here

Examples of org.ff4j.exception.FeatureNotFoundException

    @Produces(MediaType.APPLICATION_JSON)
    @RolesAllowed({ROLE_READ})
    public Response read() {
        // if cannot be null due to state diagram (will list)
        if (!getStore().exist(id)) {
            return Response.status(Response.Status.NOT_FOUND).entity(new FeatureNotFoundException(id).getMessage()).build();
        } else {
            return Response.ok(getStore().read(id).toJson()).build();
        }
    }
View Full Code Here

Examples of org.ff4j.exception.FeatureNotFoundException

        if (id == null || "".equals(id)) {
            return Response.status(Response.Status.BAD_REQUEST)
                    .entity("Invalid URL : Must be '/features/{id}' with {id} not null nor empty").build();
        }
        if (!getStore().exist(id)) {
            return Response.status(Response.Status.NOT_FOUND).entity(new FeatureNotFoundException(id).getMessage()).build();
        } else {
            getStore().delete(id);
            return Response.status(Response.Status.NO_CONTENT).build();
        }
    }
View Full Code Here

Examples of org.ff4j.exception.FeatureNotFoundException

    @POST
    @Path(OPERATION_ENABLE)
    @RolesAllowed({ROLE_WRITE})
    public Response operationEnable() {
        if (!getStore().exist(id)) {
            return Response.status(Response.Status.NOT_FOUND).entity(new FeatureNotFoundException(id).getMessage()).build();
        }
        getStore().enable(id);
        return Response.noContent().build();
    }
View Full Code Here

Examples of org.ff4j.exception.FeatureNotFoundException

    @POST
    @Path(OPERATION_DISABLE)
    @RolesAllowed({ROLE_WRITE})
    public Response operationDisable() {
        if (!getStore().exist(id)) {
            return Response.status(Response.Status.NOT_FOUND).entity(new FeatureNotFoundException(id).getMessage()).build();
        }
        getStore().disable(id);
        return Response.noContent().build();
    }
View Full Code Here

Examples of org.ff4j.exception.FeatureNotFoundException

    @Path(OPERATION_GRANTROLE)
    @Consumes(MediaType.APPLICATION_FORM_URLENCODED)
    @RolesAllowed({ROLE_WRITE})
    public Response operationGrantRole(MultivaluedMap<String, String> formParams) {
        if (!getStore().exist(id)) {
            return Response.status(Response.Status.NOT_FOUND).entity(new FeatureNotFoundException(id).getMessage()).build();
        }
        if (!formParams.containsKey(POST_PARAMNAME_ROLENAME)) {
            return Response.status(Response.Status.BAD_REQUEST).entity(POST_PARAMNAME_ROLENAME + " is a required POST parameter")
                    .build();
        }
View Full Code Here

Examples of org.ff4j.exception.FeatureNotFoundException

    @Path(OPERATION_REMOVEROLE)
    @Consumes(MediaType.APPLICATION_FORM_URLENCODED)
    @RolesAllowed({ROLE_WRITE})
    public Response operationRemoveRole(MultivaluedMap<String, String> formParams) {
        if (!getStore().exist(id)) {
            return Response.status(Response.Status.NOT_FOUND).entity(new FeatureNotFoundException(id).getMessage()).build();
        }
        if (!formParams.containsKey(POST_PARAMNAME_ROLENAME)) {
            return Response.status(Response.Status.BAD_REQUEST).entity(POST_PARAMNAME_ROLENAME + " is a required POST parameter")
                    .build();
        }
View Full Code Here

Examples of org.ff4j.exception.FeatureNotFoundException

    @Path(OPERATION_ADDGROUP)
    @Consumes(MediaType.APPLICATION_FORM_URLENCODED)
    @RolesAllowed({ROLE_WRITE})
    public Response operationAddGroup(MultivaluedMap<String, String> formParams) {
        if (!getStore().exist(id)) {
            return Response.status(Response.Status.NOT_FOUND).entity(new FeatureNotFoundException(id).getMessage()).build();
        }
        if (!formParams.containsKey(POST_PARAMNAME_GROUPNAME)) {
            return Response.status(Response.Status.BAD_REQUEST)
                    .entity(POST_PARAMNAME_GROUPNAME + " is a required POST parameter")
                    .build();
View Full Code Here

Examples of org.ff4j.exception.FeatureNotFoundException

    @Path(OPERATION_REMOVEGROUP)
    @Consumes(MediaType.APPLICATION_FORM_URLENCODED)
    @RolesAllowed({ROLE_WRITE})
    public Response operationRemoveGroup(MultivaluedMap<String, String> formParams) {
        if (!getStore().exist(id)) {
            return Response.status(Response.Status.NOT_FOUND).entity(new FeatureNotFoundException(id).getMessage()).build();
        }
        if (!formParams.containsKey(POST_PARAMNAME_GROUPNAME)) {
            return Response.status(Response.Status.BAD_REQUEST)
                    .entity(POST_PARAMNAME_GROUPNAME + " is a required POST parameter")
                    .build();
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.