Package org.kie.workbench.common.services.shared.rest

Examples of org.kie.workbench.common.services.shared.rest.JobResult


        }
        return result;
    }

    public JobResult installProject( final String jobId, final String repositoryName, final String projectName ) {
        JobResult result = new JobResult();
        result.setJobId( jobId );

        org.uberfire.java.nio.file.Path repositoryPath = getRepositoryRootPath( repositoryName );

        if ( repositoryPath == null ) {
            result.setStatus( JobStatus.RESOURCE_NOT_EXIST );
            result.setResult( "Repository [" + repositoryName + "] does not exist" );
            return result;
        } else {
            Project project = projectService.resolveProject( Paths.convert( repositoryPath.resolve( projectName ) ) );

            if ( project == null ) {
                result.setStatus( JobStatus.RESOURCE_NOT_EXIST );
                result.setResult( "Project [" + projectName + "] does not exist" );
                return result;
            }

            BuildResults buildResults = null;
            try {
                buildResults = buildService.buildAndDeploy( project );

                result.setDetailedResult( buildResults == null ? null : deployResultToDetailedStringMessages( buildResults ) );
                result.setStatus( buildResults != null && buildResults.getErrorMessages().isEmpty() ? JobStatus.SUCCESS : JobStatus.FAIL );
            } catch ( Throwable t ) {
                List<String> errorResult = new ArrayList<String>();
                errorResult.add( t.getMessage() );
                result.setDetailedResult( errorResult );
                result.setStatus( JobStatus.FAIL );
            }
            return result;
        }
    }
View Full Code Here


    @Override
    public JobResult internalExecute(CommandContext ctx, JobRequest request) throws Exception {
        JobRequestHelper helper = getHelper(ctx);
        RemoveRepositoryRequest jobRequest = (RemoveRepositoryRequest) request;

        JobResult result = null;
        try {
            result = helper.removeRepository( jobRequest.getJobId(), jobRequest.getRepositoryName() );
        } finally {
            JobStatus status = result != null ? result.getStatus() : JobStatus.SERVER_ERROR;
            logger.info( "-----removeRepository--- , repository name: {} [{}]",
                    jobRequest.getRepositoryName(), status);
        }
        return result;
    }
View Full Code Here

    @Override
    public JobResult internalExecute(CommandContext ctx, JobRequest request) throws Exception {
        JobRequestHelper helper = getHelper(ctx);
        RemoveRepositoryFromOrganizationalUnitRequest jobRequest = (RemoveRepositoryFromOrganizationalUnitRequest) request;

        JobResult result = null;
        try {
            result = helper.removeRepositoryFromOrganizationalUnit( jobRequest.getJobId(), jobRequest.getOrganizationalUnitName(), jobRequest.getRepositoryName() );
        } finally {
            JobStatus status = result != null ? result.getStatus() : JobStatus.SERVER_ERROR;
            logger.debug( "-----removeRepositoryFromOrganizationalUnit--- , OrganizationalUnit name: {}, repository name: {} [{}]",
                    jobRequest.getOrganizationalUnitName(), jobRequest.getRepositoryName(), status);
        }
        return result;
    }
View Full Code Here

    @Override
    public JobResult internalExecute(CommandContext ctx, JobRequest request) throws Exception {
        JobRequestHelper helper = getHelper(ctx);
        CompileProjectRequest jobRequest = (CompileProjectRequest) request;

        JobResult result = null;
        try {
            result = helper.compileProject( jobRequest.getJobId(), jobRequest.getRepositoryName(), jobRequest.getProjectName() );
        } finally {
            JobStatus status = result != null ? result.getStatus() : JobStatus.SERVER_ERROR;
            logger.debug( "-----compileProject--- , repositoryName: {}, project name: {} [{}]",
                    jobRequest.getRepositoryName(), jobRequest.getProjectName(), status );
        }
        return result;
    }
View Full Code Here

    @Override
    public JobResult internalExecute(CommandContext ctx, JobRequest request) throws Exception {
        JobRequestHelper helper = getHelper(ctx);
        DeployProjectRequest jobRequest = (DeployProjectRequest) request;

        JobResult result = null;
        try {
            result = helper.deployProject(jobRequest.getJobId(), jobRequest.getRepositoryName(), jobRequest.getProjectName());
        } finally {
            JobStatus status = result != null ? result.getStatus() : JobStatus.SERVER_ERROR;
            logger.debug("-----deployProject--- , repositoryName: {}, project name: {} [{}]",
                    jobRequest.getRepositoryName(), jobRequest.getProjectName(), status);
        }
        return result;
    }
