Search in sources :

Example 11 with Facet

use of org.codehaus.enunciate.Facet in project pentaho-platform by pentaho.

the class UserConsoleResource method setSessionVariable.

@POST
@Path("/session-variable")
@Facet(name = "Unsupported")
public Response setSessionVariable(@QueryParam("key") String key, @QueryParam("value") String value) {
    if (setSessionVarWhiteList.contains(key)) {
        IPentahoSession session = UserConsoleService.getPentahoSession();
        session.setAttribute(key, value);
        return Response.ok(session.getAttribute(key)).build();
    }
    return Response.status(FORBIDDEN).build();
}
Also used : IPentahoSession(org.pentaho.platform.api.engine.IPentahoSession) Path(javax.ws.rs.Path) POST(javax.ws.rs.POST) Facet(org.codehaus.enunciate.Facet)

Example 12 with Facet

use of org.codehaus.enunciate.Facet in project pentaho-platform by pentaho.

the class SystemRefreshResource method purgeReportingDataCache.

/**
 * @deprecated use org.pentaho.reporting.platform.plugin.CacheManagerEndpoint instead
 */
@Deprecated
@GET
@Path("/reportingDataCache")
@Produces({ MediaType.TEXT_PLAIN, MediaType.APPLICATION_JSON })
@Facet(name = "Unsupported")
public Response purgeReportingDataCache() {
    if (canAdminister()) {
        ICacheManager cacheManager = PentahoSystem.get(ICacheManager.class);
        cacheManager.clearRegionCache("report-dataset-cache");
        cacheManager.clearRegionCache("report-output-handlers");
        Runnable clearCacheAction = PentahoSystem.get(Runnable.class, "_ClearCacheAction", PentahoSessionHolder.getSession());
        if (clearCacheAction != null) {
            clearCacheAction.run();
        }
        return Response.ok().type(MediaType.TEXT_PLAIN).build();
    } else {
        return Response.status(UNAUTHORIZED).build();
    }
}
Also used : ICacheManager(org.pentaho.platform.api.engine.ICacheManager) Path(javax.ws.rs.Path) Produces(javax.ws.rs.Produces) GET(javax.ws.rs.GET) Facet(org.codehaus.enunciate.Facet)

Example 13 with Facet

use of org.codehaus.enunciate.Facet in project pentaho-platform by pentaho.

the class SystemRefreshResource method flushMondrianSchemaCache.

@GET
@Path("/mondrianSchemaCache")
@Produces({ MediaType.TEXT_PLAIN, MediaType.APPLICATION_JSON })
@Facet(name = "Unsupported")
public Response flushMondrianSchemaCache() {
    if (canAdminister()) {
        IPentahoSession pentahoSession = PentahoSessionHolder.getSession();
        if (canAdminister()) {
            // Flush the catalog helper (legacy)
            IMondrianCatalogService mondrianCatalogService = // $NON-NLS-1$
            PentahoSystem.get(IMondrianCatalogService.class, "IMondrianCatalogService", pentahoSession);
            mondrianCatalogService.reInit(pentahoSession);
            // Flush the IOlapService
            IOlapService olapService = // $NON-NLS-1$
            PentahoSystem.get(IOlapService.class, "IOlapService", pentahoSession);
            olapService.flushAll(pentahoSession);
        }
        return Response.ok().type(MediaType.TEXT_PLAIN).build();
    } else {
        return Response.status(UNAUTHORIZED).build();
    }
}
Also used : IOlapService(org.pentaho.platform.plugin.action.olap.IOlapService) IPentahoSession(org.pentaho.platform.api.engine.IPentahoSession) IMondrianCatalogService(org.pentaho.platform.plugin.action.mondrian.catalog.IMondrianCatalogService) Path(javax.ws.rs.Path) Produces(javax.ws.rs.Produces) GET(javax.ws.rs.GET) Facet(org.codehaus.enunciate.Facet)

Example 14 with Facet

use of org.codehaus.enunciate.Facet in project pentaho-platform by pentaho.

the class SystemRefreshResource method refreshMetadata.

@GET
@Path("/metadata")
@Facet(name = "Unsupported")
@Produces(TEXT_PLAIN)
public String refreshMetadata() {
    String result = null;
    IPentahoSession pentahoSession = PentahoSessionHolder.getSession();
    if (canAdminister()) {
        result = PentahoSystem.publish(pentahoSession, org.pentaho.platform.engine.services.metadata.MetadataPublisher.class.getName());
    }
    return result;
}
Also used : IPentahoSession(org.pentaho.platform.api.engine.IPentahoSession) Path(javax.ws.rs.Path) Produces(javax.ws.rs.Produces) GET(javax.ws.rs.GET) Facet(org.codehaus.enunciate.Facet)

Example 15 with Facet

use of org.codehaus.enunciate.Facet 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)

Aggregations

Facet (org.codehaus.enunciate.Facet)48 Path (javax.ws.rs.Path)43 Produces (javax.ws.rs.Produces)33 GET (javax.ws.rs.GET)29 ArrayList (java.util.ArrayList)12 Consumes (javax.ws.rs.Consumes)12 POST (javax.ws.rs.POST)8 PentahoAccessControlException (org.pentaho.platform.api.engine.PentahoAccessControlException)8 PUT (javax.ws.rs.PUT)7 IPentahoSession (org.pentaho.platform.api.engine.IPentahoSession)6 IUserRoleDao (org.pentaho.platform.api.engine.security.userroledao.IUserRoleDao)6 Response (javax.ws.rs.core.Response)5 IDatabaseConnection (org.pentaho.database.model.IDatabaseConnection)5 HashSet (java.util.HashSet)4 StringTokenizer (java.util.StringTokenizer)4 StatusCodes (org.codehaus.enunciate.jaxrs.StatusCodes)4 IPluginManager (org.pentaho.platform.api.engine.IPluginManager)4 IMondrianCatalogService (org.pentaho.platform.plugin.action.mondrian.catalog.IMondrianCatalogService)4 ByteArrayOutputStream (java.io.ByteArrayOutputStream)3 IOException (java.io.IOException)3