remove usage lookup data objects, formating of report java code, update api docs for center, groups.
This commit is contained in:
+91
-3
@@ -299,6 +299,14 @@
|
||||
<td><a href="#centers_delete">Delete a Center</a></td>
|
||||
</tr>
|
||||
<tr class="alt">
|
||||
<td></td>
|
||||
<td>centers/{centerId}?command=activate</td>
|
||||
<td><a href="#centers_activate">Activate a Center</a></td>
|
||||
<td></td>
|
||||
<td></td>
|
||||
<td></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td><a href="#groups">Group</a></td>
|
||||
<td>groups</td>
|
||||
<td><a href="#groups_create">Create a Group</a></td>
|
||||
@@ -306,7 +314,7 @@
|
||||
<td></td>
|
||||
<td></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<tr class="alt">
|
||||
<td></td>
|
||||
<td>groups/{group}</td>
|
||||
<td></td>
|
||||
@@ -314,6 +322,14 @@
|
||||
<td><a href="#groups_update">Update a Group</a></td>
|
||||
<td><a href="#groups_delete">Delete a Group</a></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td></td>
|
||||
<td>groups/{groupId}?command=activate</td>
|
||||
<td><a href="#groups_activate">Activate a Group</a></td>
|
||||
<td></td>
|
||||
<td></td>
|
||||
<td></td>
|
||||
</tr>
|
||||
</table>
|
||||
</div>
|
||||
</div>
|
||||
@@ -1901,7 +1917,7 @@ Request Body:
|
||||
<div class="method-section">
|
||||
<div class="method-description">
|
||||
<h2>Activate a Client</h2>
|
||||
<p>Clients can be created in a <i>Pending</i> state if configuration is enabled. This API exists to enable client activation (for when a client becomes approved member of microfinance institue.</p>
|
||||
<p>Clients can be created in a <i>Pending</i> state. This API exists to enable client activation (for when a client becomes approved member of microfinance institue).</p>
|
||||
<p>If the client happens to be alrady active this API will result in an error.</p>
|
||||
</div>
|
||||
<div class="method-example">
|
||||
@@ -2926,6 +2942,34 @@ Content-Type: application/json Request Body:
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<a id="centers_activate" name="centers_activate" class="old-syle-anchor"> </a>
|
||||
<div class="method-section">
|
||||
<div class="method-description">
|
||||
<h2>Activate a Center</h2>
|
||||
<p>Centers can be created in a <i>Pending</i> state. This API exists to enable center activation.</p>
|
||||
<p>If the center happens to be already active this API will result in an error.</p>
|
||||
</div>
|
||||
<div class="method-example">
|
||||
<code class="method-declaration">POST https://Domain Name/api/v1/centers/{centerId}?command=activate</code>
|
||||
<code class="method-request">POST centers/1?command=activate
|
||||
Content-Type: application/json
|
||||
Request Body:
|
||||
{
|
||||
"locale": "en",
|
||||
"dateFormat": "dd MMMM yyyy",
|
||||
"activationDate": "01 March 2011"
|
||||
}
|
||||
</code>
|
||||
<code class="method-response">
|
||||
{
|
||||
"officeId": 1,
|
||||
"groupId": 1,
|
||||
"resourceId": 1
|
||||
}
|
||||
</code>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<a id="centers_update" name="centers_update" class="old-syle-anchor"> </a>
|
||||
<div class="method-section">
|
||||
<div class="method-description">
|
||||
@@ -3322,6 +3366,34 @@ Content-Type: application/json Request Body:
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<a id="groups_activate" name="groups_activate" class="old-syle-anchor"> </a>
|
||||
<div class="method-section">
|
||||
<div class="method-description">
|
||||
<h2>Activate a Group</h2>
|
||||
<p>Groups can be created in a <i>Pending</i> state. This API exists to enable group activation.</p>
|
||||
<p>If the group happens to be already active this API will result in an error.</p>
|
||||
</div>
|
||||
<div class="method-example">
|
||||
<code class="method-declaration">POST https://Domain Name/api/v1/groups/{groupId}?command=activate</code>
|
||||
<code class="method-request">POST groups/1?command=activate
|
||||
Content-Type: application/json
|
||||
Request Body:
|
||||
{
|
||||
"locale": "en",
|
||||
"dateFormat": "dd MMMM yyyy",
|
||||
"activationDate": "01 March 2011"
|
||||
}
|
||||
</code>
|
||||
<code class="method-response">
|
||||
{
|
||||
"officeId": 1,
|
||||
"groupId": 1,
|
||||
"resourceId": 1
|
||||
}
|
||||
</code>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<a id="groups_retrieve" name="groups_retrieve" class="old-syle-anchor"> </a>
|
||||
<div class="method-section">
|
||||
<div class="method-description">
|
||||
@@ -13163,6 +13235,14 @@ GET https://DomainName/api/v1/search?query=000000111
|
||||
<td><a href="#centers_delete">Delete a Center</a></td>
|
||||
</tr>
|
||||
<tr class="alt">
|
||||
<td></td>
|
||||
<td>centers/{centerId}?command=activate</td>
|
||||
<td><a href="#centers_activate">Activate a Center</a></td>
|
||||
<td></td>
|
||||
<td></td>
|
||||
<td></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td><a href="#groups">Group</a></td>
|
||||
<td>groups</td>
|
||||
<td><a href="#groups_create">Create a Group</a></td>
|
||||
@@ -13170,7 +13250,7 @@ GET https://DomainName/api/v1/search?query=000000111
|
||||
<td></td>
|
||||
<td></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<tr class="alt">
|
||||
<td></td>
|
||||
<td>groups/{group}</td>
|
||||
<td></td>
|
||||
@@ -13178,6 +13258,14 @@ GET https://DomainName/api/v1/search?query=000000111
|
||||
<td><a href="#groups_update">Update a Group</a></td>
|
||||
<td><a href="#groups_delete">Delete a Group</a></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td></td>
|
||||
<td>groups/{groupId}?command=activate</td>
|
||||
<td><a href="#groups_activate">Activate a Group</a></td>
|
||||
<td></td>
|
||||
<td></td>
|
||||
<td></td>
|
||||
</tr>
|
||||
<!-- end of centers, groups api -->
|
||||
<!-- loans api full matrix-->
|
||||
<tr class="alt">
|
||||
|
||||
+1
-3
@@ -5,7 +5,6 @@
|
||||
*/
|
||||
package org.mifosplatform.accounting.closure.api;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.Arrays;
|
||||
import java.util.HashSet;
|
||||
import java.util.List;
|
||||
@@ -34,7 +33,6 @@ import org.mifosplatform.infrastructure.core.data.CommandProcessingResult;
|
||||
import org.mifosplatform.infrastructure.core.serialization.ApiRequestJsonSerializationSettings;
|
||||
import org.mifosplatform.infrastructure.core.serialization.DefaultToApiJsonSerializer;
|
||||
import org.mifosplatform.infrastructure.security.service.PlatformSecurityContext;
|
||||
import org.mifosplatform.organisation.office.data.OfficeLookup;
|
||||
import org.mifosplatform.organisation.office.service.OfficeReadPlatformService;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.context.annotation.Scope;
|
||||
@@ -95,7 +93,7 @@ public class GLClosuresApiResource {
|
||||
|
||||
final GLClosureData glClosureData = this.glClosureReadPlatformService.retrieveGLClosureById(glClosureId);
|
||||
if (settings.isTemplate()) {
|
||||
glClosureData.setAllowedOffices(new ArrayList<OfficeLookup>(this.officeReadPlatformService.retrieveAllOfficesForLookup()));
|
||||
glClosureData.setAllowedOffices(this.officeReadPlatformService.retrieveAllOfficesForDropdown());
|
||||
}
|
||||
|
||||
return this.apiJsonSerializerService.serialize(settings, glClosureData, RESPONSE_DATA_PARAMETERS);
|
||||
|
||||
+5
-5
@@ -6,10 +6,10 @@
|
||||
package org.mifosplatform.accounting.closure.data;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
import java.util.Collection;
|
||||
|
||||
import org.joda.time.LocalDate;
|
||||
import org.mifosplatform.organisation.office.data.OfficeLookup;
|
||||
import org.mifosplatform.organisation.office.data.OfficeData;
|
||||
|
||||
/**
|
||||
* Immutable object representing a General Ledger Account
|
||||
@@ -44,7 +44,7 @@ public class GLClosureData {
|
||||
@SuppressWarnings("unused")
|
||||
private final String comments;
|
||||
|
||||
private List<OfficeLookup> allowedOffices = new ArrayList<OfficeLookup>();
|
||||
private Collection<OfficeData> allowedOffices = new ArrayList<OfficeData>();
|
||||
|
||||
public GLClosureData(final Long id, final Long officeId, final String officeName, final LocalDate closingDate, final boolean deleted,
|
||||
final LocalDate createdDate, final LocalDate lastUpdatedDate, final Long createdByUserId, final String createdByUsername,
|
||||
@@ -64,11 +64,11 @@ public class GLClosureData {
|
||||
this.allowedOffices = null;
|
||||
}
|
||||
|
||||
public List<OfficeLookup> getAllowedOffices() {
|
||||
public final Collection<OfficeData> getAllowedOffices() {
|
||||
return this.allowedOffices;
|
||||
}
|
||||
|
||||
public void setAllowedOffices(final List<OfficeLookup> allowedOffices) {
|
||||
public void setAllowedOffices(final Collection<OfficeData> allowedOffices) {
|
||||
this.allowedOffices = allowedOffices;
|
||||
}
|
||||
|
||||
|
||||
@@ -1,44 +0,0 @@
|
||||
/**
|
||||
* This Source Code Form is subject to the terms of the Mozilla Public
|
||||
* License, v. 2.0. If a copy of the MPL was not distributed with this file,
|
||||
* You can obtain one at http://mozilla.org/MPL/2.0/.
|
||||
*/
|
||||
package org.mifosplatform.commands.data;
|
||||
|
||||
import org.joda.time.LocalDate;
|
||||
|
||||
/**
|
||||
* Immutable data object representing maker-checker entry
|
||||
*/
|
||||
@Deprecated
|
||||
final public class CommandSourceData {
|
||||
|
||||
@SuppressWarnings("unused")
|
||||
private final Long id;
|
||||
@SuppressWarnings("unused")
|
||||
private final String actionName;
|
||||
@SuppressWarnings("unused")
|
||||
private final String entityName;
|
||||
@SuppressWarnings("unused")
|
||||
private final Long entityId;
|
||||
@SuppressWarnings("unused")
|
||||
private final String entityHref;
|
||||
private final String commandJson;
|
||||
@SuppressWarnings("unused")
|
||||
private final LocalDate madeOnDate;
|
||||
|
||||
public CommandSourceData(final Long id, final String actionName, final String entityName, final Long entityId, final String entityHref,
|
||||
final String commandJson, final LocalDate madeOnDate) {
|
||||
this.id = id;
|
||||
this.actionName = actionName;
|
||||
this.entityName = entityName;
|
||||
this.entityId = entityId;
|
||||
this.entityHref = entityHref;
|
||||
this.commandJson = commandJson;
|
||||
this.madeOnDate = madeOnDate;
|
||||
}
|
||||
|
||||
public String json() {
|
||||
return this.commandJson;
|
||||
}
|
||||
}
|
||||
-1
@@ -7,7 +7,6 @@ package org.mifosplatform.infrastructure.dataqueries.data;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
|
||||
/**
|
||||
* Immutable data object for generic resultset data.
|
||||
*/
|
||||
|
||||
+65
-68
@@ -11,79 +11,76 @@ import java.util.List;
|
||||
|
||||
final public class ReportData {
|
||||
|
||||
@SuppressWarnings("unused")
|
||||
private final Long id;
|
||||
@SuppressWarnings("unused")
|
||||
private final String reportName;
|
||||
@SuppressWarnings("unused")
|
||||
private final String reportType;
|
||||
@SuppressWarnings("unused")
|
||||
private final String reportSubType;
|
||||
@SuppressWarnings("unused")
|
||||
private final String reportCategory;
|
||||
@SuppressWarnings("unused")
|
||||
private final String description;
|
||||
@SuppressWarnings("unused")
|
||||
private final String reportSql;
|
||||
@SuppressWarnings("unused")
|
||||
private final Boolean coreReport;
|
||||
@SuppressWarnings("unused")
|
||||
private final Boolean useReport;
|
||||
@SuppressWarnings("unused")
|
||||
private final Collection<ReportParameterData> reportParameters;
|
||||
@SuppressWarnings("unused")
|
||||
private final Long id;
|
||||
@SuppressWarnings("unused")
|
||||
private final String reportName;
|
||||
@SuppressWarnings("unused")
|
||||
private final String reportType;
|
||||
@SuppressWarnings("unused")
|
||||
private final String reportSubType;
|
||||
@SuppressWarnings("unused")
|
||||
private final String reportCategory;
|
||||
@SuppressWarnings("unused")
|
||||
private final String description;
|
||||
@SuppressWarnings("unused")
|
||||
private final String reportSql;
|
||||
@SuppressWarnings("unused")
|
||||
private final Boolean coreReport;
|
||||
@SuppressWarnings("unused")
|
||||
private final Boolean useReport;
|
||||
@SuppressWarnings("unused")
|
||||
private final Collection<ReportParameterData> reportParameters;
|
||||
|
||||
@SuppressWarnings("unused")
|
||||
private List<String> allowedReportTypes;
|
||||
@SuppressWarnings("unused")
|
||||
private List<String> allowedReportSubTypes;
|
||||
@SuppressWarnings("unused")
|
||||
private List<String> allowedReportTypes;
|
||||
@SuppressWarnings("unused")
|
||||
private List<String> allowedReportSubTypes;
|
||||
|
||||
public ReportData(final Long id, final String reportName,
|
||||
final String reportType, final String reportSubType,
|
||||
final String reportCategory, final String description,
|
||||
final String reportSql, final Boolean coreReport,
|
||||
final Boolean useReport,
|
||||
final Collection<ReportParameterData> reportParameters) {
|
||||
this.id = id;
|
||||
this.reportName = reportName;
|
||||
this.reportType = reportType;
|
||||
this.reportSubType = reportSubType;
|
||||
this.reportCategory = reportCategory;
|
||||
this.description = description;
|
||||
this.reportParameters = reportParameters;
|
||||
this.reportSql = reportSql;
|
||||
this.coreReport = coreReport;
|
||||
this.useReport = useReport;
|
||||
this.allowedReportTypes = null;
|
||||
this.allowedReportSubTypes = null;
|
||||
}
|
||||
public ReportData(final Long id, final String reportName, final String reportType, final String reportSubType,
|
||||
final String reportCategory, final String description, final String reportSql, final Boolean coreReport,
|
||||
final Boolean useReport, final Collection<ReportParameterData> reportParameters) {
|
||||
this.id = id;
|
||||
this.reportName = reportName;
|
||||
this.reportType = reportType;
|
||||
this.reportSubType = reportSubType;
|
||||
this.reportCategory = reportCategory;
|
||||
this.description = description;
|
||||
this.reportParameters = reportParameters;
|
||||
this.reportSql = reportSql;
|
||||
this.coreReport = coreReport;
|
||||
this.useReport = useReport;
|
||||
this.allowedReportTypes = null;
|
||||
this.allowedReportSubTypes = null;
|
||||
}
|
||||
|
||||
public ReportData() {
|
||||
this.id = null;
|
||||
this.reportName = null;
|
||||
this.reportType = null;
|
||||
this.reportSubType = null;
|
||||
this.reportCategory = null;
|
||||
this.description = null;
|
||||
this.reportParameters = null;
|
||||
this.reportSql = null;
|
||||
this.coreReport = null;
|
||||
this.useReport = null;
|
||||
this.allowedReportTypes = null;
|
||||
this.allowedReportSubTypes = null;
|
||||
}
|
||||
public ReportData() {
|
||||
this.id = null;
|
||||
this.reportName = null;
|
||||
this.reportType = null;
|
||||
this.reportSubType = null;
|
||||
this.reportCategory = null;
|
||||
this.description = null;
|
||||
this.reportParameters = null;
|
||||
this.reportSql = null;
|
||||
this.coreReport = null;
|
||||
this.useReport = null;
|
||||
this.allowedReportTypes = null;
|
||||
this.allowedReportSubTypes = null;
|
||||
}
|
||||
|
||||
public void appendedTemplate() {
|
||||
public void appendedTemplate() {
|
||||
|
||||
List<String> reportTypes = new ArrayList<String>();
|
||||
reportTypes.add("Table");
|
||||
reportTypes.add("Pentaho");
|
||||
reportTypes.add("Chart");
|
||||
this.allowedReportTypes = reportTypes;
|
||||
List<String> reportTypes = new ArrayList<String>();
|
||||
reportTypes.add("Table");
|
||||
reportTypes.add("Pentaho");
|
||||
reportTypes.add("Chart");
|
||||
this.allowedReportTypes = reportTypes;
|
||||
|
||||
List<String> reportSubTypes = new ArrayList<String>();
|
||||
reportSubTypes.add("Bar");
|
||||
reportSubTypes.add("Pie");
|
||||
this.allowedReportSubTypes = reportSubTypes;
|
||||
}
|
||||
List<String> reportSubTypes = new ArrayList<String>();
|
||||
reportSubTypes.add("Bar");
|
||||
reportSubTypes.add("Pie");
|
||||
this.allowedReportSubTypes = reportSubTypes;
|
||||
}
|
||||
|
||||
}
|
||||
+11
-13
@@ -7,18 +7,16 @@ package org.mifosplatform.infrastructure.dataqueries.data;
|
||||
|
||||
final public class ReportParameterData {
|
||||
|
||||
@SuppressWarnings("unused")
|
||||
private final Long id;
|
||||
@SuppressWarnings("unused")
|
||||
private final String reportParameterName;
|
||||
@SuppressWarnings("unused")
|
||||
private final String parameterName;
|
||||
|
||||
public ReportParameterData(final Long id,
|
||||
final String reportParameterName, final String parameterName) {
|
||||
this.id = id;
|
||||
this.reportParameterName = reportParameterName;
|
||||
this.parameterName = parameterName;
|
||||
}
|
||||
@SuppressWarnings("unused")
|
||||
private final Long id;
|
||||
@SuppressWarnings("unused")
|
||||
private final String reportParameterName;
|
||||
@SuppressWarnings("unused")
|
||||
private final String parameterName;
|
||||
|
||||
public ReportParameterData(final Long id, final String reportParameterName, final String parameterName) {
|
||||
this.id = id;
|
||||
this.reportParameterName = reportParameterName;
|
||||
this.parameterName = parameterName;
|
||||
}
|
||||
}
|
||||
+64
-68
@@ -7,86 +7,82 @@ package org.mifosplatform.infrastructure.dataqueries.data;
|
||||
|
||||
final public class ReportParameterJoinData {
|
||||
|
||||
private final Long reportId;
|
||||
private final String reportName;
|
||||
private final String reportType;
|
||||
private final String reportSubType;
|
||||
private final String reportCategory;
|
||||
private final String description;
|
||||
private final String reportSql;
|
||||
private final Boolean coreReport;
|
||||
private final Boolean useReport;
|
||||
private final Long reportId;
|
||||
private final String reportName;
|
||||
private final String reportType;
|
||||
private final String reportSubType;
|
||||
private final String reportCategory;
|
||||
private final String description;
|
||||
private final String reportSql;
|
||||
private final Boolean coreReport;
|
||||
private final Boolean useReport;
|
||||
|
||||
private final Long reportParameterId;
|
||||
private final String reportParameterName;
|
||||
private final String parameterName;
|
||||
private final Long reportParameterId;
|
||||
private final String reportParameterName;
|
||||
private final String parameterName;
|
||||
|
||||
public ReportParameterJoinData(final Long reportId,
|
||||
final String reportName, final String reportType,
|
||||
final String reportSubType, final String reportCategory, final String description,
|
||||
final String reportSql, final Boolean coreReport,
|
||||
final Boolean useReport, final Long reportParameterId,
|
||||
final String reportParameterName, final String parameterName) {
|
||||
this.reportId = reportId;
|
||||
this.reportName = reportName;
|
||||
this.reportType = reportType;
|
||||
this.reportSubType = reportSubType;
|
||||
this.reportCategory = reportCategory;
|
||||
this.description = description;
|
||||
this.reportSql = reportSql;
|
||||
this.coreReport = coreReport;
|
||||
this.useReport = useReport;
|
||||
this.reportParameterId = reportParameterId;
|
||||
this.reportParameterName = reportParameterName;
|
||||
this.parameterName = parameterName;
|
||||
}
|
||||
public ReportParameterJoinData(final Long reportId, final String reportName, final String reportType, final String reportSubType,
|
||||
final String reportCategory, final String description, final String reportSql, final Boolean coreReport,
|
||||
final Boolean useReport, final Long reportParameterId, final String reportParameterName, final String parameterName) {
|
||||
this.reportId = reportId;
|
||||
this.reportName = reportName;
|
||||
this.reportType = reportType;
|
||||
this.reportSubType = reportSubType;
|
||||
this.reportCategory = reportCategory;
|
||||
this.description = description;
|
||||
this.reportSql = reportSql;
|
||||
this.coreReport = coreReport;
|
||||
this.useReport = useReport;
|
||||
this.reportParameterId = reportParameterId;
|
||||
this.reportParameterName = reportParameterName;
|
||||
this.parameterName = parameterName;
|
||||
}
|
||||
|
||||
public Long getReportId() {
|
||||
return reportId;
|
||||
}
|
||||
public Long getReportId() {
|
||||
return reportId;
|
||||
}
|
||||
|
||||
public String getReportName() {
|
||||
return reportName;
|
||||
}
|
||||
public String getReportName() {
|
||||
return reportName;
|
||||
}
|
||||
|
||||
public String getReportType() {
|
||||
return reportType;
|
||||
}
|
||||
public String getReportType() {
|
||||
return reportType;
|
||||
}
|
||||
|
||||
public String getReportSubType() {
|
||||
return reportSubType;
|
||||
}
|
||||
public String getReportSubType() {
|
||||
return reportSubType;
|
||||
}
|
||||
|
||||
public String getReportCategory() {
|
||||
return reportCategory;
|
||||
}
|
||||
public String getReportCategory() {
|
||||
return reportCategory;
|
||||
}
|
||||
|
||||
public String getReportSql() {
|
||||
return reportSql;
|
||||
}
|
||||
public String getReportSql() {
|
||||
return reportSql;
|
||||
}
|
||||
|
||||
public Boolean getCoreReport() {
|
||||
return coreReport;
|
||||
}
|
||||
public Boolean getCoreReport() {
|
||||
return coreReport;
|
||||
}
|
||||
|
||||
public Boolean getUseReport() {
|
||||
return useReport;
|
||||
}
|
||||
public Boolean getUseReport() {
|
||||
return useReport;
|
||||
}
|
||||
|
||||
public Long getReportParameterId() {
|
||||
return reportParameterId;
|
||||
}
|
||||
public Long getReportParameterId() {
|
||||
return reportParameterId;
|
||||
}
|
||||
|
||||
public String getReportParameterName() {
|
||||
return reportParameterName;
|
||||
}
|
||||
public String getReportParameterName() {
|
||||
return reportParameterName;
|
||||
}
|
||||
|
||||
public String getParameterName() {
|
||||
return parameterName;
|
||||
}
|
||||
|
||||
public String getDescription() {
|
||||
return description;
|
||||
}
|
||||
public String getParameterName() {
|
||||
return parameterName;
|
||||
}
|
||||
|
||||
public String getDescription() {
|
||||
return description;
|
||||
}
|
||||
}
|
||||
+145
-198
@@ -27,233 +27,180 @@ import org.springframework.data.jpa.domain.AbstractPersistable;
|
||||
@Table(name = "stretchy_report", uniqueConstraints = { @UniqueConstraint(columnNames = { "report_name" }, name = "unq_report_name") })
|
||||
public class Report extends AbstractPersistable<Long> {
|
||||
|
||||
@Column(name = "report_name", nullable = false, unique = true)
|
||||
private String reportName;
|
||||
@Column(name = "report_name", nullable = false, unique = true)
|
||||
private String reportName;
|
||||
|
||||
@Column(name = "report_type", nullable = false)
|
||||
private String reportType;
|
||||
@Column(name = "report_type", nullable = false)
|
||||
private String reportType;
|
||||
|
||||
@Column(name = "report_subtype")
|
||||
private String reportSubType;
|
||||
@Column(name = "report_subtype")
|
||||
private String reportSubType;
|
||||
|
||||
@Column(name = "report_category")
|
||||
private String reportCategory;
|
||||
@Column(name = "report_category")
|
||||
private String reportCategory;
|
||||
|
||||
@Column(name = "description")
|
||||
private String description;
|
||||
@Column(name = "description")
|
||||
private String description;
|
||||
|
||||
@Column(name = "core_report", nullable = false)
|
||||
private boolean coreReport;
|
||||
@Column(name = "core_report", nullable = false)
|
||||
private boolean coreReport;
|
||||
|
||||
// only defines if report should appear in reference app UI List
|
||||
@Column(name = "use_report", nullable = false)
|
||||
private boolean useReport;
|
||||
// only defines if report should appear in reference app UI List
|
||||
@Column(name = "use_report", nullable = false)
|
||||
private boolean useReport;
|
||||
|
||||
@Column(name = "report_sql")
|
||||
private String reportSql;
|
||||
@Column(name = "report_sql")
|
||||
private String reportSql;
|
||||
|
||||
/*
|
||||
* @ManyToMany
|
||||
*
|
||||
* @JoinTable(name = "stretchy_report_parameter", joinColumns =
|
||||
*
|
||||
* @JoinColumn(name = "reportn_id"), inverseJoinColumns = @JoinColumn(name =
|
||||
* "parameter_id")) private List<Charge> charges;
|
||||
*/
|
||||
/*
|
||||
* @ManyToMany
|
||||
*
|
||||
* @JoinTable(name = "stretchy_report_parameter", joinColumns =
|
||||
*
|
||||
* @JoinColumn(name = "reportn_id"), inverseJoinColumns = @JoinColumn(name =
|
||||
* "parameter_id")) private List<Charge> charges;
|
||||
*/
|
||||
|
||||
public static Report fromJson(final JsonCommand command) {
|
||||
public static Report fromJson(final JsonCommand command) {
|
||||
|
||||
final String reportName = command
|
||||
.stringValueOfParameterNamed("reportName");
|
||||
final String reportType = command
|
||||
.stringValueOfParameterNamed("reportType");
|
||||
final String reportSubType = command
|
||||
.stringValueOfParameterNamed("reportSubType");
|
||||
final String reportCategory = command
|
||||
.stringValueOfParameterNamed("reportCategory");
|
||||
final String description = command
|
||||
.stringValueOfParameterNamed("description");
|
||||
final boolean useReport = command
|
||||
.booleanPrimitiveValueOfParameterNamed("useReport");
|
||||
final String reportSql = command
|
||||
.stringValueOfParameterNamed("reportSql");
|
||||
final String reportName = command.stringValueOfParameterNamed("reportName");
|
||||
final String reportType = command.stringValueOfParameterNamed("reportType");
|
||||
final String reportSubType = command.stringValueOfParameterNamed("reportSubType");
|
||||
final String reportCategory = command.stringValueOfParameterNamed("reportCategory");
|
||||
final String description = command.stringValueOfParameterNamed("description");
|
||||
final boolean useReport = command.booleanPrimitiveValueOfParameterNamed("useReport");
|
||||
final String reportSql = command.stringValueOfParameterNamed("reportSql");
|
||||
|
||||
return new Report(reportName, reportType, reportSubType,
|
||||
reportCategory, description, useReport, reportSql);
|
||||
}
|
||||
return new Report(reportName, reportType, reportSubType, reportCategory, description, useReport, reportSql);
|
||||
}
|
||||
|
||||
protected Report() {
|
||||
//
|
||||
}
|
||||
protected Report() {
|
||||
//
|
||||
}
|
||||
|
||||
public Report(final String reportName, final String reportType,
|
||||
final String reportSubType, final String reportCategory,
|
||||
final String description, final boolean useReport,
|
||||
final String reportSql) {
|
||||
this.reportName = reportName;
|
||||
this.reportType = reportType;
|
||||
this.reportSubType = reportSubType;
|
||||
this.reportCategory = reportCategory;
|
||||
this.description = description;
|
||||
this.coreReport = false;
|
||||
this.useReport = useReport;
|
||||
this.reportSql = reportSql;
|
||||
validate();
|
||||
}
|
||||
public Report(final String reportName, final String reportType, final String reportSubType, final String reportCategory,
|
||||
final String description, final boolean useReport, final String reportSql) {
|
||||
this.reportName = reportName;
|
||||
this.reportType = reportType;
|
||||
this.reportSubType = reportSubType;
|
||||
this.reportCategory = reportCategory;
|
||||
this.description = description;
|
||||
this.coreReport = false;
|
||||
this.useReport = useReport;
|
||||
this.reportSql = reportSql;
|
||||
validate();
|
||||
}
|
||||
|
||||
public Map<String, Object> update(final JsonCommand command) {
|
||||
public Map<String, Object> update(final JsonCommand command) {
|
||||
|
||||
final Map<String, Object> actualChanges = new LinkedHashMap<String, Object>(
|
||||
8);
|
||||
final Map<String, Object> actualChanges = new LinkedHashMap<String, Object>(8);
|
||||
|
||||
String paramName = "reportName";
|
||||
if (command.isChangeInStringParameterNamed(paramName, this.reportName)) {
|
||||
final String newValue = command
|
||||
.stringValueOfParameterNamed(paramName);
|
||||
actualChanges.put(paramName, newValue);
|
||||
this.reportName = StringUtils.defaultIfEmpty(newValue, null);
|
||||
}
|
||||
paramName = "reportType";
|
||||
if (command.isChangeInStringParameterNamed(paramName, this.reportType)) {
|
||||
final String newValue = command
|
||||
.stringValueOfParameterNamed(paramName);
|
||||
actualChanges.put(paramName, newValue);
|
||||
this.reportType = StringUtils.defaultIfEmpty(newValue, null);
|
||||
}
|
||||
paramName = "reportSubType";
|
||||
if (command.isChangeInStringParameterNamed(paramName,
|
||||
this.reportSubType)) {
|
||||
final String newValue = command
|
||||
.stringValueOfParameterNamed(paramName);
|
||||
actualChanges.put(paramName, newValue);
|
||||
this.reportSubType = StringUtils.defaultIfEmpty(newValue, null);
|
||||
}
|
||||
paramName = "reportCategory";
|
||||
if (command.isChangeInStringParameterNamed(paramName,
|
||||
this.reportCategory)) {
|
||||
final String newValue = command
|
||||
.stringValueOfParameterNamed(paramName);
|
||||
actualChanges.put(paramName, newValue);
|
||||
this.reportCategory = StringUtils.defaultIfEmpty(newValue, null);
|
||||
}
|
||||
paramName = "description";
|
||||
if (command.isChangeInStringParameterNamed(paramName, this.description)) {
|
||||
final String newValue = command
|
||||
.stringValueOfParameterNamed(paramName);
|
||||
actualChanges.put(paramName, newValue);
|
||||
this.description = StringUtils.defaultIfEmpty(newValue, null);
|
||||
}
|
||||
paramName = "useReport";
|
||||
if (command.isChangeInBooleanParameterNamed(paramName, this.useReport)) {
|
||||
final boolean newValue = command
|
||||
.booleanPrimitiveValueOfParameterNamed(paramName);
|
||||
actualChanges.put(paramName, newValue);
|
||||
this.useReport = newValue;
|
||||
}
|
||||
paramName = "reportSql";
|
||||
if (command.isChangeInStringParameterNamed(paramName, this.reportSql)) {
|
||||
final String newValue = command
|
||||
.stringValueOfParameterNamed(paramName);
|
||||
actualChanges.put(paramName, newValue);
|
||||
this.reportSql = StringUtils.defaultIfEmpty(newValue, null);
|
||||
}
|
||||
String paramName = "reportName";
|
||||
if (command.isChangeInStringParameterNamed(paramName, this.reportName)) {
|
||||
final String newValue = command.stringValueOfParameterNamed(paramName);
|
||||
actualChanges.put(paramName, newValue);
|
||||
this.reportName = StringUtils.defaultIfEmpty(newValue, null);
|
||||
}
|
||||
paramName = "reportType";
|
||||
if (command.isChangeInStringParameterNamed(paramName, this.reportType)) {
|
||||
final String newValue = command.stringValueOfParameterNamed(paramName);
|
||||
actualChanges.put(paramName, newValue);
|
||||
this.reportType = StringUtils.defaultIfEmpty(newValue, null);
|
||||
}
|
||||
paramName = "reportSubType";
|
||||
if (command.isChangeInStringParameterNamed(paramName, this.reportSubType)) {
|
||||
final String newValue = command.stringValueOfParameterNamed(paramName);
|
||||
actualChanges.put(paramName, newValue);
|
||||
this.reportSubType = StringUtils.defaultIfEmpty(newValue, null);
|
||||
}
|
||||
paramName = "reportCategory";
|
||||
if (command.isChangeInStringParameterNamed(paramName, this.reportCategory)) {
|
||||
final String newValue = command.stringValueOfParameterNamed(paramName);
|
||||
actualChanges.put(paramName, newValue);
|
||||
this.reportCategory = StringUtils.defaultIfEmpty(newValue, null);
|
||||
}
|
||||
paramName = "description";
|
||||
if (command.isChangeInStringParameterNamed(paramName, this.description)) {
|
||||
final String newValue = command.stringValueOfParameterNamed(paramName);
|
||||
actualChanges.put(paramName, newValue);
|
||||
this.description = StringUtils.defaultIfEmpty(newValue, null);
|
||||
}
|
||||
paramName = "useReport";
|
||||
if (command.isChangeInBooleanParameterNamed(paramName, this.useReport)) {
|
||||
final boolean newValue = command.booleanPrimitiveValueOfParameterNamed(paramName);
|
||||
actualChanges.put(paramName, newValue);
|
||||
this.useReport = newValue;
|
||||
}
|
||||
paramName = "reportSql";
|
||||
if (command.isChangeInStringParameterNamed(paramName, this.reportSql)) {
|
||||
final String newValue = command.stringValueOfParameterNamed(paramName);
|
||||
actualChanges.put(paramName, newValue);
|
||||
this.reportSql = StringUtils.defaultIfEmpty(newValue, null);
|
||||
}
|
||||
|
||||
validate();
|
||||
validate();
|
||||
|
||||
if (!actualChanges.isEmpty()) {
|
||||
if (isCoreReport()) {
|
||||
for (final String key : actualChanges.keySet()) {
|
||||
if (!(key.equals("useReport"))) {
|
||||
throw new PlatformDataIntegrityException(
|
||||
"error.msg.only.use.report.can.be.updated.for.core.report",
|
||||
"Only the Use Report field can be updated for Core Reports",
|
||||
key);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
if (!actualChanges.isEmpty()) {
|
||||
if (isCoreReport()) {
|
||||
for (final String key : actualChanges.keySet()) {
|
||||
if (!(key.equals("useReport"))) { throw new PlatformDataIntegrityException(
|
||||
"error.msg.only.use.report.can.be.updated.for.core.report",
|
||||
"Only the Use Report field can be updated for Core Reports", key); }
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return actualChanges;
|
||||
}
|
||||
return actualChanges;
|
||||
}
|
||||
|
||||
public boolean isCoreReport() {
|
||||
return coreReport;
|
||||
}
|
||||
public boolean isCoreReport() {
|
||||
return coreReport;
|
||||
}
|
||||
|
||||
private void validate() {
|
||||
private void validate() {
|
||||
|
||||
final List<ApiParameterError> dataValidationErrors = new ArrayList<ApiParameterError>();
|
||||
final DataValidatorBuilder baseDataValidator = new DataValidatorBuilder(
|
||||
dataValidationErrors).resource("report");
|
||||
final List<ApiParameterError> dataValidationErrors = new ArrayList<ApiParameterError>();
|
||||
final DataValidatorBuilder baseDataValidator = new DataValidatorBuilder(dataValidationErrors).resource("report");
|
||||
|
||||
baseDataValidator.reset().parameter("reportName")
|
||||
.value(this.reportName).notBlank().notExceedingLengthOf(100);
|
||||
baseDataValidator.reset().parameter("reportName").value(this.reportName).notBlank().notExceedingLengthOf(100);
|
||||
|
||||
baseDataValidator
|
||||
.reset()
|
||||
.parameter("reportType")
|
||||
.value(this.reportType)
|
||||
.notBlank()
|
||||
.isOneOfTheseValues(
|
||||
new Object[] { "Table", "Pentaho", "Chart" });
|
||||
baseDataValidator.reset().parameter("reportType").value(this.reportType).notBlank()
|
||||
.isOneOfTheseValues(new Object[] { "Table", "Pentaho", "Chart" });
|
||||
|
||||
baseDataValidator.reset().parameter("reportSubType")
|
||||
.value(this.reportSubType).notExceedingLengthOf(20);
|
||||
baseDataValidator.reset().parameter("reportSubType").value(this.reportSubType).notExceedingLengthOf(20);
|
||||
|
||||
if (StringUtils.isNotBlank(this.reportType)) {
|
||||
if (this.reportType.equals("Chart")) {
|
||||
baseDataValidator
|
||||
.reset()
|
||||
.parameter("reportSubType")
|
||||
.value(this.reportSubType)
|
||||
.cantBeBlankWhenParameterProvidedIs("reportType",
|
||||
this.reportType)
|
||||
.isOneOfTheseValues(new Object[] { "Bar", "Pie" });
|
||||
} else {
|
||||
baseDataValidator
|
||||
.reset()
|
||||
.parameter("reportSubType")
|
||||
.value(this.reportSubType)
|
||||
.mustBeBlankWhenParameterProvidedIs("reportType",
|
||||
this.reportType);
|
||||
}
|
||||
}
|
||||
if (StringUtils.isNotBlank(this.reportType)) {
|
||||
if (this.reportType.equals("Chart")) {
|
||||
baseDataValidator.reset().parameter("reportSubType").value(this.reportSubType)
|
||||
.cantBeBlankWhenParameterProvidedIs("reportType", this.reportType)
|
||||
.isOneOfTheseValues(new Object[] { "Bar", "Pie" });
|
||||
} else {
|
||||
baseDataValidator.reset().parameter("reportSubType").value(this.reportSubType)
|
||||
.mustBeBlankWhenParameterProvidedIs("reportType", this.reportType);
|
||||
}
|
||||
}
|
||||
|
||||
baseDataValidator.reset().parameter("reportCategory")
|
||||
.value(this.reportCategory).notExceedingLengthOf(45);
|
||||
baseDataValidator.reset().parameter("reportCategory").value(this.reportCategory).notExceedingLengthOf(45);
|
||||
|
||||
if (StringUtils.isNotBlank(this.reportType)) {
|
||||
if ((this.reportType.equals("Table"))
|
||||
|| (this.reportType.equals("Chart"))) {
|
||||
baseDataValidator
|
||||
.reset()
|
||||
.parameter("reportSql")
|
||||
.value(this.reportSql)
|
||||
.cantBeBlankWhenParameterProvidedIs("reportType",
|
||||
this.reportType);
|
||||
} else {
|
||||
baseDataValidator
|
||||
.reset()
|
||||
.parameter("reportSql")
|
||||
.value(this.reportSql)
|
||||
.mustBeBlankWhenParameterProvidedIs("reportType",
|
||||
this.reportType);
|
||||
}
|
||||
}
|
||||
throwExceptionIfValidationWarningsExist(dataValidationErrors);
|
||||
}
|
||||
if (StringUtils.isNotBlank(this.reportType)) {
|
||||
if ((this.reportType.equals("Table")) || (this.reportType.equals("Chart"))) {
|
||||
baseDataValidator.reset().parameter("reportSql").value(this.reportSql)
|
||||
.cantBeBlankWhenParameterProvidedIs("reportType", this.reportType);
|
||||
} else {
|
||||
baseDataValidator.reset().parameter("reportSql").value(this.reportSql)
|
||||
.mustBeBlankWhenParameterProvidedIs("reportType", this.reportType);
|
||||
}
|
||||
}
|
||||
throwExceptionIfValidationWarningsExist(dataValidationErrors);
|
||||
}
|
||||
|
||||
private void throwExceptionIfValidationWarningsExist(
|
||||
final List<ApiParameterError> dataValidationErrors) {
|
||||
if (!dataValidationErrors.isEmpty()) {
|
||||
throw new PlatformApiDataValidationException(
|
||||
"validation.msg.validation.errors.exist",
|
||||
"Validation errors exist.", dataValidationErrors);
|
||||
}
|
||||
}
|
||||
private void throwExceptionIfValidationWarningsExist(final List<ApiParameterError> dataValidationErrors) {
|
||||
if (!dataValidationErrors.isEmpty()) { throw new PlatformApiDataValidationException("validation.msg.validation.errors.exist",
|
||||
"Validation errors exist.", dataValidationErrors); }
|
||||
}
|
||||
|
||||
public String getReportName() {
|
||||
return reportName;
|
||||
}
|
||||
public String getReportName() {
|
||||
return reportName;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
+1
-1
@@ -9,5 +9,5 @@ import org.springframework.data.jpa.repository.JpaRepository;
|
||||
import org.springframework.data.jpa.repository.JpaSpecificationExecutor;
|
||||
|
||||
public interface ReportRepository extends JpaRepository<Report, Long>, JpaSpecificationExecutor<Report> {
|
||||
// no added behaviour
|
||||
// no added behaviour
|
||||
}
|
||||
+1
-1
@@ -8,7 +8,7 @@ package org.mifosplatform.infrastructure.dataqueries.exception;
|
||||
import org.mifosplatform.infrastructure.core.exception.AbstractPlatformResourceNotFoundException;
|
||||
|
||||
/**
|
||||
* A {@link RuntimeException} thrown when client resources are not found.
|
||||
* A {@link RuntimeException} thrown when datatable resources are not found.
|
||||
*/
|
||||
public class DatatableNotFoundException extends AbstractPlatformResourceNotFoundException {
|
||||
|
||||
|
||||
+1
-2
@@ -12,5 +12,4 @@ public class DatatableSystemErrorException extends AbstractPlatformDomainRuleExc
|
||||
public DatatableSystemErrorException(final String msg) {
|
||||
super("error.msg.datatable.system.error", msg, msg);
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
+1
-1
@@ -15,7 +15,7 @@ public class ReportNotFoundException extends AbstractPlatformResourceNotFoundExc
|
||||
public ReportNotFoundException(final String reportSql) {
|
||||
super("error.msg.report.name.not.found", "Reporting meta-data entry not found.", "Input sql: " + reportSql);
|
||||
}
|
||||
|
||||
|
||||
public ReportNotFoundException(final Long id) {
|
||||
super("error.msg.report.id.invalid", "Report with identifier " + id + " does not exist", id);
|
||||
}
|
||||
|
||||
+7
-6
@@ -28,16 +28,17 @@ public class CreateDatatableEntryCommandHandler implements NewCommandSourceHandl
|
||||
@Override
|
||||
public CommandProcessingResult processCommand(final JsonCommand command) {
|
||||
|
||||
CommandProcessingResult commandProcessingResult = this.writePlatformService.createNewDatatableEntry(command.entityName(), command.entityId(), command);
|
||||
CommandProcessingResult commandProcessingResult = this.writePlatformService.createNewDatatableEntry(command.entityName(),
|
||||
command.entityId(), command);
|
||||
|
||||
return new CommandProcessingResultBuilder() //
|
||||
.withCommandId(command.commandId()) //
|
||||
.withEntityId(command.entityId()) //
|
||||
.withOfficeId(commandProcessingResult.getOfficeId()) //
|
||||
.withGroupId(commandProcessingResult.getGroupId()) //
|
||||
.withClientId(commandProcessingResult.getClientId()) //
|
||||
.withSavingsId(commandProcessingResult.getSavingsId()) //
|
||||
.withLoanId(commandProcessingResult.getLoanId()) //
|
||||
.withOfficeId(commandProcessingResult.getOfficeId()) //
|
||||
.withGroupId(commandProcessingResult.getGroupId()) //
|
||||
.withClientId(commandProcessingResult.getClientId()) //
|
||||
.withSavingsId(commandProcessingResult.getSavingsId()) //
|
||||
.withLoanId(commandProcessingResult.getLoanId()) //
|
||||
.build();
|
||||
}
|
||||
}
|
||||
+10
-11
@@ -16,18 +16,17 @@ import org.springframework.transaction.annotation.Transactional;
|
||||
@Service
|
||||
public class CreateReportCommandHandler implements NewCommandSourceHandler {
|
||||
|
||||
private final ReportWritePlatformService writePlatformService;
|
||||
private final ReportWritePlatformService writePlatformService;
|
||||
|
||||
@Autowired
|
||||
public CreateReportCommandHandler(
|
||||
final ReportWritePlatformService writePlatformService) {
|
||||
this.writePlatformService = writePlatformService;
|
||||
}
|
||||
@Autowired
|
||||
public CreateReportCommandHandler(final ReportWritePlatformService writePlatformService) {
|
||||
this.writePlatformService = writePlatformService;
|
||||
}
|
||||
|
||||
@Transactional
|
||||
@Override
|
||||
public CommandProcessingResult processCommand(final JsonCommand command) {
|
||||
@Transactional
|
||||
@Override
|
||||
public CommandProcessingResult processCommand(final JsonCommand command) {
|
||||
|
||||
return this.writePlatformService.createReport(command);
|
||||
}
|
||||
return this.writePlatformService.createReport(command);
|
||||
}
|
||||
}
|
||||
+7
-6
@@ -28,16 +28,17 @@ public class DeleteOneToManyDatatableEntryCommandHandler implements NewCommandSo
|
||||
@Override
|
||||
public CommandProcessingResult processCommand(final JsonCommand command) {
|
||||
|
||||
CommandProcessingResult commandProcessingResult = this.writePlatformService.deleteDatatableEntry(command.entityName(), command.entityId(), command.subentityId());
|
||||
CommandProcessingResult commandProcessingResult = this.writePlatformService.deleteDatatableEntry(command.entityName(),
|
||||
command.entityId(), command.subentityId());
|
||||
|
||||
return new CommandProcessingResultBuilder() //
|
||||
.withCommandId(command.commandId()) //
|
||||
.withEntityId(command.entityId()) //
|
||||
.withOfficeId(commandProcessingResult.getOfficeId()) //
|
||||
.withGroupId(commandProcessingResult.getGroupId()) //
|
||||
.withClientId(commandProcessingResult.getClientId()) //
|
||||
.withSavingsId(commandProcessingResult.getSavingsId()) //
|
||||
.withLoanId(commandProcessingResult.getLoanId()) //
|
||||
.withOfficeId(commandProcessingResult.getOfficeId()) //
|
||||
.withGroupId(commandProcessingResult.getGroupId()) //
|
||||
.withClientId(commandProcessingResult.getClientId()) //
|
||||
.withSavingsId(commandProcessingResult.getSavingsId()) //
|
||||
.withLoanId(commandProcessingResult.getLoanId()) //
|
||||
.build();
|
||||
}
|
||||
}
|
||||
+7
-6
@@ -28,16 +28,17 @@ public class DeleteOneToOneDatatableEntryCommandHandler implements NewCommandSou
|
||||
@Override
|
||||
public CommandProcessingResult processCommand(final JsonCommand command) {
|
||||
|
||||
CommandProcessingResult commandProcessingResult = this.writePlatformService.deleteDatatableEntries(command.entityName(), command.entityId());
|
||||
CommandProcessingResult commandProcessingResult = this.writePlatformService.deleteDatatableEntries(command.entityName(),
|
||||
command.entityId());
|
||||
|
||||
return new CommandProcessingResultBuilder() //
|
||||
.withCommandId(command.commandId()) //
|
||||
.withEntityId(command.entityId()) //
|
||||
.withOfficeId(commandProcessingResult.getOfficeId()) //
|
||||
.withGroupId(commandProcessingResult.getGroupId()) //
|
||||
.withClientId(commandProcessingResult.getClientId()) //
|
||||
.withSavingsId(commandProcessingResult.getSavingsId()) //
|
||||
.withLoanId(commandProcessingResult.getLoanId()) //
|
||||
.withOfficeId(commandProcessingResult.getOfficeId()) //
|
||||
.withGroupId(commandProcessingResult.getGroupId()) //
|
||||
.withClientId(commandProcessingResult.getClientId()) //
|
||||
.withSavingsId(commandProcessingResult.getSavingsId()) //
|
||||
.withLoanId(commandProcessingResult.getLoanId()) //
|
||||
.build();
|
||||
}
|
||||
}
|
||||
+14
-15
@@ -17,23 +17,22 @@ import org.springframework.transaction.annotation.Transactional;
|
||||
@Service
|
||||
public class DeleteReportCommandHandler implements NewCommandSourceHandler {
|
||||
|
||||
private final ReportWritePlatformService writePlatformService;
|
||||
private final ReportWritePlatformService writePlatformService;
|
||||
|
||||
@Autowired
|
||||
public DeleteReportCommandHandler(
|
||||
final ReportWritePlatformService writePlatformService) {
|
||||
this.writePlatformService = writePlatformService;
|
||||
}
|
||||
@Autowired
|
||||
public DeleteReportCommandHandler(final ReportWritePlatformService writePlatformService) {
|
||||
this.writePlatformService = writePlatformService;
|
||||
}
|
||||
|
||||
@Transactional
|
||||
@Override
|
||||
public CommandProcessingResult processCommand(final JsonCommand command) {
|
||||
@Transactional
|
||||
@Override
|
||||
public CommandProcessingResult processCommand(final JsonCommand command) {
|
||||
|
||||
this.writePlatformService.deleteReport(command.entityId());
|
||||
this.writePlatformService.deleteReport(command.entityId());
|
||||
|
||||
return new CommandProcessingResultBuilder() //
|
||||
.withCommandId(command.commandId()) //
|
||||
.withEntityId(command.entityId()) //
|
||||
.build();
|
||||
}
|
||||
return new CommandProcessingResultBuilder() //
|
||||
.withCommandId(command.commandId()) //
|
||||
.withEntityId(command.entityId()) //
|
||||
.build();
|
||||
}
|
||||
}
|
||||
+11
-11
@@ -28,18 +28,18 @@ public class UpdateOneToManyDatatableEntryCommandHandler implements NewCommandSo
|
||||
@Override
|
||||
public CommandProcessingResult processCommand(final JsonCommand command) {
|
||||
|
||||
final CommandProcessingResult commandProcessingResult = this.writePlatformService.updateDatatableEntryOneToMany(command.entityName(),
|
||||
command.entityId(), command.subentityId(), command);
|
||||
final CommandProcessingResult commandProcessingResult = this.writePlatformService.updateDatatableEntryOneToMany(
|
||||
command.entityName(), command.entityId(), command.subentityId(), command);
|
||||
|
||||
return new CommandProcessingResultBuilder() //
|
||||
.withCommandId(command.commandId()) //
|
||||
.withEntityId(command.entityId()) //
|
||||
.withOfficeId(commandProcessingResult.getOfficeId()) //
|
||||
.withGroupId(commandProcessingResult.getGroupId()) //
|
||||
.withClientId(commandProcessingResult.getClientId()) //
|
||||
.withSavingsId(commandProcessingResult.getSavingsId()) //
|
||||
.withLoanId(commandProcessingResult.getLoanId()) //
|
||||
.with(commandProcessingResult.getChanges()) //
|
||||
.build();
|
||||
.withCommandId(command.commandId()) //
|
||||
.withEntityId(command.entityId()) //
|
||||
.withOfficeId(commandProcessingResult.getOfficeId()) //
|
||||
.withGroupId(commandProcessingResult.getGroupId()) //
|
||||
.withClientId(commandProcessingResult.getClientId()) //
|
||||
.withSavingsId(commandProcessingResult.getSavingsId()) //
|
||||
.withLoanId(commandProcessingResult.getLoanId()) //
|
||||
.with(commandProcessingResult.getChanges()) //
|
||||
.build();
|
||||
}
|
||||
}
|
||||
+11
-11
@@ -28,18 +28,18 @@ public class UpdateOneToOneDatatableEntryCommandHandler implements NewCommandSou
|
||||
@Override
|
||||
public CommandProcessingResult processCommand(final JsonCommand command) {
|
||||
|
||||
final CommandProcessingResult commandProcessingResult = this.writePlatformService.updateDatatableEntryOneToOne(command.entityName(), command.entityId(),
|
||||
command);
|
||||
final CommandProcessingResult commandProcessingResult = this.writePlatformService.updateDatatableEntryOneToOne(
|
||||
command.entityName(), command.entityId(), command);
|
||||
|
||||
return new CommandProcessingResultBuilder() //
|
||||
.withCommandId(command.commandId()) //
|
||||
.withEntityId(command.entityId()) //
|
||||
.withOfficeId(commandProcessingResult.getOfficeId()) //
|
||||
.withGroupId(commandProcessingResult.getGroupId()) //
|
||||
.withClientId(commandProcessingResult.getClientId()) //
|
||||
.withSavingsId(commandProcessingResult.getSavingsId()) //
|
||||
.withLoanId(commandProcessingResult.getLoanId()) //
|
||||
.with(commandProcessingResult.getChanges()) //
|
||||
.build();
|
||||
.withCommandId(command.commandId()) //
|
||||
.withEntityId(command.entityId()) //
|
||||
.withOfficeId(commandProcessingResult.getOfficeId()) //
|
||||
.withGroupId(commandProcessingResult.getGroupId()) //
|
||||
.withClientId(commandProcessingResult.getClientId()) //
|
||||
.withSavingsId(commandProcessingResult.getSavingsId()) //
|
||||
.withLoanId(commandProcessingResult.getLoanId()) //
|
||||
.with(commandProcessingResult.getChanges()) //
|
||||
.build();
|
||||
}
|
||||
}
|
||||
+10
-12
@@ -16,19 +16,17 @@ import org.springframework.transaction.annotation.Transactional;
|
||||
@Service
|
||||
public class UpdateReportCommandHandler implements NewCommandSourceHandler {
|
||||
|
||||
private final ReportWritePlatformService writePlatformService;
|
||||
private final ReportWritePlatformService writePlatformService;
|
||||
|
||||
@Autowired
|
||||
public UpdateReportCommandHandler(
|
||||
final ReportWritePlatformService writePlatformService) {
|
||||
this.writePlatformService = writePlatformService;
|
||||
}
|
||||
@Autowired
|
||||
public UpdateReportCommandHandler(final ReportWritePlatformService writePlatformService) {
|
||||
this.writePlatformService = writePlatformService;
|
||||
}
|
||||
|
||||
@Transactional
|
||||
@Override
|
||||
public CommandProcessingResult processCommand(final JsonCommand command) {
|
||||
@Transactional
|
||||
@Override
|
||||
public CommandProcessingResult processCommand(final JsonCommand command) {
|
||||
|
||||
return this.writePlatformService.updateReport(command.entityId(),
|
||||
command);
|
||||
}
|
||||
return this.writePlatformService.updateReport(command.entityId(), command);
|
||||
}
|
||||
}
|
||||
+15
-21
@@ -22,30 +22,24 @@ import com.google.gson.reflect.TypeToken;
|
||||
@Component
|
||||
public final class ReportCommandFromApiJsonDeserializer {
|
||||
|
||||
/**
|
||||
* The parameters supported for this command.
|
||||
*/
|
||||
private final Set<String> supportedParameters = new HashSet<String>(
|
||||
Arrays.asList("reportName", "reportType", "reportSubType",
|
||||
"reportCategory", "description", "reportSql", "useReport"));
|
||||
/**
|
||||
* The parameters supported for this command.
|
||||
*/
|
||||
private final Set<String> supportedParameters = new HashSet<String>(Arrays.asList("reportName", "reportType", "reportSubType",
|
||||
"reportCategory", "description", "reportSql", "useReport"));
|
||||
|
||||
private final FromJsonHelper fromApiJsonHelper;
|
||||
private final FromJsonHelper fromApiJsonHelper;
|
||||
|
||||
@Autowired
|
||||
public ReportCommandFromApiJsonDeserializer(
|
||||
final FromJsonHelper fromApiJsonHelper) {
|
||||
this.fromApiJsonHelper = fromApiJsonHelper;
|
||||
}
|
||||
@Autowired
|
||||
public ReportCommandFromApiJsonDeserializer(final FromJsonHelper fromApiJsonHelper) {
|
||||
this.fromApiJsonHelper = fromApiJsonHelper;
|
||||
}
|
||||
|
||||
public void validate(final String json) {
|
||||
if (StringUtils.isBlank(json)) {
|
||||
throw new InvalidJsonException();
|
||||
}
|
||||
public void validate(final String json) {
|
||||
if (StringUtils.isBlank(json)) { throw new InvalidJsonException(); }
|
||||
|
||||
final Type typeOfMap = new TypeToken<Map<String, Object>>() {
|
||||
}.getType();
|
||||
final Type typeOfMap = new TypeToken<Map<String, Object>>() {}.getType();
|
||||
|
||||
fromApiJsonHelper.checkForUnsupportedParameters(typeOfMap, json,
|
||||
supportedParameters);
|
||||
}
|
||||
fromApiJsonHelper.checkForUnsupportedParameters(typeOfMap, json, supportedParameters);
|
||||
}
|
||||
}
|
||||
+7
-11
@@ -16,21 +16,17 @@ import org.mifosplatform.infrastructure.dataqueries.data.ReportData;
|
||||
|
||||
public interface ReadReportingService {
|
||||
|
||||
StreamingOutput retrieveReportCSV(String name, String type,
|
||||
Map<String, String> extractedQueryParams);
|
||||
StreamingOutput retrieveReportCSV(String name, String type, Map<String, String> extractedQueryParams);
|
||||
|
||||
GenericResultsetData retrieveGenericResultset(String name, String type,
|
||||
Map<String, String> extractedQueryParams);
|
||||
GenericResultsetData retrieveGenericResultset(String name, String type, Map<String, String> extractedQueryParams);
|
||||
|
||||
Response processPentahoRequest(String reportName, String outputType,
|
||||
Map<String, String> queryParams);
|
||||
Response processPentahoRequest(String reportName, String outputType, Map<String, String> queryParams);
|
||||
|
||||
String retrieveReportPDF(String name, String type,
|
||||
Map<String, String> extractedQueryParams);
|
||||
String retrieveReportPDF(String name, String type, Map<String, String> extractedQueryParams);
|
||||
|
||||
String getReportType(String reportName);
|
||||
String getReportType(String reportName);
|
||||
|
||||
Collection<ReportData> retrieveReportList();
|
||||
Collection<ReportData> retrieveReportList();
|
||||
|
||||
ReportData retrieveReport(final Long id);
|
||||
ReportData retrieveReport(final Long id);
|
||||
}
|
||||
+491
-582
File diff suppressed because it is too large
Load Diff
-29
@@ -1,29 +0,0 @@
|
||||
/**
|
||||
* This Source Code Form is subject to the terms of the Mozilla Public
|
||||
* License, v. 2.0. If a copy of the MPL was not distributed with this file,
|
||||
* You can obtain one at http://mozilla.org/MPL/2.0/.
|
||||
*/
|
||||
package org.mifosplatform.organisation.office.data;
|
||||
|
||||
/**
|
||||
* Immutable data object used for office lookups (will remove eventually and just use {@link OfficeData}.
|
||||
*/
|
||||
@Deprecated
|
||||
public class OfficeLookup {
|
||||
|
||||
private final Long id;
|
||||
@SuppressWarnings("unused")
|
||||
private final String name;
|
||||
@SuppressWarnings("unused")
|
||||
private final String nameDecorated;
|
||||
|
||||
public OfficeLookup(final Long id, final String name, final String nameDecorated) {
|
||||
this.id = id;
|
||||
this.name = name;
|
||||
this.nameDecorated = nameDecorated;
|
||||
}
|
||||
|
||||
public boolean hasIdentifyOf(final Long officeId) {
|
||||
return this.id.equals(officeId);
|
||||
}
|
||||
}
|
||||
-8
@@ -8,7 +8,6 @@ package org.mifosplatform.organisation.office.service;
|
||||
import java.util.Collection;
|
||||
|
||||
import org.mifosplatform.organisation.office.data.OfficeData;
|
||||
import org.mifosplatform.organisation.office.data.OfficeLookup;
|
||||
import org.mifosplatform.organisation.office.data.OfficeTransactionData;
|
||||
|
||||
public interface OfficeReadPlatformService {
|
||||
@@ -17,13 +16,6 @@ public interface OfficeReadPlatformService {
|
||||
|
||||
Collection<OfficeData> retrieveAllOfficesForDropdown();
|
||||
|
||||
/*
|
||||
* Deprecated so cane eventually remove need for OfficeLookup type - so use
|
||||
* retrieveAllOfficesForDropdown instead.
|
||||
*/
|
||||
@Deprecated
|
||||
Collection<OfficeLookup> retrieveAllOfficesForLookup();
|
||||
|
||||
OfficeData retrieveOffice(Long officeId);
|
||||
|
||||
OfficeData retrieveNewOfficeTemplate();
|
||||
|
||||
+2
-33
@@ -18,7 +18,6 @@ import org.mifosplatform.infrastructure.security.service.PlatformSecurityContext
|
||||
import org.mifosplatform.organisation.monetary.data.CurrencyData;
|
||||
import org.mifosplatform.organisation.monetary.service.CurrencyReadPlatformService;
|
||||
import org.mifosplatform.organisation.office.data.OfficeData;
|
||||
import org.mifosplatform.organisation.office.data.OfficeLookup;
|
||||
import org.mifosplatform.organisation.office.data.OfficeTransactionData;
|
||||
import org.mifosplatform.organisation.office.exception.OfficeNotFoundException;
|
||||
import org.mifosplatform.useradministration.domain.AppUser;
|
||||
@@ -86,23 +85,6 @@ public class OfficeReadPlatformServiceImpl implements OfficeReadPlatformService
|
||||
}
|
||||
}
|
||||
|
||||
private static final class OfficeLookupMapper implements RowMapper<OfficeLookup> {
|
||||
|
||||
public String officeLookupSchema() {
|
||||
return " o.id as id, " + nameDecoratedBaseOnHierarchy + " as nameDecorated, o.name as name from m_office o ";
|
||||
}
|
||||
|
||||
@Override
|
||||
public OfficeLookup mapRow(final ResultSet rs, @SuppressWarnings("unused") final int rowNum) throws SQLException {
|
||||
|
||||
Long id = rs.getLong("id");
|
||||
String name = rs.getString("name");
|
||||
String nameDecorated = rs.getString("nameDecorated");
|
||||
|
||||
return new OfficeLookup(id, name, nameDecorated);
|
||||
}
|
||||
}
|
||||
|
||||
private static final class OfficeTransactionMapper implements RowMapper<OfficeTransactionData> {
|
||||
|
||||
public String schema() {
|
||||
@@ -137,8 +119,8 @@ public class OfficeReadPlatformServiceImpl implements OfficeReadPlatformService
|
||||
BigDecimal transactionAmount = rs.getBigDecimal("transactionAmount");
|
||||
String description = rs.getString("description");
|
||||
|
||||
return OfficeTransactionData.instance(id, transactionDate, fromOfficeId, fromOfficeName, toOfficeId, toOfficeName, currencyData,
|
||||
transactionAmount, description);
|
||||
return OfficeTransactionData.instance(id, transactionDate, fromOfficeId, fromOfficeName, toOfficeId, toOfficeName,
|
||||
currencyData, transactionAmount, description);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -169,19 +151,6 @@ public class OfficeReadPlatformServiceImpl implements OfficeReadPlatformService
|
||||
return this.jdbcTemplate.query(sql, rm, new Object[] { hierarchySearchString });
|
||||
}
|
||||
|
||||
@Override
|
||||
public Collection<OfficeLookup> retrieveAllOfficesForLookup() {
|
||||
AppUser currentUser = context.authenticatedUser();
|
||||
|
||||
String hierarchy = currentUser.getOffice().getHierarchy();
|
||||
String hierarchySearchString = hierarchy + "%";
|
||||
|
||||
OfficeLookupMapper rm = new OfficeLookupMapper();
|
||||
String sql = "select " + rm.officeLookupSchema() + "where o.hierarchy like ? order by o.hierarchy";
|
||||
|
||||
return this.jdbcTemplate.query(sql, rm, new Object[] { hierarchySearchString });
|
||||
}
|
||||
|
||||
@Override
|
||||
public OfficeData retrieveOffice(final Long officeId) {
|
||||
|
||||
|
||||
+6
-6
@@ -5,11 +5,11 @@
|
||||
*/
|
||||
package org.mifosplatform.organisation.staff.data;
|
||||
|
||||
import org.joda.time.LocalDate;
|
||||
import org.mifosplatform.organisation.office.data.OfficeLookup;
|
||||
|
||||
import java.util.Collection;
|
||||
|
||||
import org.joda.time.LocalDate;
|
||||
import org.mifosplatform.organisation.office.data.OfficeData;
|
||||
|
||||
/**
|
||||
* Immutable data object returned for loan-officer bulk transfer screens.
|
||||
*/
|
||||
@@ -24,14 +24,14 @@ public class BulkTransferLoanOfficerData {
|
||||
|
||||
// template
|
||||
@SuppressWarnings("unused")
|
||||
private final Collection<OfficeLookup> officeOptions;
|
||||
private final Collection<OfficeData> officeOptions;
|
||||
@SuppressWarnings("unused")
|
||||
private final Collection<StaffData> loanOfficerOptions;
|
||||
@SuppressWarnings("unused")
|
||||
private final StaffAccountSummaryCollectionData accountSummaryCollection;
|
||||
|
||||
public static BulkTransferLoanOfficerData templateForBulk(final Long officeId, final Long fromLoanOfficerId,
|
||||
final LocalDate assignmentDate, final Collection<OfficeLookup> officeOptions, final Collection<StaffData> loanOfficerOptions,
|
||||
final LocalDate assignmentDate, final Collection<OfficeData> officeOptions, final Collection<StaffData> loanOfficerOptions,
|
||||
final StaffAccountSummaryCollectionData accountSummaryCollection) {
|
||||
return new BulkTransferLoanOfficerData(officeId, fromLoanOfficerId, assignmentDate, officeOptions, loanOfficerOptions,
|
||||
accountSummaryCollection);
|
||||
@@ -43,7 +43,7 @@ public class BulkTransferLoanOfficerData {
|
||||
}
|
||||
|
||||
private BulkTransferLoanOfficerData(final Long officeId, final Long fromLoanOfficerId, final LocalDate assignmentDate,
|
||||
final Collection<OfficeLookup> officeOptions, final Collection<StaffData> loanOfficerOptions,
|
||||
final Collection<OfficeData> officeOptions, final Collection<StaffData> loanOfficerOptions,
|
||||
final StaffAccountSummaryCollectionData accountSummaryCollection) {
|
||||
this.officeId = officeId;
|
||||
this.fromLoanOfficerId = fromLoanOfficerId;
|
||||
|
||||
+2
-2
@@ -29,7 +29,7 @@ import org.mifosplatform.infrastructure.core.data.CommandProcessingResult;
|
||||
import org.mifosplatform.infrastructure.core.serialization.ApiRequestJsonSerializationSettings;
|
||||
import org.mifosplatform.infrastructure.core.serialization.DefaultToApiJsonSerializer;
|
||||
import org.mifosplatform.infrastructure.security.service.PlatformSecurityContext;
|
||||
import org.mifosplatform.organisation.office.data.OfficeLookup;
|
||||
import org.mifosplatform.organisation.office.data.OfficeData;
|
||||
import org.mifosplatform.organisation.office.service.OfficeReadPlatformService;
|
||||
import org.mifosplatform.organisation.staff.data.BulkTransferLoanOfficerData;
|
||||
import org.mifosplatform.organisation.staff.data.StaffAccountSummaryCollectionData;
|
||||
@@ -82,7 +82,7 @@ public class BulkLoansApiResource {
|
||||
|
||||
context.authenticatedUser().validateHasReadPermission(resourceNameForPermissions);
|
||||
|
||||
final Collection<OfficeLookup> offices = this.officeReadPlatformService.retrieveAllOfficesForLookup();
|
||||
final Collection<OfficeData> offices = this.officeReadPlatformService.retrieveAllOfficesForDropdown();
|
||||
|
||||
Collection<StaffData> loanOfficers = null;
|
||||
StaffAccountSummaryCollectionData staffAccountSummaryCollectionData = null;
|
||||
|
||||
Reference in New Issue
Block a user