Package org.ff4j.exception

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


        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

    @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

    @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

    @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

    @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

    @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

    @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

    public void enable(String uid) {
        if (uid == null || uid.isEmpty()) {
            throw new IllegalArgumentException("Feature identifier (param#0) cannot be null nor empty");
        }
        if (!exist(uid)) {
            throw new FeatureNotFoundException(uid);
        }
        getJdbcTemplate().update(SQL_ENABLE, uid);
    }
View Full Code Here

    public void disable(String uid) {
        if (uid == null || uid.isEmpty()) {
            throw new IllegalArgumentException("Feature identifier (param#0) cannot be null nor empty");
        }
        if (!exist(uid)) {
            throw new FeatureNotFoundException(uid);
        }
        getJdbcTemplate().update(SQL_DISABLE, uid);
    }
View Full Code Here

TOP

Related Classes of org.ff4j.exception.FeatureNotFoundException

Copyright © 2018 www.massapicom. 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.