data tables api docs and remove fiedls option from data tables api
This commit is contained in:
+212
-82
@@ -2417,12 +2417,12 @@ Request Body:
|
||||
|
||||
<h5>Arguments</h5>
|
||||
<dl class="argument-list">
|
||||
<dt>appTable</dt>
|
||||
<dt>apptable</dt>
|
||||
<dd><span>optional</span></dd>
|
||||
<dd>The Mifos X core application table.</dd>
|
||||
</dl>
|
||||
<p>Example Requests: </p>
|
||||
<div class=apiClick>datatables?appTable=m_client</div>
|
||||
<div class=apiClick>datatables?apptable=m_client</div>
|
||||
<br><br>
|
||||
<div class=apiClick>datatables</div>
|
||||
</div>
|
||||
@@ -2451,112 +2451,242 @@ Request Body:
|
||||
<div class="method-description">
|
||||
<h4>Register Data Table</h4>
|
||||
<p>
|
||||
Registers a data table with the Mifos X Core application table.
|
||||
Registers a data table with the Mifos X Core application table. This allows the data table to be maintained through the API.
|
||||
</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
|
||||
<code class="method-declaration">POST https://Domain Name/api/v1/datatables/register/{datatable}/{apptable}</code>
|
||||
<code class="method-request">POST datatables/register/New Table/m_client
|
||||
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
|
||||
"entityId": null
|
||||
}
|
||||
</code>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
|
||||
<a id="additionalfields_retrieve" name="additionalfields_retrieve" class="old-syle-anchor"> </a>
|
||||
<a id="datatables_deregister" name="datatables_deregister" class="old-syle-anchor"> </a>
|
||||
<div class="method-section">
|
||||
<div class="method-description">
|
||||
<h4>Retrieve Additional Fields</h4>
|
||||
<p>
|
||||
Returns 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. The output is a JSON formatted "Generic Resultset". The Generic Resultset contains Column Heading as well as Data information. The Column Heading information may include allowed values (columnValues array).
|
||||
</p>
|
||||
<p>Example Request:
|
||||
<div class=apiClick>additionalfields/m_client/Additional Information/2</div>
|
||||
</p>
|
||||
<h4>Deregister Data Table</h4>
|
||||
<p>
|
||||
Deregisters a data table. It will no longer be available through the API.
|
||||
</p>
|
||||
</div>
|
||||
<div class="method-example">
|
||||
<code class="method-declaration">GET https://Domain Name/api/v1/additionalfields/{type}/{set}/{id}</code>
|
||||
<code class="method-declaration">POST https://Domain Name/api/v1/datatables/deregister/{datatable}</code>
|
||||
<code class="method-request">POST datatables/register/New Table
|
||||
Content-Type: application/json
|
||||
Request Body:
|
||||
{
|
||||
}
|
||||
</code>
|
||||
<code class="method-response">{
|
||||
"columnHeaders" : [ {
|
||||
"columnName" : "Ethnic Group",
|
||||
"columnType" : "String",
|
||||
"columnLength" : 50,
|
||||
"columnDisplayType" : "List",
|
||||
"columnValues" : [ "Bedouin", "Berber", "Italian", "Miknasa", "Mrazig", "Other", "Unknown" ]
|
||||
}, {
|
||||
"columnName" : "Ethnic Group Other",
|
||||
"columnType" : "String",
|
||||
"columnLength" : 50,
|
||||
"columnDisplayType" : null,
|
||||
"columnValues" : [ ]
|
||||
}, {
|
||||
"columnName" : "Household Location",
|
||||
"columnType" : "String",
|
||||
"columnLength" : 50,
|
||||
"columnDisplayType" : "List",
|
||||
"columnValues" : [ "East Sikkim", "North Sikkim", "South Sikkim", "West Sikkim", "Other" ]
|
||||
}, {
|
||||
"columnName" : "Household Location Other",
|
||||
"columnType" : "String",
|
||||
"columnLength" : 50,
|
||||
"columnDisplayType" : null,
|
||||
"columnValues" : [ ]
|
||||
}, {
|
||||
"columnName" : "Religion",
|
||||
"columnType" : "String",
|
||||
"columnLength" : 50,
|
||||
"columnDisplayType" : "List",
|
||||
"columnValues" : [ "Protestant", "Catholic", "Muslim", "Animist", "Atheist", "Other", "Unknown" ]
|
||||
}, {
|
||||
"columnName" : "Religion Other",
|
||||
"columnType" : "String",
|
||||
"columnLength" : 50,
|
||||
"columnDisplayType" : null,
|
||||
"columnValues" : [ ]
|
||||
}, {
|
||||
"columnName" : "Knowledge of Person",
|
||||
"columnType" : "String",
|
||||
"columnLength" : 50,
|
||||
"columnDisplayType" : "List",
|
||||
"columnValues" : [ "Staff member", "Spouse of staff member", "Son/daughter of staff member", "Friend of staff member", "Not known by any staff member", "Other" ]
|
||||
}, {
|
||||
"columnName" : "Gender",
|
||||
"columnType" : "String",
|
||||
"columnLength" : 10,
|
||||
"columnDisplayType" : "List",
|
||||
"columnValues" : [ "Female", "Male" ]
|
||||
}, {
|
||||
"columnName" : "Whois",
|
||||
"columnType" : "Text",
|
||||
"columnLength" : null,
|
||||
"columnDisplayType" : null,
|
||||
"columnValues" : [ ]
|
||||
} ],
|
||||
"data" : [ {
|
||||
"row" : [ "Bedouin", null, "East Sikkim", null, "Animist", "Agnostic", "Friend of staff member", "Female", "A person of honesty & clear thought" ]
|
||||
} ]
|
||||
"entityId": null
|
||||
}
|
||||
</code>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
|
||||
<a id="datatables_create" name="datatables_create" class="old-syle-anchor"> </a>
|
||||
<div class="method-section">
|
||||
<div class="method-description">
|
||||
<h4>Create Entry in Data Table</h4>
|
||||
<p>
|
||||
Adds a row to the data table.
|
||||
</p>
|
||||
<p>
|
||||
Note that the default datatable UI functionality converts any field name containing spaces to underscores when using the API.
|
||||
This means the field name "Business Description" is considered the same as "Business_Description".
|
||||
So you shouldn't have both "versions" in any data table.
|
||||
</p>
|
||||
</div>
|
||||
<div class="method-example">
|
||||
<code class="method-declaration">POST https://Domain Name/api/v1/datatables/{datatable}/{apptableId}</code>
|
||||
<code class="method-request">POST datatables/Additional Client Fields Data/1
|
||||
Content-Type: application/json
|
||||
Request Body:
|
||||
{
|
||||
"Business Description": "Livestock sales",
|
||||
Comment: "First comment\nmade",
|
||||
Education_cv: "Trade",
|
||||
Gender_cd: "21",
|
||||
"Highest Rate Paid": "8.5",
|
||||
"Next Visit": "01 October 2012",
|
||||
"Years in Business": "5",
|
||||
dateFormat: "dd MMMM yyyy",
|
||||
locale: "en"
|
||||
}
|
||||
</code>
|
||||
<code class="method-response">{
|
||||
"entityId": 1
|
||||
}
|
||||
</code>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<a id="datatables_retrieve" name="datatables_retrieve" class="old-syle-anchor"> </a>
|
||||
<div class="method-section">
|
||||
<div class="method-description">
|
||||
<h4>Retrieve Entry(s) from Data Table</h4>
|
||||
<p>
|
||||
Gets the entry (if it exists) for data tables that are one to one with the application table. <br>
|
||||
Gets the entries (if they exist) for data tables that are one to many with the application table.
|
||||
</p>
|
||||
<p>Note: The 'fields' parameter is not available for datatables.</p>
|
||||
|
||||
<h5>Arguments</h5>
|
||||
<dl class="argument-list">
|
||||
<dt>order</dt>
|
||||
<dd><span>optional</span></dd>
|
||||
<dd>Specifies the order in which data is returned.</dd>
|
||||
<dt>genericResultSet</dt>
|
||||
<dd><span>optional</span></dd>
|
||||
<dd>If 'true' a Generic Result Set JSON format is returned.
|
||||
This format is used by the default data tables UI functionality.</dd>
|
||||
</dl>
|
||||
|
||||
<p>Example Requests: </p>
|
||||
<div class=apiClick>datatables/Additional Client Fields Data/1</div>
|
||||
<br><br>
|
||||
<div class=apiClick>datatables/Extra Family Details Data/1?order=`Date of Birth` desc</div>
|
||||
<br><br>
|
||||
<div class=apiClick>datatables/Additional Client Fields Data/1?genericResultSet=true</div>
|
||||
</div>
|
||||
<div class="method-example">
|
||||
<code class="method-declaration">GET https://Domain Name/api/v1/datatables/{datatable}/{apptableId}</code>
|
||||
<code class="method-response">[
|
||||
{"client_id": 1,
|
||||
"Business Description": "Livestock sales",
|
||||
"Years in Business": 5,
|
||||
"Gender_cd": "21",
|
||||
"Education_cv": "Trade",
|
||||
"Next Visit": [2012, 10, 1],
|
||||
"Highest Rate Paid": 8.500000,
|
||||
"Comment": "First comment
|
||||
made"}
|
||||
]
|
||||
</code>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
|
||||
<a id="datatables_update" name="datatables_update" class="old-syle-anchor"> </a>
|
||||
<div class="method-section">
|
||||
<div class="method-description">
|
||||
<h4>Update Entry in Data Table (One to One)</h4>
|
||||
<p>
|
||||
Updates the row (if it exists) of the data table.
|
||||
</p>
|
||||
</div>
|
||||
<div class="method-example">
|
||||
<code class="method-declaration">PUT https://Domain Name/api/v1/datatables/{datatable}/{apptableId}</code>
|
||||
<code class="method-request">PUT datatables/Additional Client Fields Data/1
|
||||
Content-Type: application/json
|
||||
Request Body:
|
||||
{
|
||||
"Business Description": "Livestock sales updated",
|
||||
Comment: "First comment\nmade",
|
||||
Education_cv: "Trade",
|
||||
Gender_cd: "21",
|
||||
"Highest Rate Paid": "8.5",
|
||||
"Next Visit": "01 October 2012",
|
||||
"Years in Business": "5",
|
||||
dateFormat: "dd MMMM yyyy",
|
||||
locale: "en"
|
||||
}
|
||||
</code>
|
||||
<code class="method-response">{
|
||||
"entityId": 1
|
||||
}
|
||||
</code>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<a id="datatables_update_1M" name="datatables_update_1M" class="old-syle-anchor"> </a>
|
||||
<div class="method-section">
|
||||
<div class="method-description">
|
||||
<h4>Update Entry in Data Table (One to Many)</h4>
|
||||
<p>
|
||||
Updates the row (if it exists) of the data table.
|
||||
</p>
|
||||
</div>
|
||||
<div class="method-example">
|
||||
<code class="method-declaration">PUT https://Domain Name/api/v1/datatables/{datatable}/{apptableId}/{datatableId}</code>
|
||||
<code class="method-request">PUT datatables/Extra Family Details Data/1/2
|
||||
Content-Type: application/json
|
||||
Request Body:
|
||||
{
|
||||
"Date of Birth": "01 June 1982",
|
||||
Education_cdHighest: "5",
|
||||
Name: "June",
|
||||
"Other Notes": "More\nnotes",
|
||||
"Points Score": "20",
|
||||
dateFormat: "dd MMMM yyyy",
|
||||
locale: "en"
|
||||
}
|
||||
</code>
|
||||
<code class="method-response">{
|
||||
"entityId": 1
|
||||
}
|
||||
</code>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<a id="datatables_delete" name="datatables_delete" class="old-syle-anchor"> </a>
|
||||
<div class="method-section">
|
||||
<div class="method-description">
|
||||
<h4>Delete Entry(s) in Data Table</h4>
|
||||
<p>
|
||||
Deletes the entry (if it exists) for data tables that are one to one with the application table. <br>
|
||||
Deletes the entries (if they exist) for data tables that are one to many with the application table.
|
||||
</p>
|
||||
</div>
|
||||
<div class="method-example">
|
||||
<code class="method-declaration">DELETE https://Domain Name/api/v1/datatables/{datatable}/{apptableId}</code>
|
||||
<code class="method-request">DELETE datatables/Additional Client Fields Data/1
|
||||
Content-Type: application/json
|
||||
Request Body:
|
||||
{
|
||||
}
|
||||
</code>
|
||||
<code class="method-response">{
|
||||
"entityId": 1
|
||||
}
|
||||
</code>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<a id="datatables_delete_1M" name="datatables_delete_1M" class="old-syle-anchor"> </a>
|
||||
<div class="method-section">
|
||||
<div class="method-description">
|
||||
<h4>Delete Entry in Data Table (One to Many)</h4>
|
||||
<p>
|
||||
Deletes the entry (if it exists) for data tables that are one to many with the application table.
|
||||
</p>
|
||||
</div>
|
||||
<div class="method-example">
|
||||
<code class="method-declaration">DELETE https://Domain Name/api/v1/datatables/{datatable}/{apptableId}/{datatableId}</code>
|
||||
<code class="method-request">DELETE datatables/Extra Family Details Data/1/2
|
||||
Content-Type: application/json
|
||||
Request Body:
|
||||
{
|
||||
}
|
||||
</code>
|
||||
<code class="method-response">{
|
||||
"entityId": 1
|
||||
}
|
||||
</code>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
|
||||
<!-- start of reports api docs -->
|
||||
<a id="reports" name="reports" class="old-syle-anchor"> </a>
|
||||
<div class="method-section">
|
||||
|
||||
@@ -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,20 +106,19 @@ 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,
|
||||
@QueryParam("sqlFields") final String sqlFields,
|
||||
@QueryParam("sqlOrder") final String sqlOrder,
|
||||
@PathParam("apptableId") final Long apptableId,
|
||||
@QueryParam("order") final String order,
|
||||
@Context final UriInfo uriInfo) {
|
||||
|
||||
checkUserPermissionForDatatable(datatable, "READ");
|
||||
|
||||
GenericResultsetData results = this.readWriteNonCoreDataService
|
||||
.retrieveDataTableGenericResultSet(datatable, appTableId,
|
||||
sqlFields, sqlOrder, null);
|
||||
.retrieveDataTableGenericResultSet(datatable, apptableId,
|
||||
order, null);
|
||||
|
||||
String json = "";
|
||||
final boolean genericResultSet = ApiParameterHelper.genericResultSet(uriInfo.getQueryParameters());
|
||||
@@ -134,34 +133,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 +170,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 +196,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();
|
||||
|
||||
|
||||
+1
-1
@@ -18,7 +18,7 @@ public interface ReadWriteNonCoreDataService {
|
||||
void deregisterDatatable(String datatable);
|
||||
|
||||
GenericResultsetData retrieveDataTableGenericResultSet(String datatable,
|
||||
Long appTableId, String sqlFields, String sqlOrder, Long id);
|
||||
Long appTableId, String order, Long id);
|
||||
|
||||
void newDatatableEntry(String datatable, Long appTableId,
|
||||
Map<String, String> queryParams);
|
||||
|
||||
+12
-15
@@ -203,7 +203,7 @@ public class ReadWriteNonCoreDataServiceImpl implements
|
||||
long startTime = System.currentTimeMillis();
|
||||
|
||||
GenericResultsetData grs = retrieveDataTableGenericResultSet(datatable,
|
||||
appTableId, null, null, null);
|
||||
appTableId, null, null);
|
||||
|
||||
if (grs.getData().size() == 0)
|
||||
throw new DataTableNotFoundException(datatable, appTableId);
|
||||
@@ -240,7 +240,7 @@ public class ReadWriteNonCoreDataServiceImpl implements
|
||||
long startTime = System.currentTimeMillis();
|
||||
|
||||
GenericResultsetData grs = retrieveDataTableGenericResultSet(datatable,
|
||||
appTableId, null, null, datatableId);
|
||||
appTableId, null, datatableId);
|
||||
|
||||
if (grs.getData().size() == 0)
|
||||
throw new DataTableNotFoundException(datatable, appTableId);
|
||||
@@ -302,8 +302,7 @@ public class ReadWriteNonCoreDataServiceImpl implements
|
||||
|
||||
@Override
|
||||
public GenericResultsetData retrieveDataTableGenericResultSet(
|
||||
String datatable, Long appTableId, String sqlFields,
|
||||
String sqlOrder, Long id) {
|
||||
String datatable, Long appTableId, String order, Long id) {
|
||||
|
||||
long startTime = System.currentTimeMillis();
|
||||
|
||||
@@ -312,23 +311,19 @@ public class ReadWriteNonCoreDataServiceImpl implements
|
||||
|
||||
List<ResultsetColumnHeader> columnHeaders = getDatatableResultsetColumnHeaders(datatable);
|
||||
|
||||
String sql = "select ";
|
||||
if (sqlFields != null)
|
||||
sql = sql + sqlFields;
|
||||
else
|
||||
sql = sql + " * ";
|
||||
String sql = "";
|
||||
|
||||
// id only used for reading a specific entry in a one to many datatable
|
||||
// (when updating)
|
||||
if (id == null) {
|
||||
sql = sql + " from `" + datatable + "` where "
|
||||
sql = sql + "select * from `" + datatable + "` where "
|
||||
+ getFKField(appTable) + " = " + appTableId;
|
||||
} else {
|
||||
sql = sql + " from `" + datatable + "` where id = " + id;
|
||||
sql = sql + "select * from `" + datatable + "` where id = " + id;
|
||||
}
|
||||
|
||||
if (sqlOrder != null)
|
||||
sql = sql + " order by " + sqlOrder;
|
||||
if (order != null)
|
||||
sql = sql + " order by " + order;
|
||||
|
||||
List<ResultsetDataRow> result = fillDatatableResultSetDataRows(sql);
|
||||
|
||||
@@ -806,7 +801,8 @@ public class ReadWriteNonCoreDataServiceImpl implements
|
||||
List<ApiParameterError> dataValidationErrors = new ArrayList<ApiParameterError>();
|
||||
ApiParameterError error = ApiParameterError.parameterError(
|
||||
"error.msg.invalid.columnValue",
|
||||
"Value not found in Allowed Value list", columnHeader.getColumnName(), paramValue);
|
||||
"Value not found in Allowed Value list",
|
||||
columnHeader.getColumnName(), paramValue);
|
||||
dataValidationErrors.add(error);
|
||||
throw new PlatformApiDataValidationException(
|
||||
"validation.msg.validation.errors.exist",
|
||||
@@ -822,7 +818,8 @@ public class ReadWriteNonCoreDataServiceImpl implements
|
||||
List<ApiParameterError> dataValidationErrors = new ArrayList<ApiParameterError>();
|
||||
ApiParameterError error = ApiParameterError.parameterError(
|
||||
"error.msg.invalid.columnValue",
|
||||
"Value not found in Allowed Value list", columnHeader.getColumnName(), paramValue);
|
||||
"Value not found in Allowed Value list",
|
||||
columnHeader.getColumnName(), paramValue);
|
||||
dataValidationErrors.add(error);
|
||||
throw new PlatformApiDataValidationException(
|
||||
"validation.msg.validation.errors.exist",
|
||||
|
||||
Reference in New Issue
Block a user