WIP api docs update data tables
This commit is contained in:
+34
-34
@@ -2412,14 +2412,14 @@ Request Body:
|
||||
<div class="method-description">
|
||||
<h4>List Data Tables</h4>
|
||||
<p>
|
||||
Lists the registered data tables and the Mifos X Core application table they are registered to.
|
||||
Lists registered data tables and the Mifos X Core application table they are registered to.
|
||||
</p>
|
||||
|
||||
<h5>Arguments</h5>
|
||||
<dl class="argument-list">
|
||||
<dt>appTable</dt>
|
||||
<dd><span>optional</span></dd>
|
||||
<dd>The Mifos X core table to restrict the output to</dd>
|
||||
<dd>The Mifos X core application table.</dd>
|
||||
</dl>
|
||||
<p>Example Requests: </p>
|
||||
<div class=apiClick>datatables?appTable=m_client</div>
|
||||
@@ -2446,6 +2446,38 @@ Request Body:
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<a id="datatables_register" name="datatables_register" class="old-syle-anchor"> </a>
|
||||
<div class="method-section">
|
||||
<div class="method-description">
|
||||
<h4>Register Data Table</h4>
|
||||
<p>
|
||||
Registers a data table with the Mifos X Core application table.
|
||||
</p>
|
||||
</div>
|
||||
<div class="method-example">
|
||||
<code class="method-declaration">POST https://Domain Name/api/v1/datatable/{datatable}/{set}/{id}</code>
|
||||
<code class="method-request">POST additionalfields/portfolio_client/Additional Information/2
|
||||
Content-Type: application/json
|
||||
Request Body:
|
||||
{
|
||||
"Ethnic_Group":"Berber",
|
||||
"Ethnic_Group_Other":"",
|
||||
"Household_Location":"East Sikkim",
|
||||
"Household_Location_Other":"",
|
||||
"Religion":"Animist",
|
||||
"Religion_Other":"jjjjjjj",
|
||||
"Knowledge_of_Person":"Son/daughter of staff member",
|
||||
"Gender":"Female",
|
||||
"Whois":"its\r\nme of\r\ncourse\r\nyes\r\nend and the end of it all"
|
||||
}
|
||||
</code>
|
||||
<code class="method-response">{
|
||||
"entityId": 2
|
||||
}
|
||||
</code>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
|
||||
<a id="additionalfields_retrieve" name="additionalfields_retrieve" class="old-syle-anchor"> </a>
|
||||
<div class="method-section">
|
||||
@@ -2523,38 +2555,6 @@ Request Body:
|
||||
</code>
|
||||
</div>
|
||||
</div>
|
||||
<a id="additionalfields_update" name="additionalfields_update" class="old-syle-anchor"> </a>
|
||||
<div class="method-section">
|
||||
<div class="method-description">
|
||||
<h4>Update Additional Fields</h4>
|
||||
<p>
|
||||
Updates (or creates) the Set of Additional Fields data for the ID provided. The ID is the id field of the Type table e.g. portfolio_client might have an id value of 4.
|
||||
</p>
|
||||
</div>
|
||||
<div class="method-example">
|
||||
<code class="method-declaration">POST https://Domain Name/api/v1/additionalfields/{type}/{set}/{id}</code>
|
||||
<code class="method-request">POST additionalfields/portfolio_client/Additional Information/2
|
||||
Content-Type: application/json
|
||||
Request Body:
|
||||
{
|
||||
"Ethnic_Group":"Berber",
|
||||
"Ethnic_Group_Other":"",
|
||||
"Household_Location":"East Sikkim",
|
||||
"Household_Location_Other":"",
|
||||
"Religion":"Animist",
|
||||
"Religion_Other":"jjjjjjj",
|
||||
"Knowledge_of_Person":"Son/daughter of staff member",
|
||||
"Gender":"Female",
|
||||
"Whois":"its\r\nme of\r\ncourse\r\nyes\r\nend and the end of it all"
|
||||
}
|
||||
</code>
|
||||
<code class="method-response">{
|
||||
"entityId": 2
|
||||
}
|
||||
</code>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
|
||||
|
||||
<!-- start of reports api docs -->
|
||||
|
||||
@@ -66,11 +66,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());
|
||||
@@ -79,14 +79,14 @@ 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();
|
||||
@@ -106,11 +106,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) {
|
||||
@@ -118,7 +118,7 @@ public class DataTableApiResource {
|
||||
checkUserPermissionForDatatable(datatable, "READ");
|
||||
|
||||
GenericResultsetData results = this.readWriteNonCoreDataService
|
||||
.retrieveDataTableGenericResultSet(datatable, apptableId,
|
||||
.retrieveDataTableGenericResultSet(datatable, appTableId,
|
||||
sqlFields, sqlOrder, null);
|
||||
|
||||
String json = "";
|
||||
@@ -134,34 +134,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
|
||||
@@ -171,22 +171,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) {
|
||||
/*
|
||||
@@ -197,51 +197,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();
|
||||
|
||||
|
||||
Reference in New Issue
Block a user