}
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;
}
}