FINERACT-2081: Remove unnecessary toString method calls and fix typo
This commit is contained in:
committed by
Adam Saghy
parent
b2bfca2556
commit
352d282d7c
+8
-8
@@ -28,24 +28,24 @@ public class GLAccountInvalidDeleteException extends AbstractPlatformDomainRuleE
|
||||
/*** Enum of reasons for invalid delete **/
|
||||
public enum GlAccountInvalidDeleteReason {
|
||||
|
||||
TRANSANCTIONS_LOGGED, HAS_CHILDREN;
|
||||
TRANSACTIONS_LOGGED, HAS_CHILDREN;
|
||||
|
||||
public String errorMessage() {
|
||||
if (name().toString().equalsIgnoreCase("TRANSANCTIONS_LOGGED")) {
|
||||
if (name().equalsIgnoreCase("TRANSACTIONS_LOGGED")) {
|
||||
return "This GL Account cannot be deleted as it has transactions logged against it";
|
||||
} else if (name().toString().equalsIgnoreCase("HAS_CHILDREN")) {
|
||||
return "Cannot delete this Header GL Account without first deleting or reassinging its children";
|
||||
} else if (name().equalsIgnoreCase("HAS_CHILDREN")) {
|
||||
return "Cannot delete this Header GL Account without first deleting or reassigning its children";
|
||||
}
|
||||
return name().toString();
|
||||
return name();
|
||||
}
|
||||
|
||||
public String errorCode() {
|
||||
if (name().toString().equalsIgnoreCase("TRANSANCTIONS_LOGGED")) {
|
||||
if (name().equalsIgnoreCase("TRANSACTIONS_LOGGED")) {
|
||||
return "error.msg.glaccount.glcode.invalid.delete.transactions.logged";
|
||||
} else if (name().toString().equalsIgnoreCase("HAS_CHILDREN")) {
|
||||
} else if (name().equalsIgnoreCase("HAS_CHILDREN")) {
|
||||
return "error.msg.glaccount.glcode.invalid.delete.has.children";
|
||||
}
|
||||
return name().toString();
|
||||
return name();
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
+1
-1
@@ -194,7 +194,7 @@ public class GLAccountWritePlatformServiceJpaRepositoryImpl implements GLAccount
|
||||
final boolean journalEntriesForAccountExist = this.glJournalEntryRepository
|
||||
.exists((root, query, criteriaBuilder) -> criteriaBuilder.equal(root.get("glAccountId"), glAccountId));
|
||||
if (journalEntriesForAccountExist) {
|
||||
throw new GLAccountInvalidDeleteException(GlAccountInvalidDeleteReason.TRANSANCTIONS_LOGGED, glAccountId);
|
||||
throw new GLAccountInvalidDeleteException(GlAccountInvalidDeleteReason.TRANSACTIONS_LOGGED, glAccountId);
|
||||
}
|
||||
this.glAccountRepository.delete(glAccount);
|
||||
|
||||
|
||||
Reference in New Issue
Block a user