Search in sources :

Example 1 with SchemaCsvWriter

use of org.activityinfo.shared.dto.SchemaCsvWriter in project activityinfo by bedatadriven.

the class RootResource method getDatabaseSchemaCsv.

@GET
@Path("/database/{id}/schema.csv")
public Response getDatabaseSchemaCsv(@PathParam("id") int id) {
    UserDatabaseDTO db = getDatabaseSchema(id);
    SchemaCsvWriter writer = new SchemaCsvWriter();
    writer.write(db);
    return Response.ok().type("text/css").header("Content-Disposition", "attachment; filename=schema_" + id + ".csv").entity(writer.toString()).build();
}
Also used : SchemaCsvWriter(org.activityinfo.shared.dto.SchemaCsvWriter) UserDatabaseDTO(org.activityinfo.shared.dto.UserDatabaseDTO) Path(javax.ws.rs.Path) GET(javax.ws.rs.GET)

Example 2 with SchemaCsvWriter

use of org.activityinfo.shared.dto.SchemaCsvWriter in project activityinfo by bedatadriven.

the class GetSchemaTest method toCSV.

@Test
public void toCSV() {
    SchemaDTO schema = execute(new GetSchema());
    SchemaCsvWriter writer = new SchemaCsvWriter();
    writer.write(schema.getDatabaseById(1));
    System.out.println(writer.toString());
}
Also used : SchemaCsvWriter(org.activityinfo.shared.dto.SchemaCsvWriter) SchemaDTO(org.activityinfo.shared.dto.SchemaDTO) GetSchema(org.activityinfo.shared.command.GetSchema) Test(org.junit.Test)

Aggregations

SchemaCsvWriter (org.activityinfo.shared.dto.SchemaCsvWriter)2 GET (javax.ws.rs.GET)1 Path (javax.ws.rs.Path)1 GetSchema (org.activityinfo.shared.command.GetSchema)1 SchemaDTO (org.activityinfo.shared.dto.SchemaDTO)1 UserDatabaseDTO (org.activityinfo.shared.dto.UserDatabaseDTO)1 Test (org.junit.Test)1