Search in sources :

Example 1 with ExecutableFileTypeDto

use of org.pentaho.platform.repository2.unified.webservices.ExecutableFileTypeDto in project pentaho-platform by pentaho.

the class RepositoryResourceIT method testExecutableTypes.

@Test
public void testExecutableTypes() {
    WebResource webResource = resource();
    System.out.println(webResource.getURI().getPath());
    List<ExecutableFileTypeDto> executableTypes = webResource.path("repos/executableTypes").get(new GenericType<List<ExecutableFileTypeDto>>() {
    });
    assertEquals(1, executableTypes.size());
    assertEquals("xjunit", executableTypes.get(0).getExtension());
}
Also used : ExecutableFileTypeDto(org.pentaho.platform.repository2.unified.webservices.ExecutableFileTypeDto) WebResource(com.sun.jersey.api.client.WebResource) List(java.util.List) ArrayList(java.util.ArrayList) JerseyTest(com.sun.jersey.test.framework.JerseyTest) Test(org.junit.Test)

Example 2 with ExecutableFileTypeDto

use of org.pentaho.platform.repository2.unified.webservices.ExecutableFileTypeDto in project pentaho-platform by pentaho.

the class SystemResource method getExecutableTypes.

/**
 * Retrieves the list of supported content type in the platform
 *
 * @return list of <code> ExecutableFileTypeDto </code>
 */
@Path("/executableTypes")
@GET
@Produces({ APPLICATION_XML, APPLICATION_JSON })
@Facet(name = "Unsupported")
public Response getExecutableTypes() {
    ArrayList<ExecutableFileTypeDto> executableTypes = new ArrayList<ExecutableFileTypeDto>();
    for (String contentType : pluginManager.getContentTypes()) {
        IContentInfo contentInfo = pluginManager.getContentTypeInfo(contentType);
        ExecutableFileTypeDto executableFileType = new ExecutableFileTypeDto();
        executableFileType.setDescription(contentInfo.getDescription());
        executableFileType.setExtension(contentInfo.getExtension());
        executableFileType.setTitle(contentInfo.getTitle());
        executableFileType.setCanSchedule(hasOperationId(contentInfo.getOperations(), "SCHEDULE_NEW"));
        executableFileType.setCanEdit(hasOperationId(contentInfo.getOperations(), "EDIT"));
        executableTypes.add(executableFileType);
    }
    final GenericEntity<List<ExecutableFileTypeDto>> entity = new GenericEntity<List<ExecutableFileTypeDto>>(executableTypes) {
    };
    return Response.ok(entity).build();
}
Also used : IContentInfo(org.pentaho.platform.api.engine.IContentInfo) GenericEntity(javax.ws.rs.core.GenericEntity) ExecutableFileTypeDto(org.pentaho.platform.repository2.unified.webservices.ExecutableFileTypeDto) ArrayList(java.util.ArrayList) ArrayList(java.util.ArrayList) List(java.util.List) Path(javax.ws.rs.Path) Produces(javax.ws.rs.Produces) GET(javax.ws.rs.GET) Facet(org.codehaus.enunciate.Facet)

Example 3 with ExecutableFileTypeDto

use of org.pentaho.platform.repository2.unified.webservices.ExecutableFileTypeDto in project pentaho-platform by pentaho.

the class RepositoryResource method getExecutableTypes.

/**
 * Retrieves the list of supported content type in the platform
 *
 * @return list of <code> ExecutableFileTypeDto </code>
 */
@Path("/executableTypes")
@GET
@Produces({ APPLICATION_XML, APPLICATION_JSON })
@Facet(name = "Unsupported")
public Response getExecutableTypes() {
    ArrayList<ExecutableFileTypeDto> executableTypes = new ArrayList<ExecutableFileTypeDto>();
    for (String contentType : pluginManager.getContentTypes()) {
        IContentInfo contentInfo = pluginManager.getContentTypeInfo(contentType);
        ExecutableFileTypeDto executableFileType = new ExecutableFileTypeDto();
        executableFileType.setDescription(contentInfo.getDescription());
        executableFileType.setExtension(contentInfo.getExtension());
        executableFileType.setTitle(contentInfo.getTitle());
        executableFileType.setCanSchedule(hasOperationId(contentInfo.getOperations(), "SCHEDULE_NEW"));
        executableFileType.setCanEdit(hasOperationId(contentInfo.getOperations(), "EDIT"));
        executableTypes.add(executableFileType);
    }
    final GenericEntity<List<ExecutableFileTypeDto>> entity = new GenericEntity<List<ExecutableFileTypeDto>>(executableTypes) {
    };
    return Response.ok(entity).build();
}
Also used : IContentInfo(org.pentaho.platform.api.engine.IContentInfo) GenericEntity(javax.ws.rs.core.GenericEntity) ExecutableFileTypeDto(org.pentaho.platform.repository2.unified.webservices.ExecutableFileTypeDto) ArrayList(java.util.ArrayList) ArrayList(java.util.ArrayList) List(java.util.List) Path(javax.ws.rs.Path) Produces(javax.ws.rs.Produces) GET(javax.ws.rs.GET) Facet(org.codehaus.enunciate.Facet)

Aggregations

ArrayList (java.util.ArrayList)3 List (java.util.List)3 ExecutableFileTypeDto (org.pentaho.platform.repository2.unified.webservices.ExecutableFileTypeDto)3 GET (javax.ws.rs.GET)2 Path (javax.ws.rs.Path)2 Produces (javax.ws.rs.Produces)2 GenericEntity (javax.ws.rs.core.GenericEntity)2 Facet (org.codehaus.enunciate.Facet)2 IContentInfo (org.pentaho.platform.api.engine.IContentInfo)2 WebResource (com.sun.jersey.api.client.WebResource)1 JerseyTest (com.sun.jersey.test.framework.JerseyTest)1 Test (org.junit.Test)1