FINERACT-1717:eliminate boilerpalate getter methods within JsonCommand class

This commit is contained in:
zeyad2003
2024-07-18 11:25:38 +02:00
committed by Adam Saghy
parent b3b14ba929
commit 38d994452d
7 changed files with 10 additions and 51 deletions
@@ -34,6 +34,7 @@ import java.util.Locale;
import java.util.Map;
import java.util.Objects;
import java.util.Set;
import lombok.Getter;
import org.apache.commons.lang3.ObjectUtils;
import org.apache.commons.lang3.StringUtils;
import org.apache.fineract.infrastructure.core.domain.ExternalId;
@@ -49,6 +50,8 @@ import org.apache.fineract.infrastructure.security.service.PlatformPasswordEncod
* Wraps the provided JSON with convenience functions for extracting parameter values and checking for changes against
* an existing value.
*/
@Getter
public final class JsonCommand {
private final String jsonCommand;
@@ -189,14 +192,6 @@ public final class JsonCommand {
}
public Long getOrganisationCreditBureauId() {
return this.organisationCreditBureauId;
}
public Long getCreditBureauId() {
return this.creditBureauId;
}
public String json() {
return this.jsonCommand;
}
@@ -225,10 +220,6 @@ public final class JsonCommand {
return this.commandId;
}
public String entityName() {
return this.entityName;
}
public Long entityId() {
return this.resourceId;
}
@@ -237,38 +228,6 @@ public final class JsonCommand {
return this.subresourceId;
}
public Long getGroupId() {
return this.groupId;
}
public Long getClientId() {
return this.clientId;
}
public Long getLoanId() {
return this.loanId;
}
public Long getSavingsId() {
return this.savingsId;
}
public String getTransactionId() {
return this.transactionId;
}
public String getUrl() {
return this.url;
}
public Long getProductId() {
return this.productId;
}
public String getJobName() {
return this.jobName;
}
private boolean differenceExists(final TemporalAccessor baseValue, final TemporalAccessor workingCopyValue) {
return !Objects.equals(baseValue, workingCopyValue);
}
@@ -36,6 +36,6 @@ public class CreateDatatableEntryCommandHandler implements NewCommandSourceHandl
@Override
public CommandProcessingResult processCommand(final JsonCommand command) {
return writePlatformService.createNewDatatableEntry(command.entityName(), command.entityId(), command);
return writePlatformService.createNewDatatableEntry(command.getEntityName(), command.entityId(), command);
}
}
@@ -39,6 +39,6 @@ public class DeleteOneToManyDatatableEntryCommandHandler implements NewCommandSo
@Transactional
@Override
public CommandProcessingResult processCommand(final JsonCommand command) {
return this.writePlatformService.deleteDatatableEntry(command.entityName(), command.entityId(), command.subentityId(), command);
return this.writePlatformService.deleteDatatableEntry(command.getEntityName(), command.entityId(), command.subentityId(), command);
}
}
@@ -39,6 +39,6 @@ public class DeleteOneToOneDatatableEntryCommandHandler implements NewCommandSou
@Transactional
@Override
public CommandProcessingResult processCommand(final JsonCommand command) {
return this.writePlatformService.deleteDatatableEntries(command.entityName(), command.entityId(), command);
return this.writePlatformService.deleteDatatableEntries(command.getEntityName(), command.entityId(), command);
}
}
@@ -40,7 +40,7 @@ public class UpdateOneToManyDatatableEntryCommandHandler implements NewCommandSo
@Override
public CommandProcessingResult processCommand(final JsonCommand command) {
return this.writePlatformService.updateDatatableEntryOneToMany(command.entityName(), command.entityId(), command.subentityId(),
return this.writePlatformService.updateDatatableEntryOneToMany(command.getEntityName(), command.entityId(), command.subentityId(),
command);
}
@@ -41,8 +41,8 @@ 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.getEntityName(), command.entityId(), command);
return new CommandProcessingResultBuilder() //
.withCommandId(command.commandId()) //
@@ -44,6 +44,6 @@ public class FullFilSurveyCommandHandler implements NewCommandSourceHandler {
@Override
public CommandProcessingResult processCommand(final JsonCommand command) {
return this.writePlatformService.fullFillSurvey(command.entityName(), command.entityId(), command);
return this.writePlatformService.fullFillSurvey(command.getEntityName(), command.entityId(), command);
}
}