use of org.codehaus.enunciate.Facet in project data-access by pentaho.
the class AnalysisDatasourceService method postMondrainSchema.
/**
* This is used by PUC to use a form post to import a Mondrian Schema XML into PUR
*
* @param dataInputStream
* @param schemaFileInfo
* @param catalogName
* @param datasourceName
* @param overwrite
* @param xmlaEnabledFlag
* @param parameters
* @param acl acl information for the data source. This parameter is optional.
* @return this method returns a response of "SUCCESS" for success, 8 if exists, 2 for general error,etc.
* @throws PentahoAccessControlException
*/
@POST
@Path("/postAnalysis")
@Consumes(MediaType.MULTIPART_FORM_DATA)
@Produces({ "text/plain", "text/html" })
@Facet(name = "Unsupported")
public Response postMondrainSchema(@FormDataParam(UPLOAD_ANALYSIS) InputStream dataInputStream, @FormDataParam(UPLOAD_ANALYSIS) FormDataContentDisposition schemaFileInfo, // Optional
@FormDataParam(CATALOG_NAME) String catalogName, // Optional
@FormDataParam(ORIG_CATALOG_NAME) String origCatalogName, // Optional
@FormDataParam(DATASOURCE_NAME) String datasourceName, @FormDataParam(OVERWRITE_IN_REPOS) String overwrite, @FormDataParam(XMLA_ENABLED_FLAG) String xmlaEnabledFlag, @FormDataParam(PARAMETERS) String parameters, @FormDataParam(DATASOURCE_ACL) RepositoryFileAclDto acl) throws PentahoAccessControlException {
// use existing Jersey post method - but translate into text/html for PUC Client
ResponseBuilder responseBuilder;
Response response = this.putMondrianSchema(dataInputStream, schemaFileInfo, catalogName, origCatalogName, datasourceName, overwrite, xmlaEnabledFlag, parameters, acl);
responseBuilder = Response.ok();
responseBuilder.entity(String.valueOf(response.getStatus()));
responseBuilder.status(200);
return responseBuilder.build();
}
use of org.codehaus.enunciate.Facet in project data-access by pentaho.
the class ConnectionService method getConnectionIdByNameWithResponse.
/**
* Returns a response with id of a database connection
*
* @param name
* String representing the name of the database to search
* @return Response based on the string value of the connection id
*
* @throws ConnectionServiceException
*/
@GET
@Path("/getid")
@Produces({ APPLICATION_JSON })
@Facet(name = "Unsupported")
public Response getConnectionIdByNameWithResponse(@QueryParam("name") String name) throws ConnectionServiceException {
IDatabaseConnection conn = null;
Response response;
try {
conn = connectionService.getConnectionByName(name);
if (conn != null) {
response = Response.ok().entity(conn.getId()).build();
} else {
response = Response.notModified().build();
}
} catch (Exception ex) {
response = Response.serverError().entity(ex.getMessage()).build();
}
return response;
}
use of org.codehaus.enunciate.Facet in project data-access by pentaho.
the class ConnectionService method getPoolingParameters.
/**
* Returns a list of the database connection pool parameters
*
* @return IDatabaseConnectionPoolParameterList a list of the pooling parameters
*/
@GET
@Path("/poolingParameters")
@Produces({ APPLICATION_JSON })
@Facet(name = "Unsupported")
public IDatabaseConnectionPoolParameterList getPoolingParameters() {
IDatabaseConnectionPoolParameterList value = new DefaultDatabaseConnectionPoolParameterList();
List<IDatabaseConnectionPoolParameter> paramList = new ArrayList<IDatabaseConnectionPoolParameter>();
for (DatabaseConnectionPoolParameter param : poolingParameters) {
paramList.add(param);
}
value.setDatabaseConnectionPoolParameters(paramList);
return value;
}
use of org.codehaus.enunciate.Facet in project data-access by pentaho.
the class ConnectionService method getConnectionByNameWithResponse.
/**
* this is a method to return a response object with an error message use getEntity(Connection.class) and getStatus()
* to determine success
*/
@GET
@Path("/getresponse")
@Produces({ APPLICATION_JSON })
@Facet(name = "Unsupported")
public Response getConnectionByNameWithResponse(@QueryParam("name") String name) throws ConnectionServiceException {
IDatabaseConnection conn = null;
Response response;
try {
conn = connectionService.getConnectionByName(name);
sanitizer.unsanitizeConnectionParameters(conn);
hidePassword(conn);
response = Response.ok().entity(conn).build();
} catch (Exception ex) {
response = Response.serverError().entity(ex.getMessage()).build();
}
return response;
}
use of org.codehaus.enunciate.Facet in project data-access by pentaho.
the class ConnectionService method getConnectionByName.
/**
* Returns the list of database connections
*
* @param name
* String representing the name of the database to return
* @return Database connection by name
*
* @throws ConnectionServiceException
*/
@GET
@Path("/get")
@Produces({ APPLICATION_JSON })
@Facet(name = "Unsupported")
public IDatabaseConnection getConnectionByName(@QueryParam("name") String name) throws ConnectionServiceException {
IDatabaseConnection conn = connectionService.getConnectionByName(name);
hidePassword(conn);
return conn;
}
Aggregations