WIP api docs update data tables
This commit is contained in:
+34
-34
@@ -2412,14 +2412,14 @@ Request Body:
|
|||||||
<div class="method-description">
|
<div class="method-description">
|
||||||
<h4>List Data Tables</h4>
|
<h4>List Data Tables</h4>
|
||||||
<p>
|
<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>
|
</p>
|
||||||
|
|
||||||
<h5>Arguments</h5>
|
<h5>Arguments</h5>
|
||||||
<dl class="argument-list">
|
<dl class="argument-list">
|
||||||
<dt>appTable</dt>
|
<dt>appTable</dt>
|
||||||
<dd><span>optional</span></dd>
|
<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>
|
</dl>
|
||||||
<p>Example Requests: </p>
|
<p>Example Requests: </p>
|
||||||
<div class=apiClick>datatables?appTable=m_client</div>
|
<div class=apiClick>datatables?appTable=m_client</div>
|
||||||
@@ -2446,6 +2446,38 @@ Request Body:
|
|||||||
</div>
|
</div>
|
||||||
</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>
|
<a id="additionalfields_retrieve" name="additionalfields_retrieve" class="old-syle-anchor"> </a>
|
||||||
<div class="method-section">
|
<div class="method-section">
|
||||||
@@ -2523,38 +2555,6 @@ Request Body:
|
|||||||
</code>
|
</code>
|
||||||
</div>
|
</div>
|
||||||
</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 -->
|
<!-- start of reports api docs -->
|
||||||
|
|||||||
@@ -66,11 +66,11 @@ public class DataTableApiResource {
|
|||||||
@GET
|
@GET
|
||||||
@Consumes({ MediaType.APPLICATION_JSON })
|
@Consumes({ MediaType.APPLICATION_JSON })
|
||||||
@Produces({ 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) {
|
@Context final UriInfo uriInfo) {
|
||||||
|
|
||||||
List<DatatableData> result = this.readWriteNonCoreDataService
|
List<DatatableData> result = this.readWriteNonCoreDataService
|
||||||
.retrieveDatatableNames(apptable);
|
.retrieveDatatableNames(appTable);
|
||||||
|
|
||||||
boolean prettyPrint = ApiParameterHelper.prettyPrint(uriInfo
|
boolean prettyPrint = ApiParameterHelper.prettyPrint(uriInfo
|
||||||
.getQueryParameters());
|
.getQueryParameters());
|
||||||
@@ -79,14 +79,14 @@ public class DataTableApiResource {
|
|||||||
}
|
}
|
||||||
|
|
||||||
@POST
|
@POST
|
||||||
@Path("register/{datatable}/{apptable}")
|
@Path("register/{datatable}/{appTable}")
|
||||||
@Consumes({ MediaType.APPLICATION_JSON })
|
@Consumes({ MediaType.APPLICATION_JSON })
|
||||||
@Produces({ MediaType.APPLICATION_JSON })
|
@Produces({ MediaType.APPLICATION_JSON })
|
||||||
public Response registerDatatable(
|
public Response registerDatatable(
|
||||||
@PathParam("datatable") final String datatable,
|
@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();
|
EntityIdentifier entityIdentifier = new EntityIdentifier();
|
||||||
return Response.ok().entity(entityIdentifier).build();
|
return Response.ok().entity(entityIdentifier).build();
|
||||||
@@ -106,11 +106,11 @@ public class DataTableApiResource {
|
|||||||
}
|
}
|
||||||
|
|
||||||
@GET
|
@GET
|
||||||
@Path("{datatable}/{apptableId}")
|
@Path("{datatable}/{appTableId}")
|
||||||
@Consumes({ MediaType.APPLICATION_JSON })
|
@Consumes({ MediaType.APPLICATION_JSON })
|
||||||
@Produces({ MediaType.APPLICATION_JSON })
|
@Produces({ MediaType.APPLICATION_JSON })
|
||||||
public String getDatatable(@PathParam("datatable") final String datatable,
|
public String getDatatable(@PathParam("datatable") final String datatable,
|
||||||
@PathParam("apptableId") final Long apptableId,
|
@PathParam("appTableId") final Long appTableId,
|
||||||
@QueryParam("sqlFields") final String sqlFields,
|
@QueryParam("sqlFields") final String sqlFields,
|
||||||
@QueryParam("sqlOrder") final String sqlOrder,
|
@QueryParam("sqlOrder") final String sqlOrder,
|
||||||
@Context final UriInfo uriInfo) {
|
@Context final UriInfo uriInfo) {
|
||||||
@@ -118,7 +118,7 @@ public class DataTableApiResource {
|
|||||||
checkUserPermissionForDatatable(datatable, "READ");
|
checkUserPermissionForDatatable(datatable, "READ");
|
||||||
|
|
||||||
GenericResultsetData results = this.readWriteNonCoreDataService
|
GenericResultsetData results = this.readWriteNonCoreDataService
|
||||||
.retrieveDataTableGenericResultSet(datatable, apptableId,
|
.retrieveDataTableGenericResultSet(datatable, appTableId,
|
||||||
sqlFields, sqlOrder, null);
|
sqlFields, sqlOrder, null);
|
||||||
|
|
||||||
String json = "";
|
String json = "";
|
||||||
@@ -134,34 +134,34 @@ public class DataTableApiResource {
|
|||||||
}
|
}
|
||||||
|
|
||||||
@POST
|
@POST
|
||||||
@Path("{datatable}/{apptableId}")
|
@Path("{datatable}/{appTableId}")
|
||||||
@Consumes({ MediaType.APPLICATION_JSON })
|
@Consumes({ MediaType.APPLICATION_JSON })
|
||||||
@Produces({ MediaType.APPLICATION_JSON })
|
@Produces({ MediaType.APPLICATION_JSON })
|
||||||
public Response newDatatableEntry(
|
public Response newDatatableEntry(
|
||||||
@PathParam("datatable") final String datatable,
|
@PathParam("datatable") final String datatable,
|
||||||
@PathParam("apptableId") final Long apptableId,
|
@PathParam("appTableId") final Long appTableId,
|
||||||
final String jsonRequestBody) {
|
final String jsonRequestBody) {
|
||||||
|
|
||||||
checkUserPermissionForDatatable(datatable, "CREATE");
|
checkUserPermissionForDatatable(datatable, "CREATE");
|
||||||
Map<String, String> queryParams = getQueryParamsFromJsonRequestBody(jsonRequestBody);
|
Map<String, String> queryParams = getQueryParamsFromJsonRequestBody(jsonRequestBody);
|
||||||
|
|
||||||
this.readWriteNonCoreDataService.newDatatableEntry(datatable,
|
this.readWriteNonCoreDataService.newDatatableEntry(datatable,
|
||||||
apptableId, queryParams);
|
appTableId, queryParams);
|
||||||
|
|
||||||
EntityIdentifier entityIdentifier = new EntityIdentifier(
|
EntityIdentifier entityIdentifier = new EntityIdentifier(
|
||||||
Long.valueOf(apptableId));
|
Long.valueOf(appTableId));
|
||||||
|
|
||||||
return Response.ok().entity(entityIdentifier).build();
|
return Response.ok().entity(entityIdentifier).build();
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@PUT
|
@PUT
|
||||||
@Path("{datatable}/{apptableId}")
|
@Path("{datatable}/{appTableId}")
|
||||||
@Consumes({ MediaType.APPLICATION_JSON })
|
@Consumes({ MediaType.APPLICATION_JSON })
|
||||||
@Produces({ MediaType.APPLICATION_JSON })
|
@Produces({ MediaType.APPLICATION_JSON })
|
||||||
public Response updateDatatableEntryOnetoOne(
|
public Response updateDatatableEntryOnetoOne(
|
||||||
@PathParam("datatable") final String datatable,
|
@PathParam("datatable") final String datatable,
|
||||||
@PathParam("apptableId") final Long apptableId,
|
@PathParam("appTableId") final Long appTableId,
|
||||||
final String jsonRequestBody) {
|
final String jsonRequestBody) {
|
||||||
/*
|
/*
|
||||||
* for updating one to one relationships (where foreign key is the
|
* for updating one to one relationships (where foreign key is the
|
||||||
@@ -171,22 +171,22 @@ public class DataTableApiResource {
|
|||||||
Map<String, String> queryParams = getQueryParamsFromJsonRequestBody(jsonRequestBody);
|
Map<String, String> queryParams = getQueryParamsFromJsonRequestBody(jsonRequestBody);
|
||||||
|
|
||||||
this.readWriteNonCoreDataService.updateDatatableEntryOnetoOne(
|
this.readWriteNonCoreDataService.updateDatatableEntryOnetoOne(
|
||||||
datatable, apptableId, queryParams);
|
datatable, appTableId, queryParams);
|
||||||
|
|
||||||
EntityIdentifier entityIdentifier = new EntityIdentifier(
|
EntityIdentifier entityIdentifier = new EntityIdentifier(
|
||||||
Long.valueOf(apptableId));
|
Long.valueOf(appTableId));
|
||||||
|
|
||||||
return Response.ok().entity(entityIdentifier).build();
|
return Response.ok().entity(entityIdentifier).build();
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@PUT
|
@PUT
|
||||||
@Path("{datatable}/{apptableId}/{datatableId}")
|
@Path("{datatable}/{appTableId}/{datatableId}")
|
||||||
@Consumes({ MediaType.APPLICATION_JSON })
|
@Consumes({ MediaType.APPLICATION_JSON })
|
||||||
@Produces({ MediaType.APPLICATION_JSON })
|
@Produces({ MediaType.APPLICATION_JSON })
|
||||||
public Response updateDatatableEntryOnetoOne(
|
public Response updateDatatableEntryOnetoOne(
|
||||||
@PathParam("datatable") final String datatable,
|
@PathParam("datatable") final String datatable,
|
||||||
@PathParam("apptableId") final Long apptableId,
|
@PathParam("appTableId") final Long appTableId,
|
||||||
@PathParam("datatableId") final Long datatableId,
|
@PathParam("datatableId") final Long datatableId,
|
||||||
final String jsonRequestBody) {
|
final String jsonRequestBody) {
|
||||||
/*
|
/*
|
||||||
@@ -197,51 +197,51 @@ public class DataTableApiResource {
|
|||||||
Map<String, String> queryParams = getQueryParamsFromJsonRequestBody(jsonRequestBody);
|
Map<String, String> queryParams = getQueryParamsFromJsonRequestBody(jsonRequestBody);
|
||||||
|
|
||||||
this.readWriteNonCoreDataService.updateDatatableEntryOnetoMany(
|
this.readWriteNonCoreDataService.updateDatatableEntryOnetoMany(
|
||||||
datatable, apptableId, datatableId, queryParams);
|
datatable, appTableId, datatableId, queryParams);
|
||||||
|
|
||||||
EntityIdentifier entityIdentifier = new EntityIdentifier(
|
EntityIdentifier entityIdentifier = new EntityIdentifier(
|
||||||
Long.valueOf(apptableId));
|
Long.valueOf(appTableId));
|
||||||
|
|
||||||
return Response.ok().entity(entityIdentifier).build();
|
return Response.ok().entity(entityIdentifier).build();
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@DELETE
|
@DELETE
|
||||||
@Path("{datatable}/{apptableId}")
|
@Path("{datatable}/{appTableId}")
|
||||||
@Consumes({ MediaType.APPLICATION_JSON })
|
@Consumes({ MediaType.APPLICATION_JSON })
|
||||||
@Produces({ MediaType.APPLICATION_JSON })
|
@Produces({ MediaType.APPLICATION_JSON })
|
||||||
public Response deleteDatatableEntries(
|
public Response deleteDatatableEntries(
|
||||||
@PathParam("datatable") final String datatable,
|
@PathParam("datatable") final String datatable,
|
||||||
@PathParam("apptableId") final Long apptableId) {
|
@PathParam("appTableId") final Long appTableId) {
|
||||||
|
|
||||||
checkUserPermissionForDatatable(datatable, "DELETE");
|
checkUserPermissionForDatatable(datatable, "DELETE");
|
||||||
|
|
||||||
this.readWriteNonCoreDataService.deleteDatatableEntries(datatable,
|
this.readWriteNonCoreDataService.deleteDatatableEntries(datatable,
|
||||||
apptableId);
|
appTableId);
|
||||||
|
|
||||||
EntityIdentifier entityIdentifier = new EntityIdentifier(
|
EntityIdentifier entityIdentifier = new EntityIdentifier(
|
||||||
Long.valueOf(apptableId));
|
Long.valueOf(appTableId));
|
||||||
|
|
||||||
return Response.ok().entity(entityIdentifier).build();
|
return Response.ok().entity(entityIdentifier).build();
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@DELETE
|
@DELETE
|
||||||
@Path("{datatable}/{apptableId}/{datatableId}")
|
@Path("{datatable}/{appTableId}/{datatableId}")
|
||||||
@Consumes({ MediaType.APPLICATION_JSON })
|
@Consumes({ MediaType.APPLICATION_JSON })
|
||||||
@Produces({ MediaType.APPLICATION_JSON })
|
@Produces({ MediaType.APPLICATION_JSON })
|
||||||
public Response deleteDatatableEntries(
|
public Response deleteDatatableEntries(
|
||||||
@PathParam("datatable") final String datatable,
|
@PathParam("datatable") final String datatable,
|
||||||
@PathParam("apptableId") final Long apptableId,
|
@PathParam("appTableId") final Long appTableId,
|
||||||
@PathParam("datatableId") final Long datatableId) {
|
@PathParam("datatableId") final Long datatableId) {
|
||||||
|
|
||||||
checkUserPermissionForDatatable(datatable, "DELETE");
|
checkUserPermissionForDatatable(datatable, "DELETE");
|
||||||
|
|
||||||
this.readWriteNonCoreDataService.deleteDatatableEntry(datatable,
|
this.readWriteNonCoreDataService.deleteDatatableEntry(datatable,
|
||||||
apptableId, datatableId);
|
appTableId, datatableId);
|
||||||
|
|
||||||
EntityIdentifier entityIdentifier = new EntityIdentifier(
|
EntityIdentifier entityIdentifier = new EntityIdentifier(
|
||||||
Long.valueOf(apptableId));
|
Long.valueOf(appTableId));
|
||||||
|
|
||||||
return Response.ok().entity(entityIdentifier).build();
|
return Response.ok().entity(entityIdentifier).build();
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user