From 018086ba41fbfdcae7a7f8b71516180542b95c99 Mon Sep 17 00:00:00 2001 From: Vladyslav Date: Thu, 3 Sep 2026 15:17:45 +0300 Subject: [PATCH] FINERACT-2801: Remove unused (dead) code in fineract-accounting --- .../GLAccountInvalidUsageException.java | 31 ---------- .../data/JournalEntryIdentifier.java | 61 ------------------- .../JournalEntryNotFoundException.java | 37 ----------- .../AccountingRuleInvalidDeleteException.java | 33 ---------- .../AccountingRuleInvalidException.java | 57 ----------------- 5 files changed, 219 deletions(-) delete mode 100644 fineract-accounting/src/main/java/org/apache/fineract/accounting/glaccount/exception/GLAccountInvalidUsageException.java delete mode 100644 fineract-accounting/src/main/java/org/apache/fineract/accounting/journalentry/data/JournalEntryIdentifier.java delete mode 100644 fineract-accounting/src/main/java/org/apache/fineract/accounting/journalentry/exception/JournalEntryNotFoundException.java delete mode 100644 fineract-accounting/src/main/java/org/apache/fineract/accounting/rule/exception/AccountingRuleInvalidDeleteException.java delete mode 100644 fineract-accounting/src/main/java/org/apache/fineract/accounting/rule/exception/AccountingRuleInvalidException.java diff --git a/fineract-accounting/src/main/java/org/apache/fineract/accounting/glaccount/exception/GLAccountInvalidUsageException.java b/fineract-accounting/src/main/java/org/apache/fineract/accounting/glaccount/exception/GLAccountInvalidUsageException.java deleted file mode 100644 index c0996c638e3..00000000000 --- a/fineract-accounting/src/main/java/org/apache/fineract/accounting/glaccount/exception/GLAccountInvalidUsageException.java +++ /dev/null @@ -1,31 +0,0 @@ -/** - * Licensed to the Apache Software Foundation (ASF) under one - * or more contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. The ASF licenses this file - * to you under the Apache License, Version 2.0 (the - * "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - */ -package org.apache.fineract.accounting.glaccount.exception; - -import org.apache.fineract.infrastructure.core.exception.AbstractPlatformDomainRuleException; - -/** - * A {@link RuntimeException} thrown when trying to fetch accounts belonging to an Invalid Type - */ -public class GLAccountInvalidUsageException extends AbstractPlatformDomainRuleException { - - public GLAccountInvalidUsageException(final Integer type) { - super("error.msg.glaccount.classification.invalid", "The following COA type is invalid: " + type); - } -} diff --git a/fineract-accounting/src/main/java/org/apache/fineract/accounting/journalentry/data/JournalEntryIdentifier.java b/fineract-accounting/src/main/java/org/apache/fineract/accounting/journalentry/data/JournalEntryIdentifier.java deleted file mode 100644 index ce1ff798155..00000000000 --- a/fineract-accounting/src/main/java/org/apache/fineract/accounting/journalentry/data/JournalEntryIdentifier.java +++ /dev/null @@ -1,61 +0,0 @@ -/** - * Licensed to the Apache Software Foundation (ASF) under one - * or more contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. The ASF licenses this file - * to you under the Apache License, Version 2.0 (the - * "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - */ -package org.apache.fineract.accounting.journalentry.data; - -/** - * Represents the successful result of an REST API call. - */ -public class JournalEntryIdentifier { - - private String entityId; - - // TODO - Rename variable to commandId or taskId or something that shows - // this is the id of a command in a table/queue for processing. - @SuppressWarnings("unused") - private Long makerCheckerId; - - public static JournalEntryIdentifier makerChecker(final Long makerCheckerId) { - return new JournalEntryIdentifier(null, makerCheckerId); - } - - public static JournalEntryIdentifier makerChecker(final String resourceId, final Long makerCheckerId) { - return new JournalEntryIdentifier(resourceId, makerCheckerId); - } - - public JournalEntryIdentifier() { - // - } - - public JournalEntryIdentifier(final String entityId) { - this.entityId = entityId; - } - - private JournalEntryIdentifier(final String entityId, final Long makerCheckerId) { - this.entityId = entityId; - this.makerCheckerId = makerCheckerId; - } - - public String getEntityId() { - return this.entityId; - } - - public void setEntityId(final String entityId) { - this.entityId = entityId; - } -} diff --git a/fineract-accounting/src/main/java/org/apache/fineract/accounting/journalentry/exception/JournalEntryNotFoundException.java b/fineract-accounting/src/main/java/org/apache/fineract/accounting/journalentry/exception/JournalEntryNotFoundException.java deleted file mode 100644 index 5a0086f9eef..00000000000 --- a/fineract-accounting/src/main/java/org/apache/fineract/accounting/journalentry/exception/JournalEntryNotFoundException.java +++ /dev/null @@ -1,37 +0,0 @@ -/** - * Licensed to the Apache Software Foundation (ASF) under one - * or more contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. The ASF licenses this file - * to you under the Apache License, Version 2.0 (the - * "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - */ -package org.apache.fineract.accounting.journalentry.exception; - -import org.apache.fineract.infrastructure.core.exception.AbstractPlatformResourceNotFoundException; - -/** - * A {@link RuntimeException} thrown when journal entry resources are not found. - */ -public class JournalEntryNotFoundException extends AbstractPlatformResourceNotFoundException { - - public JournalEntryNotFoundException(final String transactionId) { - super("error.msg.journalEntries.transactionId.invalid", - "Journal Entries with transaction Identifier " + transactionId + " does not exist or are not system generated/reversible ", - transactionId); - } - - public JournalEntryNotFoundException(final Long entryId) { - super("error.msg.journalEntries.id.invalid", "Journal Entry with entry Id " + entryId + " does not exist ", entryId); - } -} diff --git a/fineract-accounting/src/main/java/org/apache/fineract/accounting/rule/exception/AccountingRuleInvalidDeleteException.java b/fineract-accounting/src/main/java/org/apache/fineract/accounting/rule/exception/AccountingRuleInvalidDeleteException.java deleted file mode 100644 index ad649a65801..00000000000 --- a/fineract-accounting/src/main/java/org/apache/fineract/accounting/rule/exception/AccountingRuleInvalidDeleteException.java +++ /dev/null @@ -1,33 +0,0 @@ -/** - * Licensed to the Apache Software Foundation (ASF) under one - * or more contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. The ASF licenses this file - * to you under the Apache License, Version 2.0 (the - * "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - */ -package org.apache.fineract.accounting.rule.exception; - -import java.time.LocalDate; -import org.apache.fineract.infrastructure.core.exception.AbstractPlatformDomainRuleException; - -/** - * A {@link RuntimeException} thrown when a GL Closure Delte command is invalid - */ -public class AccountingRuleInvalidDeleteException extends AbstractPlatformDomainRuleException { - - public AccountingRuleInvalidDeleteException(final Long officeId, final String officeName, final LocalDate latestclosureDate) { - super("error.msg.glclosure.invalid.delete", "The latest closure for office with Id " + officeId + " and name " + officeName - + " is on " + latestclosureDate.toString() + ", please delete this closure first", latestclosureDate); - } -} diff --git a/fineract-accounting/src/main/java/org/apache/fineract/accounting/rule/exception/AccountingRuleInvalidException.java b/fineract-accounting/src/main/java/org/apache/fineract/accounting/rule/exception/AccountingRuleInvalidException.java deleted file mode 100644 index 2b21d4077ff..00000000000 --- a/fineract-accounting/src/main/java/org/apache/fineract/accounting/rule/exception/AccountingRuleInvalidException.java +++ /dev/null @@ -1,57 +0,0 @@ -/** - * Licensed to the Apache Software Foundation (ASF) under one - * or more contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. The ASF licenses this file - * to you under the Apache License, Version 2.0 (the - * "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - */ -package org.apache.fineract.accounting.rule.exception; - -import java.time.LocalDate; -import org.apache.fineract.infrastructure.core.exception.AbstractPlatformDomainRuleException; - -/** - * A {@link RuntimeException} thrown when a GL Closure is Invalid - */ -public class AccountingRuleInvalidException extends AbstractPlatformDomainRuleException { - - /*** enum of reasons for invalid Accounting Closure **/ - public enum GlClosureInvalidReason { - - FUTURE_DATE, // - ACCOUNTING_CLOSED; // - - public String errorMessage() { - if (name().equalsIgnoreCase("FUTURE_DATE")) { - return "Accounting closures cannot be made for a future date"; - } else if (name().equalsIgnoreCase("ACCOUNTING_CLOSED")) { - return "Accounting Closure for this branch has already been defined for a greater date"; - } - return name(); - } - - public String errorCode() { - if (name().equalsIgnoreCase("FUTURE_DATE")) { - return "error.msg.glclosure.invalid.future.date"; - } else if (name().equalsIgnoreCase("ACCOUNTING_CLOSED")) { - return "error.msg.glclosure.invalid.accounting.closed"; - } - return name(); - } - } - - public AccountingRuleInvalidException(final GlClosureInvalidReason reason, final LocalDate date) { - super(reason.errorCode(), reason.errorMessage(), date); - } -}