Package org.rhq.enterprise.server.rest.domain

Examples of org.rhq.enterprise.server.rest.domain.OperationRest


            opDef = opsManager.getOperationDefinition(caller,definitionId);
        }
        catch (OperationDefinitionNotFoundException odnfe) {
            throw new StuffNotFoundException("Operation definition with id " + definitionId);
        }
        OperationRest operationRest = new OperationRest(resourceId,definitionId);
        operationRest.setId((int)System.currentTimeMillis()); // TODO better id (?)(we need one for pUT later on)
        operationRest.setReadyToSubmit(false);
        operationRest.setName(opDef.getName());
        ConfigurationDefinition paramDefinition = opDef.getParametersConfigurationDefinition();
        if (paramDefinition != null) {
            for (PropertyDefinition propDefs : paramDefinition.getNonGroupedProperties()) { // TODO extend to all properties ?
                operationRest.getParams().put(propDefs.getName(),"TODO"); // TODO type and value of the value
            }
        }

        UriBuilder uriBuilder = uriInfo.getBaseUriBuilder();
        uriBuilder.path("/operation/{id}");
        URI uri = uriBuilder.build(operationRest.getId());
        Link editLink = new Link("edit",uri.toString());
        operationRest.addLink(editLink);
        Response.ResponseBuilder builder = Response.ok(operationRest);

        putToCache(operationRest.getId(),OperationRest.class,operationRest);

        return builder.build();

    }
View Full Code Here


    @GET
    @Path("{id}")
    @ApiOperation("Return a (draft) operation")
    public Response getOperation(@ApiParam("Id of the operation to retrieve") @PathParam("id") int operationId) {

        OperationRest op = getFromCache(operationId,OperationRest.class);
        if (op==null) {
            throw new StuffNotFoundException("Operation with id " + operationId);
        }

        return Response.ok(op).build();
View Full Code Here

        }
    )
    public Response updateOperation(@ApiParam("Id of the operation to update") @PathParam("id") int operationId,
                OperationRest operation, @Context UriInfo uriInfo) {

        OperationRest op = getFromCache(operationId,OperationRest.class);
        if (op==null) {
            throw new StuffNotFoundException("Operation with id " + operationId);
        }

        Configuration parameters = ConfigurationHelper.mapToConfiguration(operation.getParams());
View Full Code Here

TOP

Related Classes of org.rhq.enterprise.server.rest.domain.OperationRest

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.