use of org.codehaus.enunciate.Facet in project pentaho-platform by pentaho.
the class RepositoryPublishResource method writeFileWithEncodedName.
/**
* Publishes the file to the provided path in the repository. The file will be overwritten if {@code overwriteFile}
* is {@code true}.
*
* This method should be used instead of
* {@linkplain #writeFile(String, InputStream, Boolean, FormDataContentDisposition)}. Contrary to
* {@linkplain FileResource} convention, it expects {@code pathId} <b>not</b> to be separated by colons, but to be
* simply encoded with {@linkplain java.net.URLEncoder}. Also it expects {@code pathId} to be a well-formatted
* Unix-style path with no slash at the end.
*
* Examples of correct {@code pathId}:
* <ul>
* <li><tt>%2Fpublic%2Fmyfile.txt</tt></li>
* <li><tt>%2Fpublic%2Fmyfile</tt></li>
* <li><tt>%2Fpublic%2Fmyfile</tt></li>
* <li><tt>%2Fpublic%2Fmyfile%22quoted%22</tt></li>
* </ul>
*
* @param pathId slash-separated path for the repository file
* @param fileContents input stream containing the data
* @param overwriteFile flag to determine whether to overwrite the existing file in the repository or not
* @param fileInfo file information (Currently not being used).
*
* @return A jax-rs Response object with the appropriate status code, header, and body.
*/
@POST
@Path("/file")
@Consumes({ MediaType.MULTIPART_FORM_DATA })
@Produces(MediaType.TEXT_PLAIN)
@StatusCodes({ @ResponseCode(code = 200, condition = "Successfully publish the file."), @ResponseCode(code = 403, condition = "Failure to publish the file due to permissions."), @ResponseCode(code = 422, condition = "Failure to publish the file due to failed validation."), @ResponseCode(code = 500, condition = "Failure to publish the file due to a server error.") })
@Facet(name = "Unsupported")
public Response writeFileWithEncodedName(@FormDataParam("importPath") String pathId, @FormDataParam("fileUpload") InputStream fileContents, @FormDataParam("overwriteFile") Boolean overwriteFile, @FormDataParam("fileUpload") FormDataContentDisposition fileInfo) {
Optional<Properties> fileProperties = Optional.of(new Properties());
fileProperties.get().setProperty("overwriteFile", String.valueOf(overwriteFile));
return writeFile(pathId, fileContents, fileInfo, fileProperties);
}
use of org.codehaus.enunciate.Facet 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();
}
use of org.codehaus.enunciate.Facet in project pentaho-platform by pentaho.
the class RootResource method doGetDocs.
@GET
@Path("docs")
@Facet(name = "Unsupported")
public Response doGetDocs() throws URISyntaxException {
String fqurl = PentahoSystem.getApplicationContext().getFullyQualifiedServerURL();
// $NON-NLS-1$
URI uri = new URI(fqurl + "docs/InformationMap.jsp");
return Response.temporaryRedirect(uri).build();
}
use of org.codehaus.enunciate.Facet in project pentaho-platform by pentaho.
the class SessionResource method setredirect.
@GET
@Path("/setredirect")
@Produces(TEXT_PLAIN)
@Facet(name = "Unsupported")
public Response setredirect() {
IPentahoSession pentahoSession = PentahoSessionHolder.getSession();
pentahoSession.setAttribute("redirect", true);
return Response.ok().type(MediaType.TEXT_PLAIN).build();
}
use of org.codehaus.enunciate.Facet in project pentaho-platform by pentaho.
the class SystemRefreshResource method flushMondrianSchemaCache.
@GET
@Path("/mondrianSingleSchemaCache")
@Produces({ MediaType.TEXT_PLAIN, MediaType.APPLICATION_JSON })
@Facet(name = "Unsupported")
public Response flushMondrianSchemaCache(@QueryParam("name") String name) {
if (canAdminister()) {
IPentahoSession pentahoSession = PentahoSessionHolder.getSession();
if (canAdminister()) {
IOlapService olapService = // $NON-NLS-1$
PentahoSystem.get(IOlapService.class, "IOlapService", pentahoSession);
olapService.flush(pentahoSession, name);
}
return Response.ok().type(MediaType.TEXT_PLAIN).build();
} else {
return Response.status(UNAUTHORIZED).build();
}
}
Aggregations