Start line:  
End line:  

Snippet Preview

Snippet HTML Code

Stack Overflow Questions
 package org.kie.remote.services.rest;
 
 import java.util.Map;
 
 import  javax.enterprise.context.RequestScoped;
 import  javax.inject.Inject;
 import  javax.ws.rs.PathParam;
 import  javax.ws.rs.core.Context;
 import  javax.ws.rs.core.HttpHeaders;
import  javax.ws.rs.core.Response;
import  javax.ws.rs.core.Response.Status;
import  org.kie.remote.services.rest.api.DeploymentResource;
import  org.kie.services.client.serialization.jaxb.impl.deploy.JaxbDeploymentDescriptor;
import  org.kie.services.client.serialization.jaxb.impl.deploy.JaxbDeploymentJobResult;
import  org.kie.services.client.serialization.jaxb.impl.deploy.JaxbDeploymentUnit;
import  org.kie.services.client.serialization.jaxb.impl.process.JaxbProcessDefinitionList;
import  org.slf4j.Logger;
import  org.slf4j.LoggerFactory;

If a method in this class is annotated by a

Path:
annotation, then the name of the method should match the URL specified in the @Path, where "_" characters should be used for all "/" characters in the path.

For example:

Path:
"/begin/{varOne: [_a-zA-Z0-9-:\\.]+}/midddle/{varTwo: [a-z]+}") public void begin_varOne_middle_varTwo() { If the method is annotated by the @Path anno, but is the "root", then give it a name that explains it's funtion.
@RequestScoped
public class DeploymentResourceImpl extends ResourceBase implements DeploymentResource {
    private static final Logger logger = LoggerFactory.getLogger(DeploymentResourceImpl.class);
    
    /* REST information */
    
    @Context
    private HttpHeaders headers;
    
    @PathParam("deploymentId")
    private String deploymentId;
    
    /* Deployment operations */
   
    @Inject 
    private DeployResourceBase deployBase;
   
    // REST operations -----------------------------------------------------------------------------------------------------------
    @Override
    public Response getConfig() { 
        JaxbDeploymentUnit jaxbDepUnit = .determineStatus(true);
        .debug("Returning deployment unit information for " + );
        return createCorrectVariant(jaxbDepUnit);
    }
    @Override
    public Response deploy(JaxbDeploymentDescriptor deployDescriptor) {
        // parse request/options 
        Map<StringString []> params = getRequestParams();
        String oper = getRelativePath();
        String strategy = getStringParam("strategy"falseparamsoper);
        String mergeMode = getStringParam("mergemode"falseparamsoper);
        
        // schedule deployment
        JaxbDeploymentJobResult jobResult = .submitDeployJob(strategymergeModedeployDescriptor);
        return createCorrectVariant(jobResult, Status.ACCEPTED);
    }
   
    @Override
    public Response undeploy() { 
        JaxbDeploymentJobResult jobResult = .submitUndeployJob();
        return createCorrectVariant(jobResult, Status.ACCEPTED);
    }
   
    @Override
    public Response listProcessDefinitions() { 
        String oper = getRelativePath();
        Map<StringString[]> params = getRequestParams();
        int [] pageInfo = getPageNumAndPageSize(paramsoper);
        int maxNumResults = getMaxNumResultsNeeded(pageInfo); 
        
        JaxbProcessDefinitionList jaxbProcDefList  = new JaxbProcessDefinitionList();
        .fillProcessDefinitionList(pageInfomaxNumResultsjaxbProcDefList.getProcessDefinitionList());
        JaxbProcessDefinitionList resultList 
            = paginateAndCreateResult(pageInfojaxbProcDefList.getProcessDefinitionList(), new JaxbProcessDefinitionList());
        return createCorrectVariant(resultList);
    }
New to GrepCode? Check out our FAQ X