View Full Code Here

    @Override
    public JobResult internalExecute(CommandContext ctx, JobRequest request) throws Exception {
        JobRequestHelper helper = getHelper(ctx);
        CreateOrganizationalUnitRequest jobRequest = (CreateOrganizationalUnitRequest) request;

        JobResult result = null;
        try {
            result = helper.createOrganizationalUnit( jobRequest.getJobId(), jobRequest.getOrganizationalUnitName(), jobRequest.getOwner(), jobRequest.getRepositories() );
        } finally {
            JobStatus status = result != null ? result.getStatus() : JobStatus.SERVER_ERROR;
            logger.debug( "-----createOrganizationalUnit--- , OrganizationalUnit name: {}, OrganizationalUnit owner: {} [{}]",
                    jobRequest.getOrganizationalUnitName(), jobRequest.getOwner(), status );
        }
        return result;
    }
View Full Code Here

    @Override
    public JobResult internalExecute(CommandContext ctx, JobRequest request) throws Exception {
        JobRequestHelper helper = getHelper(ctx);
        TestProjectRequest jobRequest = (TestProjectRequest) request;

        JobResult result = null;
        try {
            result = helper.testProject( jobRequest.getJobId(), jobRequest.getRepositoryName(), jobRequest.getProjectName(), jobRequest.getBuildConfig() );
        } finally {
            JobStatus status = result != null ? result.getStatus() : JobStatus.SERVER_ERROR;
            logger.debug( "-----testProject--- , repositoryName: {}, project name: {} [{}]",
                    jobRequest.getRepositoryName(), jobRequest.getProjectName(), status);
        }
        return result;
    }
View Full Code Here

    @Override
    public JobResult internalExecute(CommandContext ctx, JobRequest request) throws Exception {
        JobRequestHelper helper = getHelper(ctx);
        RemoveOrganizationalUnitRequest jobRequest = (RemoveOrganizationalUnitRequest) request;

        JobResult result = null;
        try {
            result = helper.removeOrganizationalUnit(jobRequest.getJobId(), jobRequest.getOrganizationalUnitName());
        } finally {
            JobStatus status = result != null ? result.getStatus() : JobStatus.SERVER_ERROR;
            logger.debug( "-----removeOrganizationalUnit--- , OrganizationalUnit name: {}",
                    jobRequest.getOrganizationalUnitName(), status);
        }
        return result;
    }
View Full Code Here

    @Override
    public JobResult internalExecute(CommandContext ctx, JobRequest request) throws Exception {
        JobRequestHelper helper = getHelper(ctx);
        AddRepositoryToOrganizationalUnitRequest jobRequest = (AddRepositoryToOrganizationalUnitRequest) request;

        JobResult result = null;
        try {
            result = helper.addRepositoryToOrganizationalUnit( jobRequest.getJobId(), jobRequest.getOrganizationalUnitName(), jobRequest.getRepositoryName() );
        } finally {
            JobStatus status = result != null ? result.getStatus() : JobStatus.SERVER_ERROR;
            logger.debug( "-----addRepositoryToOrganizationalUnit--- , OrganizationalUnit name: {}, repository name: {} [{}]",
                    jobRequest.getOrganizationalUnitName(), jobRequest.getRepositoryName(), status );
        }
        return result;
    }
View Full Code Here

    @Override
    public JobResult internalExecute(CommandContext ctx, JobRequest request) throws Exception {
        JobRequestHelper helper = getHelper(ctx);
        CreateOrCloneRepositoryRequest jobRequest = (CreateOrCloneRepositoryRequest) request;

        JobResult result = null;
        try {
        result =  helper.createOrCloneRepository( jobRequest.getJobId(), jobRequest.getRepository() );
        } finally {
            JobStatus status = result != null ? result.getStatus() : JobStatus.SERVER_ERROR;
            logger.debug( "----createOrCloneRepository--- , repository name: {} [{}]",
                    jobRequest.getRepository().getName(), status);
        }
        return result;
    }
View Full Code Here

TOP

Related Classes of org.kie.workbench.common.services.shared.rest.JobResult

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.