updating data tables api docs WIP

This commit is contained in:
John Woodlock
2012-09-27 15:45:01 +10:00
parent f53e662b6d
commit 471bfe2566
2 changed files with 54 additions and 44 deletions
@@ -62,11 +62,11 @@ public class DataTableApiResource {
@GET
@Consumes({ MediaType.APPLICATION_JSON })
@Produces({ MediaType.APPLICATION_JSON })
public String getDatatables(@QueryParam("appTable") final String appTable,
public String getDatatables(@QueryParam("apptable") final String apptable,
@Context final UriInfo uriInfo) {
List<DatatableData> result = this.readWriteNonCoreDataService
.retrieveDatatableNames(appTable);
.retrieveDatatableNames(apptable);
boolean prettyPrint = ApiParameterHelper.prettyPrint(uriInfo
.getQueryParameters());
@@ -75,21 +75,21 @@ public class DataTableApiResource {
}
@POST
@Path("/register/{datatable}/{appTable}")
@Path("register/{datatable}/{apptable}")
@Consumes({ MediaType.APPLICATION_JSON })
@Produces({ MediaType.APPLICATION_JSON })
public Response registerDatatable(
@PathParam("datatable") final String datatable,
@PathParam("appTable") final String appTable) {
@PathParam("apptable") final String apptable) {
this.readWriteNonCoreDataService.registerDatatable(datatable, appTable);
this.readWriteNonCoreDataService.registerDatatable(datatable, apptable);
EntityIdentifier entityIdentifier = new EntityIdentifier();
return Response.ok().entity(entityIdentifier).build();
}
@POST
@Path("/deregister/{datatable}")
@Path("deregister/{datatable}")
@Consumes({ MediaType.APPLICATION_JSON })
@Produces({ MediaType.APPLICATION_JSON })
public Response deregisterDatatable(
@@ -102,11 +102,11 @@ public class DataTableApiResource {
}
@GET
@Path("{datatable}/{appTableId}")
@Path("{datatable}/{apptableId}")
@Consumes({ MediaType.APPLICATION_JSON })
@Produces({ MediaType.APPLICATION_JSON })
public String getDatatable(@PathParam("datatable") final String datatable,
@PathParam("appTableId") final Long appTableId,
@PathParam("apptableId") final Long apptableId,
@QueryParam("sqlFields") final String sqlFields,
@QueryParam("sqlOrder") final String sqlOrder,
@Context final UriInfo uriInfo) {
@@ -121,7 +121,7 @@ public class DataTableApiResource {
*/
GenericResultsetData results = this.readWriteNonCoreDataService
.retrieveDataTableGenericResultSet(datatable, appTableId,
.retrieveDataTableGenericResultSet(datatable, apptableId,
sqlFields, sqlOrder, null);
boolean prettyPrints = ApiParameterHelper.prettyPrint(uriInfo
@@ -132,34 +132,34 @@ public class DataTableApiResource {
}
@POST
@Path("{datatable}/{appTableId}")
@Path("{datatable}/{apptableId}")
@Consumes({ MediaType.APPLICATION_JSON })
@Produces({ MediaType.APPLICATION_JSON })
public Response newDatatableEntry(
@PathParam("datatable") final String datatable,
@PathParam("appTableId") final Long appTableId,
@PathParam("apptableId") final Long apptableId,
final String jsonRequestBody) {
checkUserPermissionForDatatable(datatable, "CREATE");
Map<String, String> queryParams = getQueryParamsFromJsonRequestBody(jsonRequestBody);
this.readWriteNonCoreDataService.newDatatableEntry(datatable,
appTableId, queryParams);
apptableId, queryParams);
EntityIdentifier entityIdentifier = new EntityIdentifier(
Long.valueOf(appTableId));
Long.valueOf(apptableId));
return Response.ok().entity(entityIdentifier).build();
}
@PUT
@Path("{datatable}/{appTableId}")
@Path("{datatable}/{apptableId}")
@Consumes({ MediaType.APPLICATION_JSON })
@Produces({ MediaType.APPLICATION_JSON })
public Response updateDatatableEntryOnetoOne(
@PathParam("datatable") final String datatable,
@PathParam("appTableId") final Long appTableId,
@PathParam("apptableId") final Long apptableId,
final String jsonRequestBody) {
/*
* for updating one to one relationships (where foreign key is the
@@ -169,22 +169,22 @@ public class DataTableApiResource {
Map<String, String> queryParams = getQueryParamsFromJsonRequestBody(jsonRequestBody);
this.readWriteNonCoreDataService.updateDatatableEntryOnetoOne(
datatable, appTableId, queryParams);
datatable, apptableId, queryParams);
EntityIdentifier entityIdentifier = new EntityIdentifier(
Long.valueOf(appTableId));
Long.valueOf(apptableId));
return Response.ok().entity(entityIdentifier).build();
}
@PUT
@Path("{datatable}/{appTableId}/{datatableId}")
@Path("{datatable}/{apptableId}/{datatableId}")
@Consumes({ MediaType.APPLICATION_JSON })
@Produces({ MediaType.APPLICATION_JSON })
public Response updateDatatableEntryOnetoOne(
@PathParam("datatable") final String datatable,
@PathParam("appTableId") final Long appTableId,
@PathParam("apptableId") final Long apptableId,
@PathParam("datatableId") final Long datatableId,
final String jsonRequestBody) {
/*
@@ -195,51 +195,51 @@ public class DataTableApiResource {
Map<String, String> queryParams = getQueryParamsFromJsonRequestBody(jsonRequestBody);
this.readWriteNonCoreDataService.updateDatatableEntryOnetoMany(
datatable, appTableId, datatableId, queryParams);
datatable, apptableId, datatableId, queryParams);
EntityIdentifier entityIdentifier = new EntityIdentifier(
Long.valueOf(appTableId));
Long.valueOf(apptableId));
return Response.ok().entity(entityIdentifier).build();
}
@DELETE
@Path("{datatable}/{appTableId}")
@Path("{datatable}/{apptableId}")
@Consumes({ MediaType.APPLICATION_JSON })
@Produces({ MediaType.APPLICATION_JSON })
public Response deleteDatatableEntries(
@PathParam("datatable") final String datatable,
@PathParam("appTableId") final Long appTableId) {
@PathParam("apptableId") final Long apptableId) {
checkUserPermissionForDatatable(datatable, "DELETE");
this.readWriteNonCoreDataService.deleteDatatableEntries(datatable,
appTableId);
apptableId);
EntityIdentifier entityIdentifier = new EntityIdentifier(
Long.valueOf(appTableId));
Long.valueOf(apptableId));
return Response.ok().entity(entityIdentifier).build();
}
@DELETE
@Path("{datatable}/{appTableId}/{datatableId}")
@Path("{datatable}/{apptableId}/{datatableId}")
@Consumes({ MediaType.APPLICATION_JSON })
@Produces({ MediaType.APPLICATION_JSON })
public Response deleteDatatableEntries(
@PathParam("datatable") final String datatable,
@PathParam("appTableId") final Long appTableId,
@PathParam("apptableId") final Long apptableId,
@PathParam("datatableId") final Long datatableId) {
checkUserPermissionForDatatable(datatable, "DELETE");
this.readWriteNonCoreDataService.deleteDatatableEntry(datatable,
appTableId, datatableId);
apptableId, datatableId);
EntityIdentifier entityIdentifier = new EntityIdentifier(
Long.valueOf(appTableId));
Long.valueOf(apptableId));
return Response.ok().entity(entityIdentifier).build();