view office transactions api
This commit is contained in:
+58
-19
@@ -1,6 +1,7 @@
|
||||
package org.mifosng.platform.api;
|
||||
|
||||
import java.util.Arrays;
|
||||
import java.util.Collection;
|
||||
import java.util.HashSet;
|
||||
import java.util.Set;
|
||||
|
||||
@@ -33,43 +34,81 @@ public class OfficeTransactionsApiResource {
|
||||
|
||||
@Autowired
|
||||
private OfficeWritePlatformService writePlatformService;
|
||||
|
||||
|
||||
@Autowired
|
||||
private OfficeReadPlatformService readPlatformService;
|
||||
|
||||
@Autowired
|
||||
private ApiDataConversionService apiDataConversionService;
|
||||
|
||||
|
||||
@Autowired
|
||||
private ApiJsonSerializerService apiJsonSerializerService;
|
||||
|
||||
@GET
|
||||
@Path("template")
|
||||
@Consumes({MediaType.APPLICATION_JSON})
|
||||
@Produces({MediaType.APPLICATION_JSON})
|
||||
public String newOfficeTransactionDetails(@Context final UriInfo uriInfo) {
|
||||
@Consumes({ MediaType.APPLICATION_JSON })
|
||||
@Produces({ MediaType.APPLICATION_JSON })
|
||||
public String retrieveOfficeTransactions(@Context final UriInfo uriInfo) {
|
||||
|
||||
Set<String> typicalResponseParameters = new HashSet<String>(Arrays.asList("transactionDate", "allowedOffices", "currencyOptions"));
|
||||
|
||||
Set<String> responseParameters = ApiParameterHelper.extractFieldsForResponseIfProvided(uriInfo.getQueryParameters());
|
||||
Set<String> typicalResponseParameters = new HashSet<String>(
|
||||
Arrays.asList("id", "transactionDate", "fromOfficeId",
|
||||
"fromOfficeName", "toOfficeId", "toOfficeIdName",
|
||||
"currencyCode", "digitsAfterDecimal",
|
||||
"transactionAmount", "description"));
|
||||
|
||||
Set<String> responseParameters = ApiParameterHelper
|
||||
.extractFieldsForResponseIfProvided(uriInfo
|
||||
.getQueryParameters());
|
||||
if (responseParameters.isEmpty()) {
|
||||
responseParameters.addAll(typicalResponseParameters);
|
||||
}
|
||||
boolean prettyPrint = ApiParameterHelper.prettyPrint(uriInfo.getQueryParameters());
|
||||
|
||||
OfficeTransactionData officeTransactionData = this.readPlatformService.retrieveNewOfficeTransactionDetails();
|
||||
boolean prettyPrint = ApiParameterHelper.prettyPrint(uriInfo
|
||||
.getQueryParameters());
|
||||
|
||||
return this.apiJsonSerializerService.serializeOfficeTransactionDataToJson(prettyPrint, responseParameters, officeTransactionData);
|
||||
Collection<OfficeTransactionData> officeTransactions = this.readPlatformService
|
||||
.retrieveAllOfficeTransactions();
|
||||
|
||||
return this.apiJsonSerializerService
|
||||
.serializeOfficeTransactionDataToJson(prettyPrint,
|
||||
responseParameters, officeTransactions);
|
||||
}
|
||||
|
||||
|
||||
@GET
|
||||
@Path("template")
|
||||
@Consumes({ MediaType.APPLICATION_JSON })
|
||||
@Produces({ MediaType.APPLICATION_JSON })
|
||||
public String newOfficeTransactionDetails(@Context final UriInfo uriInfo) {
|
||||
|
||||
Set<String> typicalResponseParameters = new HashSet<String>(
|
||||
Arrays.asList("transactionDate", "allowedOffices",
|
||||
"currencyOptions"));
|
||||
|
||||
Set<String> responseParameters = ApiParameterHelper
|
||||
.extractFieldsForResponseIfProvided(uriInfo
|
||||
.getQueryParameters());
|
||||
if (responseParameters.isEmpty()) {
|
||||
responseParameters.addAll(typicalResponseParameters);
|
||||
}
|
||||
boolean prettyPrint = ApiParameterHelper.prettyPrint(uriInfo
|
||||
.getQueryParameters());
|
||||
|
||||
OfficeTransactionData officeTransactionData = this.readPlatformService
|
||||
.retrieveNewOfficeTransactionDetails();
|
||||
|
||||
return this.apiJsonSerializerService
|
||||
.serializeOfficeTransactionDataToJson(prettyPrint,
|
||||
responseParameters, officeTransactionData);
|
||||
}
|
||||
|
||||
@POST
|
||||
@Consumes({MediaType.APPLICATION_JSON})
|
||||
@Produces({MediaType.APPLICATION_JSON})
|
||||
@Consumes({ MediaType.APPLICATION_JSON })
|
||||
@Produces({ MediaType.APPLICATION_JSON })
|
||||
public Response transferMoneyFrom(final String jsonRequestBody) {
|
||||
|
||||
BranchMoneyTransferCommand command = this.apiDataConversionService.convertJsonToBranchMoneyTransferCommand(jsonRequestBody);
|
||||
|
||||
Long id = this.writePlatformService.externalBranchMoneyTransfer(command);
|
||||
BranchMoneyTransferCommand command = this.apiDataConversionService
|
||||
.convertJsonToBranchMoneyTransferCommand(jsonRequestBody);
|
||||
|
||||
Long id = this.writePlatformService
|
||||
.externalBranchMoneyTransfer(command);
|
||||
return Response.ok().entity(new EntityIdentifier(id)).build();
|
||||
}
|
||||
}
|
||||
+80
-1
@@ -1,5 +1,6 @@
|
||||
package org.mifosng.platform.api.data;
|
||||
|
||||
import java.math.BigDecimal;
|
||||
import java.util.List;
|
||||
|
||||
import org.joda.time.LocalDate;
|
||||
@@ -9,14 +10,55 @@ import org.joda.time.LocalDate;
|
||||
*/
|
||||
public class OfficeTransactionData {
|
||||
|
||||
private final Long id;
|
||||
private final LocalDate transactionDate;
|
||||
private final Long fromOfficeId;
|
||||
private final String fromOfficeName;
|
||||
private final Long toOfficeId;
|
||||
private final String toOfficeName;
|
||||
private final String currencyCode;
|
||||
private final Integer digitsAfterDecimal;
|
||||
private final BigDecimal transactionAmount;
|
||||
private final String description;
|
||||
private final List<CurrencyData> currencyOptions;
|
||||
private final List<OfficeLookup> allowedOffices;
|
||||
|
||||
public OfficeTransactionData(final LocalDate transactionDate, final List<OfficeLookup> allowedOffices, final List<CurrencyData> currencyOptions) {
|
||||
public OfficeTransactionData(final LocalDate transactionDate,
|
||||
final List<OfficeLookup> allowedOffices,
|
||||
final List<CurrencyData> currencyOptions) {
|
||||
this.transactionDate = transactionDate;
|
||||
this.allowedOffices = allowedOffices;
|
||||
this.currencyOptions = currencyOptions;
|
||||
this.id = null;
|
||||
this.fromOfficeId = null;
|
||||
this.fromOfficeName = null;
|
||||
this.toOfficeId = null;
|
||||
this.toOfficeName = null;
|
||||
this.currencyCode = null;
|
||||
this.digitsAfterDecimal = null;
|
||||
this.transactionAmount = null;
|
||||
this.description = null;
|
||||
}
|
||||
|
||||
public OfficeTransactionData(final Long id,
|
||||
final LocalDate transactionDate, final Long fromOfficeId,
|
||||
final String fromOfficeName, final Long toOfficeId,
|
||||
final String toOfficeName, final String currencyCode,
|
||||
final Integer digitsAfterDecimal,
|
||||
final BigDecimal transactionAmount, final String description) {
|
||||
this.id = id;
|
||||
this.fromOfficeId = fromOfficeId;
|
||||
this.fromOfficeName = fromOfficeName;
|
||||
this.toOfficeId = toOfficeId;
|
||||
this.toOfficeName = toOfficeName;
|
||||
this.currencyCode = currencyCode;
|
||||
this.digitsAfterDecimal = digitsAfterDecimal;
|
||||
this.transactionAmount = transactionAmount;
|
||||
this.description = description;
|
||||
this.transactionDate = transactionDate;
|
||||
this.currencyOptions = null;
|
||||
this.allowedOffices = null;
|
||||
|
||||
}
|
||||
|
||||
public LocalDate getTransactionDate() {
|
||||
@@ -30,4 +72,41 @@ public class OfficeTransactionData {
|
||||
public List<OfficeLookup> getAllowedOffices() {
|
||||
return allowedOffices;
|
||||
}
|
||||
|
||||
public Long getId() {
|
||||
return id;
|
||||
}
|
||||
|
||||
public Long getFromOfficeId() {
|
||||
return fromOfficeId;
|
||||
}
|
||||
|
||||
public String getFromOfficeName() {
|
||||
return fromOfficeName;
|
||||
}
|
||||
|
||||
public Long getToOfficeId() {
|
||||
return toOfficeId;
|
||||
}
|
||||
|
||||
public String getToOfficeName() {
|
||||
return toOfficeName;
|
||||
}
|
||||
|
||||
public String getCurrencyCode() {
|
||||
return currencyCode;
|
||||
}
|
||||
|
||||
public Integer getDigitsAfterDecimal() {
|
||||
return digitsAfterDecimal;
|
||||
}
|
||||
|
||||
public BigDecimal getTransactionAmount() {
|
||||
return transactionAmount;
|
||||
}
|
||||
|
||||
public String getDescription() {
|
||||
return description;
|
||||
}
|
||||
|
||||
}
|
||||
+2
@@ -48,6 +48,8 @@ public interface ApiJsonSerializerService {
|
||||
|
||||
String serializeOfficeDataToJson(boolean prettyPrint, Set<String> responseParameters, OfficeData office);
|
||||
|
||||
String serializeOfficeTransactionDataToJson(boolean prettyPrint, Set<String> responseParameters, Collection<OfficeTransactionData> officeTransactions);
|
||||
|
||||
String serializeOfficeTransactionDataToJson(boolean prettyPrint, Set<String> responseParameters, OfficeTransactionData officeTransaction);
|
||||
|
||||
String serializeConfigurationDataToJson(boolean prettyPrint, Set<String> responseParameters, ConfigurationData configuration);
|
||||
|
||||
+355
-159
@@ -33,309 +33,505 @@ import org.springframework.stereotype.Service;
|
||||
import com.google.gson.Gson;
|
||||
|
||||
/**
|
||||
* Implementation of {@link ApiJsonSerializerService} that uses google-gson to serialize Java object representation into JSON.
|
||||
* Implementation of {@link ApiJsonSerializerService} that uses google-gson to
|
||||
* serialize Java object representation into JSON.
|
||||
*/
|
||||
@Service
|
||||
public class GoogleGsonApiJsonSerializerService implements ApiJsonSerializerService {
|
||||
public class GoogleGsonApiJsonSerializerService implements
|
||||
ApiJsonSerializerService {
|
||||
|
||||
private static final Set<String> PERMISSION_DATA_PARAMETERS = new HashSet<String>(Arrays.asList("id", "name", "description", "code"));
|
||||
private static final Set<String> ROLE_DATA_PARAMETERS = new HashSet<String>(Arrays.asList("id", "name", "description", "availablePermissions", "selectedPermissions"));
|
||||
private static final Set<String> PERMISSION_DATA_PARAMETERS = new HashSet<String>(
|
||||
Arrays.asList("id", "name", "description", "code"));
|
||||
private static final Set<String> ROLE_DATA_PARAMETERS = new HashSet<String>(
|
||||
Arrays.asList("id", "name", "description", "availablePermissions",
|
||||
"selectedPermissions"));
|
||||
private static final Set<String> APP_USER_DATA_PARAMETERS = new HashSet<String>(
|
||||
Arrays.asList("id", "officeId", "officeName", "username", "firstname", "lastname", "email",
|
||||
"allowedOffices", "availableRoles", "selectedRoles"));
|
||||
Arrays.asList("id", "officeId", "officeName", "username",
|
||||
"firstname", "lastname", "email", "allowedOffices",
|
||||
"availableRoles", "selectedRoles"));
|
||||
private static final Set<String> OFFICE_DATA_PARAMETERS = new HashSet<String>(
|
||||
Arrays.asList("id", "name", "nameDecorated", "externalId", "openingDate",
|
||||
"hierarchy", "parentId", "parentName", "allowedParents")
|
||||
);
|
||||
private static final Set<String> OFFICE_TRANSACTIONS_DATA_PARAMETERS = new HashSet<String>(Arrays.asList("transactionDate", "allowedOffices", "currencyOptions"));
|
||||
private static final Set<String> CONFIGURATION_DATA_PARAMETERS = new HashSet<String>(Arrays.asList("selectedCurrencyOptions", "currencyOptions"));
|
||||
private static final Set<String> FUND_DATA_PARAMETERS = new HashSet<String>(Arrays.asList("id", "name", "externalId"));
|
||||
|
||||
Arrays.asList("id", "name", "nameDecorated", "externalId",
|
||||
"openingDate", "hierarchy", "parentId", "parentName",
|
||||
"allowedParents"));
|
||||
private static final Set<String> OFFICE_TRANSACTIONS_DATA_PARAMETERS = new HashSet<String>(
|
||||
Arrays.asList("id", "transactionDate", "fromOfficeId",
|
||||
"fromOfficeName", "toOfficeId", "toOfficeIdName",
|
||||
"currencyCode", "digitsAfterDecimal", "transactionAmount",
|
||||
"description", "allowedOffices", "currencyOptions"));
|
||||
private static final Set<String> CONFIGURATION_DATA_PARAMETERS = new HashSet<String>(
|
||||
Arrays.asList("selectedCurrencyOptions", "currencyOptions"));
|
||||
private static final Set<String> FUND_DATA_PARAMETERS = new HashSet<String>(
|
||||
Arrays.asList("id", "name", "externalId"));
|
||||
|
||||
private static final Set<String> LOAN_PRODUCT_DATA_PARAMETERS = new HashSet<String>(
|
||||
Arrays.asList("id", "name", "description", "fundId", "fundName", "transactionProcessingStrategyId", "transactionProcessingStrategyName",
|
||||
"principal", "inArrearsTolerance", "numberOfRepayments",
|
||||
"repaymentEvery", "interestRatePerPeriod", "annualInterestRate",
|
||||
"repaymentFrequencyType", "interestRateFrequencyType", "amortizationType", "interestType", "interestCalculationPeriodType",
|
||||
"createdOn", "lastModifedOn",
|
||||
"currencyOptions", "amortizationTypeOptions", "interestTypeOptions", "interestCalculationPeriodTypeOptions",
|
||||
"repaymentFrequencyTypeOptions", "interestRateFrequencyTypeOptions", "fundOptions", "transactionProcessingStrategyOptions")
|
||||
);
|
||||
|
||||
Arrays.asList("id", "name", "description", "fundId", "fundName",
|
||||
"transactionProcessingStrategyId",
|
||||
"transactionProcessingStrategyName", "principal",
|
||||
"inArrearsTolerance", "numberOfRepayments",
|
||||
"repaymentEvery", "interestRatePerPeriod",
|
||||
"annualInterestRate", "repaymentFrequencyType",
|
||||
"interestRateFrequencyType", "amortizationType",
|
||||
"interestType", "interestCalculationPeriodType",
|
||||
"createdOn", "lastModifedOn", "currencyOptions",
|
||||
"amortizationTypeOptions", "interestTypeOptions",
|
||||
"interestCalculationPeriodTypeOptions",
|
||||
"repaymentFrequencyTypeOptions",
|
||||
"interestRateFrequencyTypeOptions", "fundOptions",
|
||||
"transactionProcessingStrategyOptions"));
|
||||
|
||||
private static final Set<String> SAVINGS_PRODUCT_DATA_PARAMETERS = new HashSet<String>(
|
||||
Arrays.asList("id", "name", "description","createdOn", "lastModifedOn","interestRate","currencyCode","digitsAfterDecimal",
|
||||
"currencyOptions", "minimumBalance","maximumBalance")
|
||||
);
|
||||
Arrays.asList("id", "name", "description", "createdOn",
|
||||
"lastModifedOn", "interestRate", "currencyCode",
|
||||
"digitsAfterDecimal", "currencyOptions", "minimumBalance",
|
||||
"maximumBalance"));
|
||||
|
||||
private static final Set<String> SAVINGS_DEPOSIT_PRODUCT_DATA_PARAMETERS = new HashSet<String>(
|
||||
Arrays.asList("currencyOptions", "interestCompoundedEveryPeriodTypeOptions",
|
||||
"id", "externalId", "name", "description","createdOn", "lastModifedOn","currencyCode","digitsAfterDecimal",
|
||||
"minimumBalance","maximumBalance","tenureInMonths","maturityDefaultInterestRate","maturityMinInterestRate",
|
||||
"maturityMaxInterestRate", "interestCompoundedEvery", "interestCompoundedEveryPeriodType",
|
||||
"renewalAllowed","preClosureAllowed","preClosureInterestRate")
|
||||
);
|
||||
Arrays.asList("currencyOptions",
|
||||
"interestCompoundedEveryPeriodTypeOptions", "id",
|
||||
"externalId", "name", "description", "createdOn",
|
||||
"lastModifedOn", "currencyCode", "digitsAfterDecimal",
|
||||
"minimumBalance", "maximumBalance", "tenureInMonths",
|
||||
"maturityDefaultInterestRate", "maturityMinInterestRate",
|
||||
"maturityMaxInterestRate", "interestCompoundedEvery",
|
||||
"interestCompoundedEveryPeriodType", "renewalAllowed",
|
||||
"preClosureAllowed", "preClosureInterestRate"));
|
||||
|
||||
private static final Set<String> SAVINGS_DEPOSIT_ACCOUNT_DATA_PARAMETERS = new HashSet<String>(
|
||||
Arrays.asList("productOptions", "interestCompoundedEveryPeriodTypeOptions",
|
||||
"createdOn", "lastModifedOn",
|
||||
"id", "externalId", "clientId", "clientName", "productId", "productName",
|
||||
"currency", "deposit", "maturityInterestRate", "tenureInMonths",
|
||||
"interestCompoundedEvery", "interestCompoundedEveryPeriodType",
|
||||
"renewalAllowed","preClosureAllowed","preClosureInterestRate"
|
||||
)
|
||||
);
|
||||
|
||||
Arrays.asList("productOptions",
|
||||
"interestCompoundedEveryPeriodTypeOptions", "createdOn",
|
||||
"lastModifedOn", "id", "externalId", "clientId",
|
||||
"clientName", "productId", "productName", "currency",
|
||||
"deposit", "maturityInterestRate", "tenureInMonths",
|
||||
"interestCompoundedEvery",
|
||||
"interestCompoundedEveryPeriodType", "renewalAllowed",
|
||||
"preClosureAllowed", "preClosureInterestRate"));
|
||||
|
||||
private static final Set<String> CLIENT_DATA_PARAMETERS = new HashSet<String>(
|
||||
Arrays.asList("id", "officeId", "officeName", "externalId", "firstname", "lastname", "joinedDate", "displayName", "clientOrBusinessName", "allowedOffices")
|
||||
);
|
||||
|
||||
Arrays.asList("id", "officeId", "officeName", "externalId",
|
||||
"firstname", "lastname", "joinedDate", "displayName",
|
||||
"clientOrBusinessName", "allowedOffices"));
|
||||
|
||||
private static final Set<String> CLIENT_ACCOUNTS_DATA_PARAMETERS = new HashSet<String>(
|
||||
Arrays.asList("pendingApprovalLoans", "awaitingDisbursalLoans", "openLoans", "closedLoans",
|
||||
"anyLoanCount", "pendingApprovalLoanCount", "awaitingDisbursalLoanCount", "activeLoanCount", "closedLoanCount",
|
||||
"pendingApprovalDespositAccountsCount", "pendingApprovalDespositAccounts", "approvedDespositAccountsCount", "approvedDespositAccounts")
|
||||
);
|
||||
Arrays.asList("pendingApprovalLoans", "awaitingDisbursalLoans",
|
||||
"openLoans", "closedLoans", "anyLoanCount",
|
||||
"pendingApprovalLoanCount", "awaitingDisbursalLoanCount",
|
||||
"activeLoanCount", "closedLoanCount",
|
||||
"pendingApprovalDespositAccountsCount",
|
||||
"pendingApprovalDespositAccounts",
|
||||
"approvedDespositAccountsCount", "approvedDespositAccounts"));
|
||||
|
||||
private static final Set<String> GROUP_DATA_PARAMETERS = new HashSet<String>(
|
||||
Arrays.asList("id", "name", "externalId", "clientMembers", "allowedClients")
|
||||
);
|
||||
|
||||
Arrays.asList("id", "name", "externalId", "clientMembers",
|
||||
"allowedClients"));
|
||||
|
||||
private static final Set<String> NOTE_DATA_PARAMETERS = new HashSet<String>(
|
||||
Arrays.asList("id", "clientId", "loanId", "loanTransactionId", "noteType", "note", "createdById", "createdByUsername",
|
||||
"createdOn", "updatedById", "updatedByUsername", "updatedOn")
|
||||
);
|
||||
Arrays.asList("id", "clientId", "loanId", "loanTransactionId",
|
||||
"noteType", "note", "createdById", "createdByUsername",
|
||||
"createdOn", "updatedById", "updatedByUsername",
|
||||
"updatedOn"));
|
||||
|
||||
private static final Set<String> NEW_LOAN_DATA_PARAMETERS = new HashSet<String>(
|
||||
Arrays.asList("clientId", "clientName", "productId", "productName",
|
||||
"selectedProduct", "expectedDisbursementDate", "allowedProducts")
|
||||
);
|
||||
"selectedProduct", "expectedDisbursementDate",
|
||||
"allowedProducts"));
|
||||
|
||||
private static final Set<String> LOAN_DATA_PARAMETERS = new HashSet<String>(
|
||||
Arrays.asList("id", "externalId", "fundId", "fundName", "loanProductId", "loanProductName", "principal", "inArrearsTolerance", "numberOfRepayments",
|
||||
"repaymentEvery", "interestRatePerPeriod", "annualInterestRate",
|
||||
"repaymentFrequencyType", "interestRateFrequencyType", "amortizationType", "interestType", "interestCalculationPeriodType",
|
||||
"submittedOnDate", "approvedOnDate", "expectedDisbursementDate", "actualDisbursementDate",
|
||||
"expectedFirstRepaymentOnDate", "interestChargedFromDate", "closedOnDate", "expectedMaturityDate",
|
||||
"lifeCycleStatusId", "lifeCycleStatusText", "lifeCycleStatusDate",
|
||||
"summary", "repaymentSchedule", "loanRepayments", "permissions", "convenienceData")
|
||||
);
|
||||
Arrays.asList("id", "externalId", "fundId", "fundName",
|
||||
"loanProductId", "loanProductName", "principal",
|
||||
"inArrearsTolerance", "numberOfRepayments",
|
||||
"repaymentEvery", "interestRatePerPeriod",
|
||||
"annualInterestRate", "repaymentFrequencyType",
|
||||
"interestRateFrequencyType", "amortizationType",
|
||||
"interestType", "interestCalculationPeriodType",
|
||||
"submittedOnDate", "approvedOnDate",
|
||||
"expectedDisbursementDate", "actualDisbursementDate",
|
||||
"expectedFirstRepaymentOnDate", "interestChargedFromDate",
|
||||
"closedOnDate", "expectedMaturityDate",
|
||||
"lifeCycleStatusId", "lifeCycleStatusText",
|
||||
"lifeCycleStatusDate", "summary", "repaymentSchedule",
|
||||
"loanRepayments", "permissions", "convenienceData"));
|
||||
|
||||
private static final Set<String> LOAN_TRANSACTION_DATA_PARAMETERS = new HashSet<String>(
|
||||
Arrays.asList("id", "transactionType", "date", "principal", "interest", "total", "totalWaived", "overpaid")
|
||||
);
|
||||
Arrays.asList("id", "transactionType", "date", "principal",
|
||||
"interest", "total", "totalWaived", "overpaid"));
|
||||
|
||||
private static final Set<String> CHARGES_DATA_PARAMETERS = new HashSet<String>(
|
||||
Arrays.asList("id", "name", "amount", "currency", "active", "chargeAppliesTo", "chargeTimeType",
|
||||
"chargeCalculationType", "chargeCalculationTypeOptions", "currencyOptions")
|
||||
);
|
||||
|
||||
Arrays.asList("id", "name", "amount", "currency", "active",
|
||||
"chargeAppliesTo", "chargeTimeType",
|
||||
"chargeCalculationType", "chargeCalculationTypeOptions",
|
||||
"currencyOptions"));
|
||||
|
||||
private final GoogleGsonSerializerHelper helper;
|
||||
|
||||
|
||||
@Autowired
|
||||
public GoogleGsonApiJsonSerializerService(final GoogleGsonSerializerHelper helper) {
|
||||
public GoogleGsonApiJsonSerializerService(
|
||||
final GoogleGsonSerializerHelper helper) {
|
||||
this.helper = helper;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String serializeAuthenticatedUserDataToJson(final boolean prettyPrint, final AuthenticatedUserData authenticatedUserData) {
|
||||
final Gson gsonDeserializer = helper.createGsonBuilder(prettyPrint);
|
||||
return helper.serializedJsonFrom(gsonDeserializer, authenticatedUserData);
|
||||
}
|
||||
|
||||
@Override
|
||||
public String serializeGenericResultsetDataToJson(final boolean prettyPrint, final GenericResultsetData resultsetData) {
|
||||
public String serializeAuthenticatedUserDataToJson(
|
||||
final boolean prettyPrint,
|
||||
final AuthenticatedUserData authenticatedUserData) {
|
||||
final Gson gsonDeserializer = helper.createGsonBuilder(prettyPrint);
|
||||
return helper.serializedJsonFrom(gsonDeserializer,
|
||||
authenticatedUserData);
|
||||
}
|
||||
|
||||
@Override
|
||||
public String serializeGenericResultsetDataToJson(
|
||||
final boolean prettyPrint, final GenericResultsetData resultsetData) {
|
||||
final Gson gsonDeserializer = helper.createGsonBuilder(prettyPrint);
|
||||
return helper.serializedJsonFrom(gsonDeserializer, resultsetData);
|
||||
}
|
||||
|
||||
@Override
|
||||
public String serializeAdditionalFieldsSetDataToJson(final boolean prettyPrint, final Collection<AdditionalFieldsSetData> datasets) {
|
||||
public String serializeAdditionalFieldsSetDataToJson(
|
||||
final boolean prettyPrint,
|
||||
final Collection<AdditionalFieldsSetData> datasets) {
|
||||
final Gson gsonDeserializer = helper.createGsonBuilder(prettyPrint);
|
||||
return helper.serializedJsonFrom(gsonDeserializer, datasets.toArray(new AdditionalFieldsSetData[datasets.size()]));
|
||||
return helper.serializedJsonFrom(gsonDeserializer,
|
||||
datasets.toArray(new AdditionalFieldsSetData[datasets.size()]));
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public String serializePermissionDataToJson(final boolean prettyPrint, final Set<String> responseParameters, final Collection<PermissionData> permissions) {
|
||||
final Gson gsonDeserializer = helper.createGsonBuilderWithParameterExclusionSerializationStrategy(PERMISSION_DATA_PARAMETERS, prettyPrint, responseParameters);
|
||||
return helper.serializedJsonFrom(gsonDeserializer, permissions.toArray(new PermissionData[permissions.size()]));
|
||||
public String serializePermissionDataToJson(final boolean prettyPrint,
|
||||
final Set<String> responseParameters,
|
||||
final Collection<PermissionData> permissions) {
|
||||
final Gson gsonDeserializer = helper
|
||||
.createGsonBuilderWithParameterExclusionSerializationStrategy(
|
||||
PERMISSION_DATA_PARAMETERS, prettyPrint,
|
||||
responseParameters);
|
||||
return helper.serializedJsonFrom(gsonDeserializer,
|
||||
permissions.toArray(new PermissionData[permissions.size()]));
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public String serializeRoleDataToJson(final boolean prettyPrint, final Set<String> responseParameters, final Collection<RoleData> roles) {
|
||||
final Gson gsonDeserializer = helper.createGsonBuilderWithParameterExclusionSerializationStrategy(ROLE_DATA_PARAMETERS, prettyPrint, responseParameters);
|
||||
return helper.serializedJsonFrom(gsonDeserializer, roles.toArray(new RoleData[roles.size()]));
|
||||
public String serializeRoleDataToJson(final boolean prettyPrint,
|
||||
final Set<String> responseParameters,
|
||||
final Collection<RoleData> roles) {
|
||||
final Gson gsonDeserializer = helper
|
||||
.createGsonBuilderWithParameterExclusionSerializationStrategy(
|
||||
ROLE_DATA_PARAMETERS, prettyPrint, responseParameters);
|
||||
return helper.serializedJsonFrom(gsonDeserializer,
|
||||
roles.toArray(new RoleData[roles.size()]));
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public String serializeRoleDataToJson(final boolean prettyPrint, final Set<String> responseParameters, final RoleData role) {
|
||||
final Gson gsonDeserializer = helper.createGsonBuilderWithParameterExclusionSerializationStrategy(ROLE_DATA_PARAMETERS, prettyPrint, responseParameters);
|
||||
public String serializeRoleDataToJson(final boolean prettyPrint,
|
||||
final Set<String> responseParameters, final RoleData role) {
|
||||
final Gson gsonDeserializer = helper
|
||||
.createGsonBuilderWithParameterExclusionSerializationStrategy(
|
||||
ROLE_DATA_PARAMETERS, prettyPrint, responseParameters);
|
||||
return helper.serializedJsonFrom(gsonDeserializer, role);
|
||||
}
|
||||
|
||||
@Override
|
||||
public String serializeAppUserDataToJson(final boolean prettyPrint, final Set<String> responseParameters, final Collection<AppUserData> users) {
|
||||
final Gson gsonDeserializer = helper.createGsonBuilderWithParameterExclusionSerializationStrategy(APP_USER_DATA_PARAMETERS, prettyPrint, responseParameters);
|
||||
return helper.serializedJsonFrom(gsonDeserializer, users.toArray(new AppUserData[users.size()]));
|
||||
public String serializeAppUserDataToJson(final boolean prettyPrint,
|
||||
final Set<String> responseParameters,
|
||||
final Collection<AppUserData> users) {
|
||||
final Gson gsonDeserializer = helper
|
||||
.createGsonBuilderWithParameterExclusionSerializationStrategy(
|
||||
APP_USER_DATA_PARAMETERS, prettyPrint,
|
||||
responseParameters);
|
||||
return helper.serializedJsonFrom(gsonDeserializer,
|
||||
users.toArray(new AppUserData[users.size()]));
|
||||
}
|
||||
|
||||
@Override
|
||||
public String serializeAppUserDataToJson(final boolean prettyPrint, final Set<String> responseParameters, final AppUserData user) {
|
||||
final Gson gsonDeserializer = helper.createGsonBuilderWithParameterExclusionSerializationStrategy(APP_USER_DATA_PARAMETERS, prettyPrint, responseParameters);
|
||||
public String serializeAppUserDataToJson(final boolean prettyPrint,
|
||||
final Set<String> responseParameters, final AppUserData user) {
|
||||
final Gson gsonDeserializer = helper
|
||||
.createGsonBuilderWithParameterExclusionSerializationStrategy(
|
||||
APP_USER_DATA_PARAMETERS, prettyPrint,
|
||||
responseParameters);
|
||||
return helper.serializedJsonFrom(gsonDeserializer, user);
|
||||
}
|
||||
|
||||
@Override
|
||||
public String serializeOfficeDataToJson(final boolean prettyPrint, final Set<String> responseParameters, final Collection<OfficeData> offices) {
|
||||
final Gson gsonDeserializer = helper.createGsonBuilderWithParameterExclusionSerializationStrategy(OFFICE_DATA_PARAMETERS, prettyPrint, responseParameters);
|
||||
return helper.serializedJsonFrom(gsonDeserializer, offices.toArray(new OfficeData[offices.size()]));
|
||||
public String serializeOfficeDataToJson(final boolean prettyPrint,
|
||||
final Set<String> responseParameters,
|
||||
final Collection<OfficeData> offices) {
|
||||
final Gson gsonDeserializer = helper
|
||||
.createGsonBuilderWithParameterExclusionSerializationStrategy(
|
||||
OFFICE_DATA_PARAMETERS, prettyPrint, responseParameters);
|
||||
return helper.serializedJsonFrom(gsonDeserializer,
|
||||
offices.toArray(new OfficeData[offices.size()]));
|
||||
}
|
||||
|
||||
@Override
|
||||
public String serializeOfficeDataToJson(final boolean prettyPrint, final Set<String> responseParameters, final OfficeData office) {
|
||||
final Gson gsonDeserializer = helper.createGsonBuilderWithParameterExclusionSerializationStrategy(OFFICE_DATA_PARAMETERS, prettyPrint, responseParameters);
|
||||
public String serializeOfficeDataToJson(final boolean prettyPrint,
|
||||
final Set<String> responseParameters, final OfficeData office) {
|
||||
final Gson gsonDeserializer = helper
|
||||
.createGsonBuilderWithParameterExclusionSerializationStrategy(
|
||||
OFFICE_DATA_PARAMETERS, prettyPrint, responseParameters);
|
||||
return helper.serializedJsonFrom(gsonDeserializer, office);
|
||||
}
|
||||
|
||||
@Override
|
||||
public String serializeOfficeTransactionDataToJson(final boolean prettyPrint, final Set<String> responseParameters, final OfficeTransactionData officeTransaction) {
|
||||
final Gson gsonDeserializer = helper.createGsonBuilderWithParameterExclusionSerializationStrategy(OFFICE_TRANSACTIONS_DATA_PARAMETERS, prettyPrint, responseParameters);
|
||||
public String serializeOfficeTransactionDataToJson(
|
||||
final boolean prettyPrint, final Set<String> responseParameters,
|
||||
final Collection<OfficeTransactionData> officeTransactions) {
|
||||
final Gson gsonDeserializer = helper
|
||||
.createGsonBuilderWithParameterExclusionSerializationStrategy(
|
||||
OFFICE_TRANSACTIONS_DATA_PARAMETERS, prettyPrint,
|
||||
responseParameters);
|
||||
return helper.serializedJsonFrom(gsonDeserializer, officeTransactions);
|
||||
}
|
||||
|
||||
@Override
|
||||
public String serializeOfficeTransactionDataToJson(
|
||||
final boolean prettyPrint, final Set<String> responseParameters,
|
||||
final OfficeTransactionData officeTransaction) {
|
||||
final Gson gsonDeserializer = helper
|
||||
.createGsonBuilderWithParameterExclusionSerializationStrategy(
|
||||
OFFICE_TRANSACTIONS_DATA_PARAMETERS, prettyPrint,
|
||||
responseParameters);
|
||||
return helper.serializedJsonFrom(gsonDeserializer, officeTransaction);
|
||||
}
|
||||
|
||||
@Override
|
||||
public String serializeConfigurationDataToJson(final boolean prettyPrint, final Set<String> responseParameters, final ConfigurationData configuration) {
|
||||
final Gson gsonDeserializer = helper.createGsonBuilderWithParameterExclusionSerializationStrategy(CONFIGURATION_DATA_PARAMETERS, prettyPrint, responseParameters);
|
||||
public String serializeConfigurationDataToJson(final boolean prettyPrint,
|
||||
final Set<String> responseParameters,
|
||||
final ConfigurationData configuration) {
|
||||
final Gson gsonDeserializer = helper
|
||||
.createGsonBuilderWithParameterExclusionSerializationStrategy(
|
||||
CONFIGURATION_DATA_PARAMETERS, prettyPrint,
|
||||
responseParameters);
|
||||
return helper.serializedJsonFrom(gsonDeserializer, configuration);
|
||||
}
|
||||
|
||||
@Override
|
||||
public String serializeFundDataToJson(final boolean prettyPrint, final Set<String> responseParameters, final Collection<FundData> funds) {
|
||||
final Gson gsonDeserializer = helper.createGsonBuilderWithParameterExclusionSerializationStrategy(FUND_DATA_PARAMETERS, prettyPrint, responseParameters);
|
||||
return helper.serializedJsonFrom(gsonDeserializer, funds.toArray(new FundData[funds.size()]));
|
||||
public String serializeFundDataToJson(final boolean prettyPrint,
|
||||
final Set<String> responseParameters,
|
||||
final Collection<FundData> funds) {
|
||||
final Gson gsonDeserializer = helper
|
||||
.createGsonBuilderWithParameterExclusionSerializationStrategy(
|
||||
FUND_DATA_PARAMETERS, prettyPrint, responseParameters);
|
||||
return helper.serializedJsonFrom(gsonDeserializer,
|
||||
funds.toArray(new FundData[funds.size()]));
|
||||
}
|
||||
|
||||
@Override
|
||||
public String serializeFundDataToJson(final boolean prettyPrint, final Set<String> responseParameters, final FundData fund) {
|
||||
final Gson gsonDeserializer = helper.createGsonBuilderWithParameterExclusionSerializationStrategy(FUND_DATA_PARAMETERS, prettyPrint, responseParameters);
|
||||
public String serializeFundDataToJson(final boolean prettyPrint,
|
||||
final Set<String> responseParameters, final FundData fund) {
|
||||
final Gson gsonDeserializer = helper
|
||||
.createGsonBuilderWithParameterExclusionSerializationStrategy(
|
||||
FUND_DATA_PARAMETERS, prettyPrint, responseParameters);
|
||||
return helper.serializedJsonFrom(gsonDeserializer, fund);
|
||||
}
|
||||
|
||||
@Override
|
||||
public String serializeLoanProductDataToJson(final boolean prettyPrint, final Set<String> responseParameters, final Collection<LoanProductData> products) {
|
||||
final Gson gsonDeserializer = helper.createGsonBuilderWithParameterExclusionSerializationStrategy(LOAN_PRODUCT_DATA_PARAMETERS, prettyPrint, responseParameters);
|
||||
return helper.serializedJsonFrom(gsonDeserializer, products.toArray(new LoanProductData[products.size()]));
|
||||
public String serializeLoanProductDataToJson(final boolean prettyPrint,
|
||||
final Set<String> responseParameters,
|
||||
final Collection<LoanProductData> products) {
|
||||
final Gson gsonDeserializer = helper
|
||||
.createGsonBuilderWithParameterExclusionSerializationStrategy(
|
||||
LOAN_PRODUCT_DATA_PARAMETERS, prettyPrint,
|
||||
responseParameters);
|
||||
return helper.serializedJsonFrom(gsonDeserializer,
|
||||
products.toArray(new LoanProductData[products.size()]));
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public String serializeLoanProductDataToJson(final boolean prettyPrint, final Set<String> responseParameters, final LoanProductData product) {
|
||||
final Gson gsonDeserializer = helper.createGsonBuilderWithParameterExclusionSerializationStrategy(LOAN_PRODUCT_DATA_PARAMETERS, prettyPrint, responseParameters);
|
||||
public String serializeLoanProductDataToJson(final boolean prettyPrint,
|
||||
final Set<String> responseParameters, final LoanProductData product) {
|
||||
final Gson gsonDeserializer = helper
|
||||
.createGsonBuilderWithParameterExclusionSerializationStrategy(
|
||||
LOAN_PRODUCT_DATA_PARAMETERS, prettyPrint,
|
||||
responseParameters);
|
||||
return helper.serializedJsonFrom(gsonDeserializer, product);
|
||||
}
|
||||
|
||||
@Override
|
||||
public String serializeSavingProductDataToJson(final boolean prettyPrint, final Set<String> responseParameters, final Collection<SavingProductData> products) {
|
||||
final Gson gsonDeserializer = helper.createGsonBuilderWithParameterExclusionSerializationStrategy(SAVINGS_PRODUCT_DATA_PARAMETERS, prettyPrint, responseParameters);
|
||||
return helper.serializedJsonFrom(gsonDeserializer, products.toArray(new SavingProductData[products.size()]));
|
||||
public String serializeSavingProductDataToJson(final boolean prettyPrint,
|
||||
final Set<String> responseParameters,
|
||||
final Collection<SavingProductData> products) {
|
||||
final Gson gsonDeserializer = helper
|
||||
.createGsonBuilderWithParameterExclusionSerializationStrategy(
|
||||
SAVINGS_PRODUCT_DATA_PARAMETERS, prettyPrint,
|
||||
responseParameters);
|
||||
return helper.serializedJsonFrom(gsonDeserializer,
|
||||
products.toArray(new SavingProductData[products.size()]));
|
||||
}
|
||||
|
||||
@Override
|
||||
public String serializeSavingProductDataToJson(final boolean prettyPrint, final Set<String> responseParameters, final SavingProductData savingProduct) {
|
||||
final Gson gsonDeserializer = helper.createGsonBuilderWithParameterExclusionSerializationStrategy(SAVINGS_PRODUCT_DATA_PARAMETERS, prettyPrint, responseParameters);
|
||||
public String serializeSavingProductDataToJson(final boolean prettyPrint,
|
||||
final Set<String> responseParameters,
|
||||
final SavingProductData savingProduct) {
|
||||
final Gson gsonDeserializer = helper
|
||||
.createGsonBuilderWithParameterExclusionSerializationStrategy(
|
||||
SAVINGS_PRODUCT_DATA_PARAMETERS, prettyPrint,
|
||||
responseParameters);
|
||||
return helper.serializedJsonFrom(gsonDeserializer, savingProduct);
|
||||
}
|
||||
|
||||
@Override
|
||||
public String serializeDepositProductDataToJson(final boolean prettyPrint, final Set<String> responseParameters, final Collection<DepositProductData> products) {
|
||||
final Gson gsonDeserializer = helper.createGsonBuilderWithParameterExclusionSerializationStrategy(SAVINGS_DEPOSIT_PRODUCT_DATA_PARAMETERS, prettyPrint, responseParameters);
|
||||
return helper.serializedJsonFrom(gsonDeserializer, products.toArray(new DepositProductData[products.size()]));
|
||||
public String serializeDepositProductDataToJson(final boolean prettyPrint,
|
||||
final Set<String> responseParameters,
|
||||
final Collection<DepositProductData> products) {
|
||||
final Gson gsonDeserializer = helper
|
||||
.createGsonBuilderWithParameterExclusionSerializationStrategy(
|
||||
SAVINGS_DEPOSIT_PRODUCT_DATA_PARAMETERS, prettyPrint,
|
||||
responseParameters);
|
||||
return helper.serializedJsonFrom(gsonDeserializer,
|
||||
products.toArray(new DepositProductData[products.size()]));
|
||||
}
|
||||
|
||||
@Override
|
||||
public String serializeDepositProductDataToJson(final boolean prettyPrint, final Set<String> responseParameters, final DepositProductData depositProduct) {
|
||||
final Gson gsonDeserializer = helper.createGsonBuilderWithParameterExclusionSerializationStrategy(SAVINGS_DEPOSIT_PRODUCT_DATA_PARAMETERS, prettyPrint, responseParameters);
|
||||
public String serializeDepositProductDataToJson(final boolean prettyPrint,
|
||||
final Set<String> responseParameters,
|
||||
final DepositProductData depositProduct) {
|
||||
final Gson gsonDeserializer = helper
|
||||
.createGsonBuilderWithParameterExclusionSerializationStrategy(
|
||||
SAVINGS_DEPOSIT_PRODUCT_DATA_PARAMETERS, prettyPrint,
|
||||
responseParameters);
|
||||
return helper.serializedJsonFrom(gsonDeserializer, depositProduct);
|
||||
}
|
||||
|
||||
@Override
|
||||
public String serializeDepositAccountDataToJson(final boolean prettyPrint, final Set<String> responseParameters, final Collection<DepositAccountData> accounts) {
|
||||
final Gson gsonDeserializer = helper.createGsonBuilderWithParameterExclusionSerializationStrategy(SAVINGS_DEPOSIT_ACCOUNT_DATA_PARAMETERS, prettyPrint, responseParameters);
|
||||
return helper.serializedJsonFrom(gsonDeserializer, accounts.toArray(new DepositAccountData[accounts.size()]));
|
||||
public String serializeDepositAccountDataToJson(final boolean prettyPrint,
|
||||
final Set<String> responseParameters,
|
||||
final Collection<DepositAccountData> accounts) {
|
||||
final Gson gsonDeserializer = helper
|
||||
.createGsonBuilderWithParameterExclusionSerializationStrategy(
|
||||
SAVINGS_DEPOSIT_ACCOUNT_DATA_PARAMETERS, prettyPrint,
|
||||
responseParameters);
|
||||
return helper.serializedJsonFrom(gsonDeserializer,
|
||||
accounts.toArray(new DepositAccountData[accounts.size()]));
|
||||
}
|
||||
|
||||
@Override
|
||||
public String serializeDepositAccountDataToJson(final boolean prettyPrint, final Set<String> responseParameters, final DepositAccountData account) {
|
||||
final Gson gsonDeserializer = helper.createGsonBuilderWithParameterExclusionSerializationStrategy(SAVINGS_DEPOSIT_ACCOUNT_DATA_PARAMETERS, prettyPrint, responseParameters);
|
||||
public String serializeDepositAccountDataToJson(final boolean prettyPrint,
|
||||
final Set<String> responseParameters,
|
||||
final DepositAccountData account) {
|
||||
final Gson gsonDeserializer = helper
|
||||
.createGsonBuilderWithParameterExclusionSerializationStrategy(
|
||||
SAVINGS_DEPOSIT_ACCOUNT_DATA_PARAMETERS, prettyPrint,
|
||||
responseParameters);
|
||||
return helper.serializedJsonFrom(gsonDeserializer, account);
|
||||
}
|
||||
|
||||
@Override
|
||||
public String serializeClientDataToJson(final boolean prettyPrint, final Set<String> responseParameters, final Collection<ClientData> clients) {
|
||||
final Gson gsonDeserializer = helper.createGsonBuilderWithParameterExclusionSerializationStrategy(CLIENT_DATA_PARAMETERS, prettyPrint, responseParameters);
|
||||
return helper.serializedJsonFrom(gsonDeserializer, clients.toArray(new ClientData[clients.size()]));
|
||||
public String serializeClientDataToJson(final boolean prettyPrint,
|
||||
final Set<String> responseParameters,
|
||||
final Collection<ClientData> clients) {
|
||||
final Gson gsonDeserializer = helper
|
||||
.createGsonBuilderWithParameterExclusionSerializationStrategy(
|
||||
CLIENT_DATA_PARAMETERS, prettyPrint, responseParameters);
|
||||
return helper.serializedJsonFrom(gsonDeserializer,
|
||||
clients.toArray(new ClientData[clients.size()]));
|
||||
}
|
||||
|
||||
@Override
|
||||
public String serializeClientDataToJson(final boolean prettyPrint, final Set<String> responseParameters, final ClientData client) {
|
||||
final Gson gsonDeserializer = helper.createGsonBuilderWithParameterExclusionSerializationStrategy(CLIENT_DATA_PARAMETERS, prettyPrint, responseParameters);
|
||||
public String serializeClientDataToJson(final boolean prettyPrint,
|
||||
final Set<String> responseParameters, final ClientData client) {
|
||||
final Gson gsonDeserializer = helper
|
||||
.createGsonBuilderWithParameterExclusionSerializationStrategy(
|
||||
CLIENT_DATA_PARAMETERS, prettyPrint, responseParameters);
|
||||
return helper.serializedJsonFrom(gsonDeserializer, client);
|
||||
}
|
||||
|
||||
@Override
|
||||
public String serializeClientAccountSummaryCollectionDataToJson(final boolean prettyPrint, final Set<String> responseParameters,
|
||||
public String serializeClientAccountSummaryCollectionDataToJson(
|
||||
final boolean prettyPrint, final Set<String> responseParameters,
|
||||
final ClientAccountSummaryCollectionData clientAccount) {
|
||||
final Gson gsonDeserializer = helper.createGsonBuilderWithParameterExclusionSerializationStrategy(CLIENT_ACCOUNTS_DATA_PARAMETERS, prettyPrint, responseParameters);
|
||||
final Gson gsonDeserializer = helper
|
||||
.createGsonBuilderWithParameterExclusionSerializationStrategy(
|
||||
CLIENT_ACCOUNTS_DATA_PARAMETERS, prettyPrint,
|
||||
responseParameters);
|
||||
return helper.serializedJsonFrom(gsonDeserializer, clientAccount);
|
||||
}
|
||||
|
||||
@Override
|
||||
public String serializeGroupDataToJson(final boolean prettyPrint, final Set<String> responseParameters, final Collection<GroupData> groups) {
|
||||
final Gson gsonDeserializer = helper.createGsonBuilderWithParameterExclusionSerializationStrategy(GROUP_DATA_PARAMETERS, prettyPrint, responseParameters);
|
||||
return helper.serializedJsonFrom(gsonDeserializer, groups.toArray(new GroupData[groups.size()]));
|
||||
public String serializeGroupDataToJson(final boolean prettyPrint,
|
||||
final Set<String> responseParameters,
|
||||
final Collection<GroupData> groups) {
|
||||
final Gson gsonDeserializer = helper
|
||||
.createGsonBuilderWithParameterExclusionSerializationStrategy(
|
||||
GROUP_DATA_PARAMETERS, prettyPrint, responseParameters);
|
||||
return helper.serializedJsonFrom(gsonDeserializer,
|
||||
groups.toArray(new GroupData[groups.size()]));
|
||||
}
|
||||
|
||||
@Override
|
||||
public String serializeGroupDataToJson(final boolean prettyPrint, final Set<String> responseParameters, final GroupData group) {
|
||||
final Gson gsonDeserializer = helper.createGsonBuilderWithParameterExclusionSerializationStrategy(GROUP_DATA_PARAMETERS, prettyPrint, responseParameters);
|
||||
public String serializeGroupDataToJson(final boolean prettyPrint,
|
||||
final Set<String> responseParameters, final GroupData group) {
|
||||
final Gson gsonDeserializer = helper
|
||||
.createGsonBuilderWithParameterExclusionSerializationStrategy(
|
||||
GROUP_DATA_PARAMETERS, prettyPrint, responseParameters);
|
||||
return helper.serializedJsonFrom(gsonDeserializer, group);
|
||||
}
|
||||
|
||||
@Override
|
||||
public String serializeNoteDataToJson(boolean prettyPrint, Set<String> responseParameters, Collection<NoteData> notes) {
|
||||
final Gson gsonDeserializer = helper.createGsonBuilderWithParameterExclusionSerializationStrategy(NOTE_DATA_PARAMETERS, prettyPrint, responseParameters);
|
||||
return helper.serializedJsonFrom(gsonDeserializer, notes.toArray(new NoteData[notes.size()]));
|
||||
public String serializeNoteDataToJson(boolean prettyPrint,
|
||||
Set<String> responseParameters, Collection<NoteData> notes) {
|
||||
final Gson gsonDeserializer = helper
|
||||
.createGsonBuilderWithParameterExclusionSerializationStrategy(
|
||||
NOTE_DATA_PARAMETERS, prettyPrint, responseParameters);
|
||||
return helper.serializedJsonFrom(gsonDeserializer,
|
||||
notes.toArray(new NoteData[notes.size()]));
|
||||
}
|
||||
|
||||
@Override
|
||||
public String serializeNoteDataToJson(final boolean prettyPrint, final Set<String> responseParameters, final NoteData note) {
|
||||
final Gson gsonDeserializer = helper.createGsonBuilderWithParameterExclusionSerializationStrategy(NOTE_DATA_PARAMETERS, prettyPrint, responseParameters);
|
||||
public String serializeNoteDataToJson(final boolean prettyPrint,
|
||||
final Set<String> responseParameters, final NoteData note) {
|
||||
final Gson gsonDeserializer = helper
|
||||
.createGsonBuilderWithParameterExclusionSerializationStrategy(
|
||||
NOTE_DATA_PARAMETERS, prettyPrint, responseParameters);
|
||||
return helper.serializedJsonFrom(gsonDeserializer, note);
|
||||
}
|
||||
|
||||
@Override
|
||||
public String serializeNewLoanDataToJson(final boolean prettyPrint, final Set<String> responseParameters, final NewLoanData newLoan) {
|
||||
final Gson gsonDeserializer = helper.createGsonBuilderWithParameterExclusionSerializationStrategy(NEW_LOAN_DATA_PARAMETERS, prettyPrint, responseParameters);
|
||||
public String serializeNewLoanDataToJson(final boolean prettyPrint,
|
||||
final Set<String> responseParameters, final NewLoanData newLoan) {
|
||||
final Gson gsonDeserializer = helper
|
||||
.createGsonBuilderWithParameterExclusionSerializationStrategy(
|
||||
NEW_LOAN_DATA_PARAMETERS, prettyPrint,
|
||||
responseParameters);
|
||||
return helper.serializedJsonFrom(gsonDeserializer, newLoan);
|
||||
}
|
||||
|
||||
@Override
|
||||
public String serialzieLoanAccountDataToJson(final boolean prettyPrint, final Set<String> responseParameters, final LoanAccountData loanAccount) {
|
||||
final Gson gsonDeserializer = helper.createGsonBuilderWithParameterExclusionSerializationStrategy(LOAN_DATA_PARAMETERS, prettyPrint, responseParameters);
|
||||
public String serialzieLoanAccountDataToJson(final boolean prettyPrint,
|
||||
final Set<String> responseParameters,
|
||||
final LoanAccountData loanAccount) {
|
||||
final Gson gsonDeserializer = helper
|
||||
.createGsonBuilderWithParameterExclusionSerializationStrategy(
|
||||
LOAN_DATA_PARAMETERS, prettyPrint, responseParameters);
|
||||
return helper.serializedJsonFrom(gsonDeserializer, loanAccount);
|
||||
}
|
||||
|
||||
@Override
|
||||
public String serializeLoanTransactionDataToJson(final boolean prettyPrint, final Set<String> responseParameters, final LoanTransactionData transaction) {
|
||||
final Gson gsonDeserializer = helper.createGsonBuilderWithParameterExclusionSerializationStrategy(LOAN_TRANSACTION_DATA_PARAMETERS, prettyPrint, responseParameters);
|
||||
public String serializeLoanTransactionDataToJson(final boolean prettyPrint,
|
||||
final Set<String> responseParameters,
|
||||
final LoanTransactionData transaction) {
|
||||
final Gson gsonDeserializer = helper
|
||||
.createGsonBuilderWithParameterExclusionSerializationStrategy(
|
||||
LOAN_TRANSACTION_DATA_PARAMETERS, prettyPrint,
|
||||
responseParameters);
|
||||
return helper.serializedJsonFrom(gsonDeserializer, transaction);
|
||||
}
|
||||
|
||||
@Override
|
||||
public String serializeChargeDataToJson(final boolean prettyPrint, final Set<String> responseParameters, final Collection<ChargeData> charges) {
|
||||
final Gson gsonDeserializer = helper.createGsonBuilderWithParameterExclusionSerializationStrategy(CHARGES_DATA_PARAMETERS, prettyPrint, responseParameters);
|
||||
return helper.serializedJsonFrom(gsonDeserializer, charges.toArray(new ChargeData[charges.size()]));
|
||||
public String serializeChargeDataToJson(final boolean prettyPrint,
|
||||
final Set<String> responseParameters,
|
||||
final Collection<ChargeData> charges) {
|
||||
final Gson gsonDeserializer = helper
|
||||
.createGsonBuilderWithParameterExclusionSerializationStrategy(
|
||||
CHARGES_DATA_PARAMETERS, prettyPrint,
|
||||
responseParameters);
|
||||
return helper.serializedJsonFrom(gsonDeserializer,
|
||||
charges.toArray(new ChargeData[charges.size()]));
|
||||
}
|
||||
|
||||
@Override
|
||||
public String serializeChargeDataToJson(final boolean prettyPrint, final Set<String> responseParameters, final ChargeData charge) {
|
||||
final Gson gsonDeserializer = helper.createGsonBuilderWithParameterExclusionSerializationStrategy(CHARGES_DATA_PARAMETERS, prettyPrint, responseParameters);
|
||||
public String serializeChargeDataToJson(final boolean prettyPrint,
|
||||
final Set<String> responseParameters, final ChargeData charge) {
|
||||
final Gson gsonDeserializer = helper
|
||||
.createGsonBuilderWithParameterExclusionSerializationStrategy(
|
||||
CHARGES_DATA_PARAMETERS, prettyPrint,
|
||||
responseParameters);
|
||||
return helper.serializedJsonFrom(gsonDeserializer, charge);
|
||||
}
|
||||
}
|
||||
+3
-1
@@ -18,6 +18,8 @@ public interface OfficeReadPlatformService {
|
||||
OfficeData retrieveNewOfficeTemplate();
|
||||
|
||||
List<OfficeLookup> retrieveAllowedParents(Long officeId);
|
||||
|
||||
|
||||
Collection<OfficeTransactionData> retrieveAllOfficeTransactions();
|
||||
|
||||
OfficeTransactionData retrieveNewOfficeTransactionDetails();
|
||||
}
|
||||
+68
-9
@@ -1,5 +1,6 @@
|
||||
package org.mifosng.platform.organisation.service;
|
||||
|
||||
import java.math.BigDecimal;
|
||||
import java.sql.ResultSet;
|
||||
import java.sql.SQLException;
|
||||
import java.util.ArrayList;
|
||||
@@ -63,7 +64,9 @@ public class OfficeReadPlatformServiceImpl implements OfficeReadPlatformService
|
||||
String parentName = rs.getString("parentName");
|
||||
|
||||
List<OfficeLookup> allowedParents = new ArrayList<OfficeLookup>();
|
||||
return new OfficeData(id, name, nameDecorated, externalId, openingDate, hierarchy, parentId, parentName, allowedParents);
|
||||
return new OfficeData(id, name, nameDecorated, externalId,
|
||||
openingDate, hierarchy, parentId, parentName,
|
||||
allowedParents);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -87,6 +90,43 @@ public class OfficeReadPlatformServiceImpl implements OfficeReadPlatformService
|
||||
}
|
||||
}
|
||||
|
||||
private static final class OfficeTransactionMapper implements
|
||||
RowMapper<OfficeTransactionData> {
|
||||
|
||||
public String officeTransactionSchema() {
|
||||
return " ot.id as id, ot.transaction_date as transactionDate, ot.from_office_id as fromOfficeId, fromoff.name as fromOfficeName, "
|
||||
+ " ot.to_office_id as toOfficeId, tooff.name as toOfficeName, ot.transaction_amount as transactionAmount, ot.description as description, "
|
||||
+ " ot.currency_code as currencyCode, rc.decimal_places as digitsAfterDecimal"
|
||||
+ " from m_office_transaction ot "
|
||||
+ " left join m_office fromoff on fromoff.id = ot.from_office_id "
|
||||
+ " left join m_office tooff on tooff.id = ot.to_office_id "
|
||||
+ " join m_currency rc on rc.`code` = ot.currency_code";
|
||||
}
|
||||
|
||||
@Override
|
||||
public OfficeTransactionData mapRow(final ResultSet rs, final int rowNum)
|
||||
throws SQLException {
|
||||
|
||||
Long id = rs.getLong("id");
|
||||
LocalDate transactionDate = JdbcSupport.getLocalDate(rs,
|
||||
"transactionDate");
|
||||
Long fromOfficeId = JdbcSupport.getLong(rs, "fromOfficeId");
|
||||
String fromOfficeName = rs.getString("fromOfficeName");
|
||||
Long toOfficeId = JdbcSupport.getLong(rs, "toOfficeId");
|
||||
String toOfficeName = rs.getString("toOfficeName");
|
||||
String currencyCode = rs.getString("currencyCode");
|
||||
Integer digitsAfterDecimal = JdbcSupport.getInteger(rs,
|
||||
"digitsAfterDecimal");
|
||||
BigDecimal transactionAmount = rs
|
||||
.getBigDecimal("transactionAmount");
|
||||
String description = rs.getString("description");
|
||||
|
||||
return new OfficeTransactionData(id, transactionDate, fromOfficeId,
|
||||
fromOfficeName, toOfficeId, toOfficeName, currencyCode,
|
||||
digitsAfterDecimal, transactionAmount, description);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public Collection<OfficeData> retrieveAllOffices() {
|
||||
|
||||
@@ -151,13 +191,13 @@ public class OfficeReadPlatformServiceImpl implements OfficeReadPlatformService
|
||||
|
||||
context.authenticatedUser();
|
||||
List<OfficeLookup> filterParentLookups = new ArrayList<OfficeLookup>();
|
||||
|
||||
|
||||
if (isNotHeadOffice(officeId)) {
|
||||
List<OfficeLookup> parentLookups = new ArrayList<OfficeLookup>(retrieveAllOfficesForLookup());
|
||||
|
||||
|
||||
List<OfficeLookup> parentLookups = new ArrayList<OfficeLookup>(
|
||||
retrieveAllOfficesForLookup());
|
||||
|
||||
for (OfficeLookup office : parentLookups) {
|
||||
|
||||
|
||||
if (!office.getId().equals(officeId)) {
|
||||
filterParentLookups.add(office);
|
||||
}
|
||||
@@ -172,13 +212,32 @@ public class OfficeReadPlatformServiceImpl implements OfficeReadPlatformService
|
||||
return !Long.valueOf(1).equals(officeId);
|
||||
}
|
||||
|
||||
@Override
|
||||
public Collection<OfficeTransactionData> retrieveAllOfficeTransactions() {
|
||||
|
||||
AppUser currentUser = context.authenticatedUser();
|
||||
|
||||
String hierarchy = currentUser.getOffice().getHierarchy();
|
||||
String hierarchySearchString = hierarchy + "%";
|
||||
|
||||
OfficeTransactionMapper rm = new OfficeTransactionMapper();
|
||||
String sql = "select " + rm.officeTransactionSchema()
|
||||
+ " where (fromoff.hierarchy like ? or tooff.hierarchy like ?) order by ot.transaction_date, ot.id";
|
||||
|
||||
return this.jdbcTemplate.query(sql, rm,
|
||||
new Object[] { hierarchySearchString, hierarchySearchString }); }
|
||||
|
||||
@Override
|
||||
public OfficeTransactionData retrieveNewOfficeTransactionDetails() {
|
||||
context.authenticatedUser();
|
||||
|
||||
List<OfficeLookup> parentLookups = new ArrayList<OfficeLookup>(retrieveAllOfficesForLookup());
|
||||
List<CurrencyData> currencyOptions = currencyReadPlatformService.retrieveAllowedCurrencies();
|
||||
List<OfficeLookup> parentLookups = new ArrayList<OfficeLookup>(
|
||||
retrieveAllOfficesForLookup());
|
||||
List<CurrencyData> currencyOptions = currencyReadPlatformService
|
||||
.retrieveAllowedCurrencies();
|
||||
|
||||
return new OfficeTransactionData(new LocalDate(), parentLookups, currencyOptions);
|
||||
return new OfficeTransactionData(new LocalDate(), parentLookups,
|
||||
currencyOptions);
|
||||
}
|
||||
|
||||
}
|
||||
Reference in New Issue
Block a user