-
Notifications
You must be signed in to change notification settings - Fork 1.5k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
FINERACT-1911 Assign datatable to Savings transaction #3304
Conversation
@@ -57,6 +57,7 @@ public class DatatableCommandFromApiJsonDeserializer { | |||
public static final String NEW_CODE = "newCode"; | |||
public static final String M_LOAN = "m_loan"; | |||
public static final String M_SAVINGS_ACCOUNT = "m_savings_account"; | |||
public static final String M_SAVINGS_ACCOUNT_TRANSACTIONS = "m_savings_account_transaction"; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Please follow the naming convention of the other entries: no plurals
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Sure. Will change it accordingly
@@ -1709,98 +1709,93 @@ private Long getLongSqlRowSet(final SqlRowSet rs, final String column) { | |||
return val; | |||
} | |||
|
|||
private String dataScopedSQL(final String appTable, final Long appTableId) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
why to remove the final
from these variables?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It was my mistake. Will correct it. Thanks
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Please add some tests to cover the functionality.
switch (appTable.toLowerCase()) { | ||
case "m_loan": | ||
scopedSQL = "select distinct x.* from (" | ||
+ " (select o.id as officeId, l.group_id as groupId, l.client_id as clientId, null as savingsId, l.id as loanId, null as entityId from m_loan l " |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This parts of the queries can be reused (the only difference is the alias):
"join m_client c on c.id = l.client_id join m_office o on o.id = c.office_id and o.hierarchy like '" + currentUser.getOffice().getHierarchy() + "%'
" join m_group g on g.id = l.group_id join m_office o on o.id = g.office_id and o.hierarchy like '" + currentUser.getOffice().getHierarchy() + "%'
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Done
@@ -57,6 +57,7 @@ public class DatatableCommandFromApiJsonDeserializer { | |||
public static final String NEW_CODE = "newCode"; | |||
public static final String M_LOAN = "m_loan"; | |||
public static final String M_SAVINGS_ACCOUNT = "m_savings_account"; | |||
public static final String M_SAVINGS_ACCOUNT_TRANSACTIONS = "m_savings_account_transaction"; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
You have these constants added, but not used eg. in RWNioncoreDataServiceImpl
} | ||
if (appTable.equalsIgnoreCase("m_share_product")) { | ||
return; | ||
switch (appTable.toLowerCase()) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Better than it was, but you could use SUPPORTED_APPTABLE_NAMES or the best would be to use EntityTables everywhere
} | ||
|
||
throw new PlatformDataIntegrityException("error.msg.invalid.application.table", "Invalid Application Table: " + appTable, "name", | ||
appTable); | ||
} | ||
|
||
private String mapToActualAppTable(final String appTable) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
There are so many other places regarding datatables where you did not add the new apptable type:
org.apache.fineract.infrastructure.dataqueries.data.EntityTables
org.apache.fineract.infrastructure.dataqueries.service.EntityDatatableChecksReadPlatformServiceImpl
org.apache.fineract.infrastructure.dataqueries.service.EntityDatatableChecksWritePlatformServiceImpl
Could you please provide a full solution.
Integration tests also should be added.
39b4724
to
5d8bc5d
Compare
@@ -158,12 +148,9 @@ public void validateForCreate(final String json) { | |||
|
|||
final String apptableName = this.fromApiJsonHelper.extractStringNamed(APPTABLE_NAME, element); | |||
baseDataValidator.reset().parameter(APPTABLE_NAME).value(apptableName).notBlank().notExceedingLengthOf(50) | |||
.isOneOfTheseValues(SUPPORTED_APPTABLE_NAMES); | |||
.isOneOfTheseStringValues(EntityTables.getEntitiesList()); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This will not allow to create and update 'm_center' but as we discussed I'll fix this
@@ -105,10 +105,11 @@ public CommandProcessingResult createCheck(final JsonCommand command) { | |||
throw new EntityDatatableCheckAlreadyExistsException(entity, status, datatableName); | |||
} | |||
} else { | |||
if (entity.equals("m_loan")) { | |||
EntityTables entityTable = EntityTables.fromName(entity); | |||
if (EntityTables.LOAN.equals(entityTable)) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
minor: enum equality can be checked by identity
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Done
5d8bc5d
to
28a97d4
Compare
@Mk9894 Please check why it is not compiling! |
@@ -514,7 +515,6 @@ configure(project.fineractJavaProjects) { | |||
"EqualsGetClass", | |||
"EqualsUnsafeCast", | |||
"DoubleBraceInitialization", | |||
"UnnecessaryDefaultInEnumSwitch", |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
why do you want this?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
UnnecessaryDefaultInEnumSwitch does not make sense to cause the build to fail. Most of the time it is even very useful eg. to prepare to the enums being extended.
@@ -514,7 +515,6 @@ configure(project.fineractJavaProjects) { | |||
"EqualsGetClass", | |||
"EqualsUnsafeCast", | |||
"DoubleBraceInitialization", | |||
"UnnecessaryDefaultInEnumSwitch", |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
UnnecessaryDefaultInEnumSwitch does not make sense to cause the build to fail. Most of the time it is even very useful eg. to prepare to the enums being extended.
6ab7bb5
to
b9c7e89
Compare
Description
Describe the changes made and why they were made.
Ignore if these details are present on the associated Apache Fineract JIRA ticket.
Checklist
Please make sure these boxes are checked before submitting your pull request - thanks!
Write the commit message as per https://github.com/apache/fineract/#pull-requests
Acknowledge that we will not review PRs that are not passing the build ("green") - it is your responsibility to get a proposed PR to pass the build, not primarily the project's maintainers.
Create/update unit or integration tests for verifying the changes made.
Follow coding conventions at https://cwiki.apache.org/confluence/display/FINERACT/Coding+Conventions.
Add required Swagger annotation and update API documentation at fineract-provider/src/main/resources/static/legacy-docs/apiLive.htm with details of any API changes
Submission is not a "code dump". (Large changes can be made "in repository" via a branch. Ask on the developer mailing list for guidance, if required.)
FYI our guidelines for code reviews are at https://cwiki.apache.org/confluence/display/FINERACT/Code+Review+Guide.