From 385c1e7fe55a40a7a01fb7a5cddc4bec25dc87c8 Mon Sep 17 00:00:00 2001 From: Pramod Nuthakki Date: Fri, 12 Jul 2013 13:34:00 +0530 Subject: [PATCH] batch job changes for load and save --- .../core_db/V79__schedule_jobs_tables.sql | 45 +++++ .../GLClosureReadPlatformServiceImpl.java | 4 +- .../GLAccountReadPlatformServiceImpl.java | 4 +- .../JournalEntryReadPlatformServiceImpl.java | 4 +- ...AccountMappingReadPlatformServiceImpl.java | 4 +- ...AccountingRuleReadPlatformServiceImpl.java | 4 +- .../service/AuditReadPlatformServiceImpl.java | 4 +- .../service/CodeReadPlatformServiceImpl.java | 4 +- .../CodeValueReadPlatformServiceImpl.java | 4 +- .../ConfigurationReadPlatformServiceImpl.java | 4 +- ...ternalServicesReadPlatformServiceImpl.java | 4 +- .../core/domain/MifosPlatformTenant.java | 61 +++++-- .../core/service/DataSourceForTenants.java | 27 +++ ...DataSource.java => RoutingDataSource.java} | 10 +- ...ice.java => RoutingDataSourceService.java} | 6 +- .../RoutingDataSourceServiceFactory.java | 28 +++ .../core/service/ThreadLocalContextUtil.java | 23 ++- .../TomcatJdbcDataSourcePerTenantService.java | 4 +- .../service/GenericDataServiceImpl.java | 4 +- .../service/ReadReportingServiceImpl.java | 4 +- .../ReadWriteNonCoreDataServiceImpl.java | 4 +- .../DocumentReadPlatformServiceImpl.java | 4 +- .../service/ImageReadPlatformServiceImpl.java | 4 +- .../service/JdbcTenantDetailsService.java | 5 +- .../CurrencyReadPlatformServiceImpl.java | 4 +- .../OfficeReadPlatformServiceImpl.java | 4 +- .../service/StaffReadPlatformServiceImpl.java | 4 +- .../CalendarReadPlatformServiceImpl.java | 4 +- .../ChargeReadPlatformServiceImpl.java | 4 +- ...ientIdentifierReadPlatformServiceImpl.java | 4 +- .../ClientReadPlatformServiceImpl.java | 4 +- .../CollateralReadPlatformServiceImpl.java | 4 +- ...ollectionSheetReadPlatformServiceImpl.java | 4 +- .../service/FundReadPlatformServiceImpl.java | 4 +- .../CenterReadPlatformServiceImpl.java | 4 +- .../GroupLevelReadPlatformServiceImpl.java | 4 +- .../service/GroupReadPlatformServiceImpl.java | 4 +- .../GroupRolesReadPlatformServiceImpl.java | 4 +- .../loanaccount/domain/LoanSummary.java | 1 - .../GuarantorReadPlatformServiceImpl.java | 4 +- .../BulkLoansReadPlatformServiceImpl.java | 4 +- .../LoanChargeReadPlatformServiceImpl.java | 4 +- .../service/LoanReadPlatformServiceImpl.java | 4 +- ...WritePlatformServiceJpaRepositoryImpl.java | 2 + .../LoanProductReadPlatformServiceImpl.java | 4 +- .../service/NoteReadPlatformServiceImpl.java | 4 +- ...SavingsAccountReadPlatformServiceImpl.java | 4 +- ...SavingsProductReadPlatformServiceImpl.java | 4 +- .../SearchReadPlatformServiceImpl.java | 4 +- .../ApplyAnnualFeeForSavingsScheduledJob.java | 31 ---- .../ApplyHolidaysToLoansScheduledJob.java | 31 ---- .../UpdateLoanArrearsAgeingScheduledJob.java | 31 ---- .../UpdateLoanPaidInAdvanceScheduledJob.java | 31 ---- .../UpdateLoanSummariesScheduledJob.java | 34 ---- .../annotation/CronMethodParser.java | 76 ++++++++ .../annotation/CronTargetMethod.java | 18 ++ .../domain/ScheduledJobDetails.java | 117 ++++++++++++ .../domain/ScheduledJobDetailsRepository.java | 14 ++ .../domain/ScheduledJobRunHistory.java | 62 +++++++ .../ScheduledJobRunHistoryRepository.java | 14 ++ .../service/JobRegisterService.java | 172 ++++++++++++++++++ .../service/SchedularService.java | 20 ++ .../service/SchedularServiceConstants.java | 17 ++ .../SchedularServiceJpaRepositoryImpl.java | 59 ++++++ .../service/ScheduledJobRunnerService.java | 8 +- .../ScheduledJobRunnerServiceImpl.java | 69 ++----- .../service/SchedulerJobListener.java | 113 ++++++++++++ .../AppUserReadPlatformServiceImpl.java | 4 +- .../PermissionReadPlatformServiceImpl.java | 4 +- .../service/RoleReadPlatformServiceImpl.java | 4 +- .../resources/META-INF/spring/appContext.xml | 3 +- .../META-INF/spring/infrastructure.xml | 2 +- .../resources/META-INF/spring/scheduler.xml | 100 +--------- 73 files changed, 973 insertions(+), 425 deletions(-) create mode 100755 mifosng-db/migrations/core_db/V79__schedule_jobs_tables.sql create mode 100755 mifosng-provider/src/main/java/org/mifosplatform/infrastructure/core/service/DataSourceForTenants.java rename mifosng-provider/src/main/java/org/mifosplatform/infrastructure/core/service/{TenantAwareRoutingDataSource.java => RoutingDataSource.java} (80%) rename mifosng-provider/src/main/java/org/mifosplatform/infrastructure/core/service/{DataSourcePerTenantService.java => RoutingDataSourceService.java} (75%) create mode 100755 mifosng-provider/src/main/java/org/mifosplatform/infrastructure/core/service/RoutingDataSourceServiceFactory.java delete mode 100644 mifosng-provider/src/main/java/org/mifosplatform/scheduledjobs/ApplyAnnualFeeForSavingsScheduledJob.java delete mode 100644 mifosng-provider/src/main/java/org/mifosplatform/scheduledjobs/ApplyHolidaysToLoansScheduledJob.java delete mode 100644 mifosng-provider/src/main/java/org/mifosplatform/scheduledjobs/UpdateLoanArrearsAgeingScheduledJob.java delete mode 100644 mifosng-provider/src/main/java/org/mifosplatform/scheduledjobs/UpdateLoanPaidInAdvanceScheduledJob.java delete mode 100644 mifosng-provider/src/main/java/org/mifosplatform/scheduledjobs/UpdateLoanSummariesScheduledJob.java create mode 100755 mifosng-provider/src/main/java/org/mifosplatform/scheduledjobs/annotation/CronMethodParser.java create mode 100755 mifosng-provider/src/main/java/org/mifosplatform/scheduledjobs/annotation/CronTargetMethod.java create mode 100755 mifosng-provider/src/main/java/org/mifosplatform/scheduledjobs/domain/ScheduledJobDetails.java create mode 100755 mifosng-provider/src/main/java/org/mifosplatform/scheduledjobs/domain/ScheduledJobDetailsRepository.java create mode 100755 mifosng-provider/src/main/java/org/mifosplatform/scheduledjobs/domain/ScheduledJobRunHistory.java create mode 100755 mifosng-provider/src/main/java/org/mifosplatform/scheduledjobs/domain/ScheduledJobRunHistoryRepository.java create mode 100755 mifosng-provider/src/main/java/org/mifosplatform/scheduledjobs/service/JobRegisterService.java create mode 100755 mifosng-provider/src/main/java/org/mifosplatform/scheduledjobs/service/SchedularService.java create mode 100755 mifosng-provider/src/main/java/org/mifosplatform/scheduledjobs/service/SchedularServiceConstants.java create mode 100755 mifosng-provider/src/main/java/org/mifosplatform/scheduledjobs/service/SchedularServiceJpaRepositoryImpl.java create mode 100755 mifosng-provider/src/main/java/org/mifosplatform/scheduledjobs/service/SchedulerJobListener.java diff --git a/mifosng-db/migrations/core_db/V79__schedule_jobs_tables.sql b/mifosng-db/migrations/core_db/V79__schedule_jobs_tables.sql new file mode 100755 index 000000000..130b632bb --- /dev/null +++ b/mifosng-db/migrations/core_db/V79__schedule_jobs_tables.sql @@ -0,0 +1,45 @@ +CREATE TABLE `scheduled_jobs` ( + `id` BIGINT(20) NOT NULL AUTO_INCREMENT, + `job_name` VARCHAR(50) NOT NULL COLLATE 'latin1_swedish_ci', + `job_display_name` VARCHAR(50) NOT NULL COLLATE 'latin1_swedish_ci', + `cron_expression` VARCHAR(20) NOT NULL COLLATE 'latin1_swedish_ci', + `create_time` DATETIME NOT NULL, + `task_priority` SMALLINT(6) NOT NULL DEFAULT '5', + `group_name` VARCHAR(50) NULL DEFAULT NULL COLLATE 'latin1_swedish_ci', + `previous_run_start_time` DATETIME NULL DEFAULT NULL, + `next_run_time` DATETIME NULL DEFAULT NULL, + `trigger_key` VARCHAR(500) NULL DEFAULT NULL COLLATE 'latin1_swedish_ci', + `job_initializing_errorlog` TEXT NULL COLLATE 'latin1_swedish_ci', + `is_active` TINYINT(1) NOT NULL DEFAULT '1', + PRIMARY KEY (`id`) +) +COLLATE='utf8_general_ci' +ENGINE=InnoDB; + +CREATE TABLE `scheduled_job_runhistory` ( + `id` BIGINT(20) NOT NULL AUTO_INCREMENT, + `job_id` BIGINT(20) NOT NULL, + `version` BIGINT(20) NOT NULL, + `start_time` DATETIME NOT NULL, + `end_time` DATETIME NOT NULL, + `status` VARCHAR(10) NOT NULL COLLATE 'latin1_swedish_ci', + `errormessage` VARCHAR(500) NULL DEFAULT NULL COLLATE 'latin1_swedish_ci', + `triggertype` VARCHAR(25) NOT NULL COLLATE 'latin1_swedish_ci', + `errorlog` TEXT NULL COLLATE 'latin1_swedish_ci', + PRIMARY KEY (`id`), + INDEX `scheduledjobsFK` (`job_id`), + CONSTRAINT `scheduledjobsFK` FOREIGN KEY (`job_id`) REFERENCES `scheduled_jobs` (`id`) +) +COLLATE='utf8_general_ci' +ENGINE=InnoDB; + + +INSERT INTO `scheduled_jobs` (`job_name`, `job_display_name`, `cron_expression`, `create_time`, `task_priority`, `group_name`, `previous_run_start_time`, `next_run_time`, `trigger_key`, `job_initializing_errorlog`, `is_active`) VALUES ('Update loan Summary', 'Update loan Summary', '0 0 22 1/1 * ? *', now(), 5, NULL, NULL, NULL, NULL, NULL, 1); +INSERT INTO `scheduled_jobs` (`job_name`, `job_display_name`, `cron_expression`, `create_time`, `task_priority`, `group_name`, `previous_run_start_time`, `next_run_time`, `trigger_key`, `job_initializing_errorlog`, `is_active`) VALUES ('Update Loan Arrears Ageing', 'Update Loan Arrears Ageing', '0 1 0 1/1 * ? *', now(), 5, NULL, NULL, NULL, NULL, NULL, 1); +INSERT INTO `scheduled_jobs` (`job_name`, `job_display_name`, `cron_expression`, `create_time`, `task_priority`, `group_name`, `previous_run_start_time`, `next_run_time`, `trigger_key`, `job_initializing_errorlog`, `is_active`) VALUES ('Update Loan Paid In Advance', 'Update Loan Paid In Advance', '0 5 0 1/1 * ? *', now(), 5, NULL, NULL, NULL, NULL, NULL, 1); +INSERT INTO `scheduled_jobs` (`job_name`, `job_display_name`, `cron_expression`, `create_time`, `task_priority`, `group_name`, `previous_run_start_time`, `next_run_time`, `trigger_key`, `job_initializing_errorlog`, `is_active`) VALUES ('Apply Annual Fee For Savings', 'Apply Annual Fee For Savings', '0 20 22 1/1 * ? *', now(), 5, NULL, NULL, NULL, NULL, NULL, 1); +INSERT INTO `scheduled_jobs` (`job_name`, `job_display_name`, `cron_expression`, `create_time`, `task_priority`, `group_name`, `previous_run_start_time`, `next_run_time`, `trigger_key`, `job_initializing_errorlog`, `is_active`) VALUES ('Apply Holidays To Loans', 'Apply Holidays To Loans', '0 0 12 * * ?', now(), 5, NULL, NULL, NULL, NULL, NULL, 1); + + + + diff --git a/mifosng-provider/src/main/java/org/mifosplatform/accounting/closure/service/GLClosureReadPlatformServiceImpl.java b/mifosng-provider/src/main/java/org/mifosplatform/accounting/closure/service/GLClosureReadPlatformServiceImpl.java index d733aa58c..0feeed44b 100755 --- a/mifosng-provider/src/main/java/org/mifosplatform/accounting/closure/service/GLClosureReadPlatformServiceImpl.java +++ b/mifosng-provider/src/main/java/org/mifosplatform/accounting/closure/service/GLClosureReadPlatformServiceImpl.java @@ -14,7 +14,7 @@ import org.joda.time.LocalDate; import org.mifosplatform.accounting.closure.data.GLClosureData; import org.mifosplatform.accounting.closure.exception.GLClosureNotFoundException; import org.mifosplatform.infrastructure.core.domain.JdbcSupport; -import org.mifosplatform.infrastructure.core.service.TenantAwareRoutingDataSource; +import org.mifosplatform.infrastructure.core.service.RoutingDataSource; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.dao.EmptyResultDataAccessException; import org.springframework.jdbc.core.JdbcTemplate; @@ -27,7 +27,7 @@ public class GLClosureReadPlatformServiceImpl implements GLClosureReadPlatformSe private final JdbcTemplate jdbcTemplate; @Autowired - public GLClosureReadPlatformServiceImpl(final TenantAwareRoutingDataSource dataSource) { + public GLClosureReadPlatformServiceImpl(final RoutingDataSource dataSource) { this.jdbcTemplate = new JdbcTemplate(dataSource); } diff --git a/mifosng-provider/src/main/java/org/mifosplatform/accounting/glaccount/service/GLAccountReadPlatformServiceImpl.java b/mifosng-provider/src/main/java/org/mifosplatform/accounting/glaccount/service/GLAccountReadPlatformServiceImpl.java index 87b9078cd..017c41b03 100644 --- a/mifosng-provider/src/main/java/org/mifosplatform/accounting/glaccount/service/GLAccountReadPlatformServiceImpl.java +++ b/mifosng-provider/src/main/java/org/mifosplatform/accounting/glaccount/service/GLAccountReadPlatformServiceImpl.java @@ -21,7 +21,7 @@ import org.mifosplatform.accounting.glaccount.exception.GLAccountNotFoundExcepti import org.mifosplatform.infrastructure.codes.data.CodeValueData; import org.mifosplatform.infrastructure.core.data.EnumOptionData; import org.mifosplatform.infrastructure.core.domain.JdbcSupport; -import org.mifosplatform.infrastructure.core.service.TenantAwareRoutingDataSource; +import org.mifosplatform.infrastructure.core.service.RoutingDataSource; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.dao.EmptyResultDataAccessException; import org.springframework.jdbc.core.JdbcTemplate; @@ -35,7 +35,7 @@ public class GLAccountReadPlatformServiceImpl implements GLAccountReadPlatformSe private final static String nameDecoratedBaseOnHierarchy = "concat(substring('........................................', 1, ((LENGTH(hierarchy) - LENGTH(REPLACE(hierarchy, '.', '')) - 1) * 4)), name)"; @Autowired - public GLAccountReadPlatformServiceImpl(final TenantAwareRoutingDataSource dataSource) { + public GLAccountReadPlatformServiceImpl(final RoutingDataSource dataSource) { this.jdbcTemplate = new JdbcTemplate(dataSource); } diff --git a/mifosng-provider/src/main/java/org/mifosplatform/accounting/journalentry/service/JournalEntryReadPlatformServiceImpl.java b/mifosng-provider/src/main/java/org/mifosplatform/accounting/journalentry/service/JournalEntryReadPlatformServiceImpl.java index 4995b8b5d..e3fbbdc7c 100755 --- a/mifosng-provider/src/main/java/org/mifosplatform/accounting/journalentry/service/JournalEntryReadPlatformServiceImpl.java +++ b/mifosng-provider/src/main/java/org/mifosplatform/accounting/journalentry/service/JournalEntryReadPlatformServiceImpl.java @@ -22,7 +22,7 @@ import org.mifosplatform.infrastructure.core.data.EnumOptionData; import org.mifosplatform.infrastructure.core.domain.JdbcSupport; import org.mifosplatform.infrastructure.core.service.Page; import org.mifosplatform.infrastructure.core.service.PaginationHelper; -import org.mifosplatform.infrastructure.core.service.TenantAwareRoutingDataSource; +import org.mifosplatform.infrastructure.core.service.RoutingDataSource; import org.mifosplatform.portfolio.group.service.SearchParameters; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.dao.EmptyResultDataAccessException; @@ -39,7 +39,7 @@ public class JournalEntryReadPlatformServiceImpl implements JournalEntryReadPlat private final PaginationHelper paginationHelper = new PaginationHelper(); @Autowired - public JournalEntryReadPlatformServiceImpl(final TenantAwareRoutingDataSource dataSource) { + public JournalEntryReadPlatformServiceImpl(final RoutingDataSource dataSource) { this.jdbcTemplate = new JdbcTemplate(dataSource); } diff --git a/mifosng-provider/src/main/java/org/mifosplatform/accounting/producttoaccountmapping/service/ProductToGLAccountMappingReadPlatformServiceImpl.java b/mifosng-provider/src/main/java/org/mifosplatform/accounting/producttoaccountmapping/service/ProductToGLAccountMappingReadPlatformServiceImpl.java index 5d6561a63..c4bf1d4aa 100755 --- a/mifosng-provider/src/main/java/org/mifosplatform/accounting/producttoaccountmapping/service/ProductToGLAccountMappingReadPlatformServiceImpl.java +++ b/mifosng-provider/src/main/java/org/mifosplatform/accounting/producttoaccountmapping/service/ProductToGLAccountMappingReadPlatformServiceImpl.java @@ -22,7 +22,7 @@ import org.mifosplatform.accounting.producttoaccountmapping.data.ChargeToGLAccou import org.mifosplatform.accounting.producttoaccountmapping.data.PaymentTypeToGLAccountMapper; import org.mifosplatform.accounting.producttoaccountmapping.domain.PortfolioProductType; import org.mifosplatform.infrastructure.core.domain.JdbcSupport; -import org.mifosplatform.infrastructure.core.service.TenantAwareRoutingDataSource; +import org.mifosplatform.infrastructure.core.service.RoutingDataSource; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.jdbc.core.JdbcTemplate; import org.springframework.jdbc.core.RowMapper; @@ -34,7 +34,7 @@ public class ProductToGLAccountMappingReadPlatformServiceImpl implements Product private final JdbcTemplate jdbcTemplate; @Autowired - public ProductToGLAccountMappingReadPlatformServiceImpl(final TenantAwareRoutingDataSource dataSource) { + public ProductToGLAccountMappingReadPlatformServiceImpl(final RoutingDataSource dataSource) { this.jdbcTemplate = new JdbcTemplate(dataSource); } diff --git a/mifosng-provider/src/main/java/org/mifosplatform/accounting/rule/service/AccountingRuleReadPlatformServiceImpl.java b/mifosng-provider/src/main/java/org/mifosplatform/accounting/rule/service/AccountingRuleReadPlatformServiceImpl.java index 22fe7f30f..0374a278a 100755 --- a/mifosng-provider/src/main/java/org/mifosplatform/accounting/rule/service/AccountingRuleReadPlatformServiceImpl.java +++ b/mifosng-provider/src/main/java/org/mifosplatform/accounting/rule/service/AccountingRuleReadPlatformServiceImpl.java @@ -23,7 +23,7 @@ import org.mifosplatform.accounting.rule.exception.AccountingRuleNotFoundExcepti import org.mifosplatform.infrastructure.codes.data.CodeValueData; import org.mifosplatform.infrastructure.core.data.EnumOptionData; import org.mifosplatform.infrastructure.core.domain.JdbcSupport; -import org.mifosplatform.infrastructure.core.service.TenantAwareRoutingDataSource; +import org.mifosplatform.infrastructure.core.service.RoutingDataSource; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.dao.DataAccessException; import org.springframework.dao.EmptyResultDataAccessException; @@ -39,7 +39,7 @@ public class AccountingRuleReadPlatformServiceImpl implements AccountingRuleRead private final GLAccountReadPlatformService glAccountReadPlatformService; @Autowired - public AccountingRuleReadPlatformServiceImpl(final TenantAwareRoutingDataSource dataSource, + public AccountingRuleReadPlatformServiceImpl(final RoutingDataSource dataSource, final GLAccountReadPlatformService glAccountReadPlatformService) { this.jdbcTemplate = new JdbcTemplate(dataSource); this.glAccountReadPlatformService = glAccountReadPlatformService; diff --git a/mifosng-provider/src/main/java/org/mifosplatform/commands/service/AuditReadPlatformServiceImpl.java b/mifosng-provider/src/main/java/org/mifosplatform/commands/service/AuditReadPlatformServiceImpl.java index cd5db8b50..80771a55e 100644 --- a/mifosng-provider/src/main/java/org/mifosplatform/commands/service/AuditReadPlatformServiceImpl.java +++ b/mifosng-provider/src/main/java/org/mifosplatform/commands/service/AuditReadPlatformServiceImpl.java @@ -20,7 +20,7 @@ import org.mifosplatform.commands.data.ProcessingResultLookup; import org.mifosplatform.infrastructure.core.domain.JdbcSupport; import org.mifosplatform.infrastructure.core.exception.PlatformDataIntegrityException; import org.mifosplatform.infrastructure.core.serialization.FromJsonHelper; -import org.mifosplatform.infrastructure.core.service.TenantAwareRoutingDataSource; +import org.mifosplatform.infrastructure.core.service.RoutingDataSource; import org.mifosplatform.infrastructure.security.service.PlatformSecurityContext; import org.mifosplatform.organisation.office.data.OfficeData; import org.mifosplatform.organisation.office.service.OfficeReadPlatformService; @@ -60,7 +60,7 @@ public class AuditReadPlatformServiceImpl implements AuditReadPlatformService { private final StaffReadPlatformService staffReadPlatformService; @Autowired - public AuditReadPlatformServiceImpl(final PlatformSecurityContext context, final TenantAwareRoutingDataSource dataSource, + public AuditReadPlatformServiceImpl(final PlatformSecurityContext context, final RoutingDataSource dataSource, final FromJsonHelper fromApiJsonHelper, final AppUserReadPlatformService appUserReadPlatformService, final OfficeReadPlatformService officeReadPlatformService, final ClientReadPlatformService clientReadPlatformService, final LoanProductReadPlatformService loanProductReadPlatformService, final StaffReadPlatformService staffReadPlatformService) { diff --git a/mifosng-provider/src/main/java/org/mifosplatform/infrastructure/codes/service/CodeReadPlatformServiceImpl.java b/mifosng-provider/src/main/java/org/mifosplatform/infrastructure/codes/service/CodeReadPlatformServiceImpl.java index 6b89051c5..efe6a09ac 100644 --- a/mifosng-provider/src/main/java/org/mifosplatform/infrastructure/codes/service/CodeReadPlatformServiceImpl.java +++ b/mifosng-provider/src/main/java/org/mifosplatform/infrastructure/codes/service/CodeReadPlatformServiceImpl.java @@ -11,7 +11,7 @@ import java.util.Collection; import org.mifosplatform.infrastructure.codes.data.CodeData; import org.mifosplatform.infrastructure.codes.exception.CodeNotFoundException; -import org.mifosplatform.infrastructure.core.service.TenantAwareRoutingDataSource; +import org.mifosplatform.infrastructure.core.service.RoutingDataSource; import org.mifosplatform.infrastructure.security.service.PlatformSecurityContext; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.dao.EmptyResultDataAccessException; @@ -26,7 +26,7 @@ public class CodeReadPlatformServiceImpl implements CodeReadPlatformService { private final PlatformSecurityContext context; @Autowired - public CodeReadPlatformServiceImpl(final PlatformSecurityContext context, final TenantAwareRoutingDataSource dataSource) { + public CodeReadPlatformServiceImpl(final PlatformSecurityContext context, final RoutingDataSource dataSource) { this.context = context; this.jdbcTemplate = new JdbcTemplate(dataSource); } diff --git a/mifosng-provider/src/main/java/org/mifosplatform/infrastructure/codes/service/CodeValueReadPlatformServiceImpl.java b/mifosng-provider/src/main/java/org/mifosplatform/infrastructure/codes/service/CodeValueReadPlatformServiceImpl.java index 492614ff7..f9a6ad304 100644 --- a/mifosng-provider/src/main/java/org/mifosplatform/infrastructure/codes/service/CodeValueReadPlatformServiceImpl.java +++ b/mifosng-provider/src/main/java/org/mifosplatform/infrastructure/codes/service/CodeValueReadPlatformServiceImpl.java @@ -10,7 +10,7 @@ import java.sql.SQLException; import java.util.Collection; import org.mifosplatform.infrastructure.codes.data.CodeValueData; -import org.mifosplatform.infrastructure.core.service.TenantAwareRoutingDataSource; +import org.mifosplatform.infrastructure.core.service.RoutingDataSource; import org.mifosplatform.infrastructure.security.service.PlatformSecurityContext; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.jdbc.core.JdbcTemplate; @@ -24,7 +24,7 @@ public class CodeValueReadPlatformServiceImpl implements CodeValueReadPlatformSe private final PlatformSecurityContext context; @Autowired - public CodeValueReadPlatformServiceImpl(final PlatformSecurityContext context, final TenantAwareRoutingDataSource dataSource) { + public CodeValueReadPlatformServiceImpl(final PlatformSecurityContext context, final RoutingDataSource dataSource) { this.context = context; this.jdbcTemplate = new JdbcTemplate(dataSource); } diff --git a/mifosng-provider/src/main/java/org/mifosplatform/infrastructure/configuration/service/ConfigurationReadPlatformServiceImpl.java b/mifosng-provider/src/main/java/org/mifosplatform/infrastructure/configuration/service/ConfigurationReadPlatformServiceImpl.java index 1993e6c3e..f2b3af82f 100644 --- a/mifosng-provider/src/main/java/org/mifosplatform/infrastructure/configuration/service/ConfigurationReadPlatformServiceImpl.java +++ b/mifosng-provider/src/main/java/org/mifosplatform/infrastructure/configuration/service/ConfigurationReadPlatformServiceImpl.java @@ -11,7 +11,7 @@ import java.util.List; import org.mifosplatform.infrastructure.configuration.data.GlobalConfigurationData; import org.mifosplatform.infrastructure.configuration.data.GlobalConfigurationPropertyData; -import org.mifosplatform.infrastructure.core.service.TenantAwareRoutingDataSource; +import org.mifosplatform.infrastructure.core.service.RoutingDataSource; import org.mifosplatform.infrastructure.security.service.PlatformSecurityContext; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.jdbc.core.JdbcTemplate; @@ -26,7 +26,7 @@ public class ConfigurationReadPlatformServiceImpl implements ConfigurationReadPl private final RowMapper rm; @Autowired - public ConfigurationReadPlatformServiceImpl(final PlatformSecurityContext context, final TenantAwareRoutingDataSource dataSource) { + public ConfigurationReadPlatformServiceImpl(final PlatformSecurityContext context, final RoutingDataSource dataSource) { this.context = context; this.jdbcTemplate = new JdbcTemplate(dataSource); diff --git a/mifosng-provider/src/main/java/org/mifosplatform/infrastructure/configuration/service/ExternalServicesReadPlatformServiceImpl.java b/mifosng-provider/src/main/java/org/mifosplatform/infrastructure/configuration/service/ExternalServicesReadPlatformServiceImpl.java index 83ec84d65..e1f2ce2e1 100644 --- a/mifosng-provider/src/main/java/org/mifosplatform/infrastructure/configuration/service/ExternalServicesReadPlatformServiceImpl.java +++ b/mifosng-provider/src/main/java/org/mifosplatform/infrastructure/configuration/service/ExternalServicesReadPlatformServiceImpl.java @@ -4,7 +4,7 @@ import java.sql.ResultSet; import java.sql.SQLException; import org.mifosplatform.infrastructure.configuration.data.S3CredentialsData; -import org.mifosplatform.infrastructure.core.service.TenantAwareRoutingDataSource; +import org.mifosplatform.infrastructure.core.service.RoutingDataSource; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.dao.DataAccessException; import org.springframework.jdbc.core.JdbcTemplate; @@ -17,7 +17,7 @@ public class ExternalServicesReadPlatformServiceImpl implements ExternalServices private final JdbcTemplate jdbcTemplate; @Autowired - public ExternalServicesReadPlatformServiceImpl(final TenantAwareRoutingDataSource dataSource) { + public ExternalServicesReadPlatformServiceImpl(final RoutingDataSource dataSource) { this.jdbcTemplate = new JdbcTemplate(dataSource); } diff --git a/mifosng-provider/src/main/java/org/mifosplatform/infrastructure/core/domain/MifosPlatformTenant.java b/mifosng-provider/src/main/java/org/mifosplatform/infrastructure/core/domain/MifosPlatformTenant.java index 83ff28d20..150f073df 100644 --- a/mifosng-provider/src/main/java/org/mifosplatform/infrastructure/core/domain/MifosPlatformTenant.java +++ b/mifosng-provider/src/main/java/org/mifosplatform/infrastructure/core/domain/MifosPlatformTenant.java @@ -5,22 +5,54 @@ */ package org.mifosplatform.infrastructure.core.domain; -public class MifosPlatformTenant { +import javax.persistence.Column; +import javax.persistence.Entity; +import javax.persistence.Table; - private final Long id; - private final String name; - private final String schemaName; - private final String schemaServer; - private final String schemaServerPort; - private final String schemaUsername; - private final String schemaPassword; - private final String timezoneId; - private final boolean autoUpdateEnabled; +import org.springframework.data.jpa.domain.AbstractPersistable; - public MifosPlatformTenant(final Long id, final String name, final String schemaName, final String schemaServer, + +@Entity +@Table(name = "tenants") +public class MifosPlatformTenant extends AbstractPersistable{ + + @Column(name="identifier") + private String tenantIdentifier; + + @Column(name = "name") + private String name; + + @Column(name = "schema_name") + private String schemaName; + + @Column(name = "schema_server") + private String schemaServer; + + @Column(name = "schema_server_port") + private String schemaServerPort; + + @Column(name = "schema_username") + private String schemaUsername; + + @Column(name = "schema_password") + private String schemaPassword; + + @Column(name = "timezone_id") + private String timezoneId; + + @Column(name = "auto_update") + private boolean autoUpdateEnabled; + + + public MifosPlatformTenant() { + + } + + public MifosPlatformTenant(final Long id,final String tenantIdentifier, final String name, final String schemaName, final String schemaServer, final String schemaServerPort, final String schemaUsername, final String schemaPassword, String timezoneId, final boolean autoUpdateEnabled) { - this.id = id; + setId(id); + this.tenantIdentifier = tenantIdentifier; this.name = name; this.schemaName = schemaName; this.schemaServer = schemaServer; @@ -38,8 +70,9 @@ public class MifosPlatformTenant { return url; } - public Long getId() { - return id; + + public String getTenantIdentifier() { + return this.tenantIdentifier; } public String getName() { diff --git a/mifosng-provider/src/main/java/org/mifosplatform/infrastructure/core/service/DataSourceForTenants.java b/mifosng-provider/src/main/java/org/mifosplatform/infrastructure/core/service/DataSourceForTenants.java new file mode 100755 index 000000000..514e8cfdc --- /dev/null +++ b/mifosng-provider/src/main/java/org/mifosplatform/infrastructure/core/service/DataSourceForTenants.java @@ -0,0 +1,27 @@ +package org.mifosplatform.infrastructure.core.service; + +import javax.sql.DataSource; + +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.beans.factory.annotation.Qualifier; +import org.springframework.stereotype.Service; + +/** + * Implementation that returns connection pool datasource for tenants database + */ +@Service +public class DataSourceForTenants implements RoutingDataSourceService { + + private final DataSource tenantDataSource; + + @Autowired + public DataSourceForTenants(final @Qualifier("tenantDataSourceJndi") DataSource tenantDataSource) { + this.tenantDataSource = tenantDataSource; + } + + @Override + public DataSource retrieveDataSource() { + return this.tenantDataSource; + } + +} diff --git a/mifosng-provider/src/main/java/org/mifosplatform/infrastructure/core/service/TenantAwareRoutingDataSource.java b/mifosng-provider/src/main/java/org/mifosplatform/infrastructure/core/service/RoutingDataSource.java similarity index 80% rename from mifosng-provider/src/main/java/org/mifosplatform/infrastructure/core/service/TenantAwareRoutingDataSource.java rename to mifosng-provider/src/main/java/org/mifosplatform/infrastructure/core/service/RoutingDataSource.java index b73f270a9..163fa419f 100644 --- a/mifosng-provider/src/main/java/org/mifosplatform/infrastructure/core/service/TenantAwareRoutingDataSource.java +++ b/mifosng-provider/src/main/java/org/mifosplatform/infrastructure/core/service/RoutingDataSource.java @@ -22,14 +22,14 @@ import org.springframework.stereotype.Service; * * The tenant details are process earlier and stored in a {@link ThreadLocal}. * - * The {@link DataSourcePerTenantService} is responsible for returning the + * The {@link RoutingDataSourceService} is responsible for returning the * appropriate {@link DataSource} for the tenant of this request. */ -@Service(value = "tenantAwareDataSource") -public class TenantAwareRoutingDataSource extends AbstractDataSource { +@Service(value = "routingDataSource") +public class RoutingDataSource extends AbstractDataSource { @Autowired - private DataSourcePerTenantService dataSourcePerTenantService; + private RoutingDataSourceServiceFactory dataSourceServiceFactory; @Override public Connection getConnection() throws SQLException { @@ -37,7 +37,7 @@ public class TenantAwareRoutingDataSource extends AbstractDataSource { } private DataSource determineTargetDataSource() { - return dataSourcePerTenantService.retrieveTenantAwareDataSource(); + return dataSourceServiceFactory.determineDataSourceService().retrieveDataSource(); } @Override diff --git a/mifosng-provider/src/main/java/org/mifosplatform/infrastructure/core/service/DataSourcePerTenantService.java b/mifosng-provider/src/main/java/org/mifosplatform/infrastructure/core/service/RoutingDataSourceService.java similarity index 75% rename from mifosng-provider/src/main/java/org/mifosplatform/infrastructure/core/service/DataSourcePerTenantService.java rename to mifosng-provider/src/main/java/org/mifosplatform/infrastructure/core/service/RoutingDataSourceService.java index 2ddf0dc05..3634c4b72 100644 --- a/mifosng-provider/src/main/java/org/mifosplatform/infrastructure/core/service/DataSourcePerTenantService.java +++ b/mifosng-provider/src/main/java/org/mifosplatform/infrastructure/core/service/RoutingDataSourceService.java @@ -9,9 +9,9 @@ import javax.sql.DataSource; /** * A service for getting hold of the appropriate {@link DataSource} connection - * pool for the given tenant. + * pool. */ -public interface DataSourcePerTenantService { +public interface RoutingDataSourceService { - DataSource retrieveTenantAwareDataSource(); + DataSource retrieveDataSource(); } \ No newline at end of file diff --git a/mifosng-provider/src/main/java/org/mifosplatform/infrastructure/core/service/RoutingDataSourceServiceFactory.java b/mifosng-provider/src/main/java/org/mifosplatform/infrastructure/core/service/RoutingDataSourceServiceFactory.java new file mode 100755 index 000000000..d7c025c71 --- /dev/null +++ b/mifosng-provider/src/main/java/org/mifosplatform/infrastructure/core/service/RoutingDataSourceServiceFactory.java @@ -0,0 +1,28 @@ +package org.mifosplatform.infrastructure.core.service; + +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.context.ApplicationContext; +import org.springframework.stereotype.Component; + +/** + * Factory class to get data source service based on the details stored in + * {@link ThreadLocal} variable for this request + * + * {@link ThreadLocalContextUtil} is used to retrieve the Context + * + */ +@Component +public class RoutingDataSourceServiceFactory { + + @Autowired + private ApplicationContext applicationContext; + + public RoutingDataSourceService determineDataSourceService() { + String serviceName = "tomcatJdbcDataSourcePerTenantService"; + if (ThreadLocalContextUtil.CONTEXT_TENANTS.equalsIgnoreCase(ThreadLocalContextUtil.getDataSourceContext())) { + serviceName = "dataSourceForTenants"; + } + return applicationContext.getBean(serviceName, RoutingDataSourceService.class); + + } +} diff --git a/mifosng-provider/src/main/java/org/mifosplatform/infrastructure/core/service/ThreadLocalContextUtil.java b/mifosng-provider/src/main/java/org/mifosplatform/infrastructure/core/service/ThreadLocalContextUtil.java index 05866cbe5..5b347fa92 100644 --- a/mifosng-provider/src/main/java/org/mifosplatform/infrastructure/core/service/ThreadLocalContextUtil.java +++ b/mifosng-provider/src/main/java/org/mifosplatform/infrastructure/core/service/ThreadLocalContextUtil.java @@ -13,18 +13,35 @@ import org.springframework.util.Assert; */ public class ThreadLocalContextUtil { - private static final ThreadLocal contextHolder = new ThreadLocal(); + public static final String CONTEXT_TENANTS = "tenants"; + + private static final ThreadLocal contextHolder = new ThreadLocal(); + + private static final ThreadLocal tenantcontext = new ThreadLocal(); public static void setTenant(final MifosPlatformTenant tenant) { Assert.notNull(tenant, "tenant cannot be null"); - contextHolder.set(tenant); + tenantcontext.set(tenant); } public static MifosPlatformTenant getTenant() { - return contextHolder.get(); + return tenantcontext.get(); } public static void clearTenant() { + tenantcontext.remove(); + } + + public static String getDataSourceContext() { + return contextHolder.get(); + } + + public static void setDataSourceContext(final String dataSourceContext) { + contextHolder.set(dataSourceContext); + } + + public static void clearDataSourceContext() { contextHolder.remove(); } + } \ No newline at end of file diff --git a/mifosng-provider/src/main/java/org/mifosplatform/infrastructure/core/service/TomcatJdbcDataSourcePerTenantService.java b/mifosng-provider/src/main/java/org/mifosplatform/infrastructure/core/service/TomcatJdbcDataSourcePerTenantService.java index c3ee791de..663870b9e 100644 --- a/mifosng-provider/src/main/java/org/mifosplatform/infrastructure/core/service/TomcatJdbcDataSourcePerTenantService.java +++ b/mifosng-provider/src/main/java/org/mifosplatform/infrastructure/core/service/TomcatJdbcDataSourcePerTenantService.java @@ -26,7 +26,7 @@ import org.springframework.stereotype.Service; * {@link MifosPlatformTenant} for the request. */ @Service -public class TomcatJdbcDataSourcePerTenantService implements DataSourcePerTenantService { +public class TomcatJdbcDataSourcePerTenantService implements RoutingDataSourceService { private final Map tenantToDataSourceMap = new HashMap(1); private final DataSource tenantDataSource; @@ -37,7 +37,7 @@ public class TomcatJdbcDataSourcePerTenantService implements DataSourcePerTenant } @Override - public DataSource retrieveTenantAwareDataSource() { + public DataSource retrieveDataSource() { // default to tenant database datasource DataSource tenantDataSource = this.tenantDataSource; diff --git a/mifosng-provider/src/main/java/org/mifosplatform/infrastructure/dataqueries/service/GenericDataServiceImpl.java b/mifosng-provider/src/main/java/org/mifosplatform/infrastructure/dataqueries/service/GenericDataServiceImpl.java index af062e423..7eb592108 100644 --- a/mifosng-provider/src/main/java/org/mifosplatform/infrastructure/dataqueries/service/GenericDataServiceImpl.java +++ b/mifosng-provider/src/main/java/org/mifosplatform/infrastructure/dataqueries/service/GenericDataServiceImpl.java @@ -11,7 +11,7 @@ import java.util.List; import javax.sql.DataSource; import org.joda.time.LocalDate; -import org.mifosplatform.infrastructure.core.service.TenantAwareRoutingDataSource; +import org.mifosplatform.infrastructure.core.service.RoutingDataSource; import org.mifosplatform.infrastructure.dataqueries.data.GenericResultsetData; import org.mifosplatform.infrastructure.dataqueries.data.ResultsetColumnHeaderData; import org.mifosplatform.infrastructure.dataqueries.data.ResultsetColumnValueData; @@ -30,7 +30,7 @@ public class GenericDataServiceImpl implements GenericDataService { private final DataSource dataSource; @Autowired - public GenericDataServiceImpl(final TenantAwareRoutingDataSource dataSource) { + public GenericDataServiceImpl(final RoutingDataSource dataSource) { this.dataSource = dataSource; this.jdbcTemplate = new JdbcTemplate(this.dataSource); } diff --git a/mifosng-provider/src/main/java/org/mifosplatform/infrastructure/dataqueries/service/ReadReportingServiceImpl.java b/mifosng-provider/src/main/java/org/mifosplatform/infrastructure/dataqueries/service/ReadReportingServiceImpl.java index a8c5ddcb6..025af12e3 100644 --- a/mifosng-provider/src/main/java/org/mifosplatform/infrastructure/dataqueries/service/ReadReportingServiceImpl.java +++ b/mifosng-provider/src/main/java/org/mifosplatform/infrastructure/dataqueries/service/ReadReportingServiceImpl.java @@ -30,7 +30,7 @@ import javax.ws.rs.core.StreamingOutput; import org.apache.commons.lang.StringUtils; import org.mifosplatform.infrastructure.core.domain.JdbcSupport; import org.mifosplatform.infrastructure.core.exception.PlatformDataIntegrityException; -import org.mifosplatform.infrastructure.core.service.TenantAwareRoutingDataSource; +import org.mifosplatform.infrastructure.core.service.RoutingDataSource; import org.mifosplatform.infrastructure.dataqueries.data.GenericResultsetData; import org.mifosplatform.infrastructure.dataqueries.data.ReportData; import org.mifosplatform.infrastructure.dataqueries.data.ReportParameterData; @@ -80,7 +80,7 @@ public class ReadReportingServiceImpl implements ReadReportingService { private boolean noPentaho = false; @Autowired - public ReadReportingServiceImpl(final PlatformSecurityContext context, final TenantAwareRoutingDataSource dataSource, + public ReadReportingServiceImpl(final PlatformSecurityContext context, final RoutingDataSource dataSource, final GenericDataService genericDataService) { // kick off pentaho reports server ClassicEngineBoot.getInstance().start(); diff --git a/mifosng-provider/src/main/java/org/mifosplatform/infrastructure/dataqueries/service/ReadWriteNonCoreDataServiceImpl.java b/mifosng-provider/src/main/java/org/mifosplatform/infrastructure/dataqueries/service/ReadWriteNonCoreDataServiceImpl.java index ce884cb1b..4969eaf31 100644 --- a/mifosng-provider/src/main/java/org/mifosplatform/infrastructure/dataqueries/service/ReadWriteNonCoreDataServiceImpl.java +++ b/mifosng-provider/src/main/java/org/mifosplatform/infrastructure/dataqueries/service/ReadWriteNonCoreDataServiceImpl.java @@ -30,7 +30,7 @@ import org.mifosplatform.infrastructure.core.exception.PlatformDataIntegrityExce import org.mifosplatform.infrastructure.core.serialization.DatatableCommandFromApiJsonDeserializer; import org.mifosplatform.infrastructure.core.serialization.FromJsonHelper; import org.mifosplatform.infrastructure.core.serialization.JsonParserHelper; -import org.mifosplatform.infrastructure.core.service.TenantAwareRoutingDataSource; +import org.mifosplatform.infrastructure.core.service.RoutingDataSource; import org.mifosplatform.infrastructure.dataqueries.data.DatatableData; import org.mifosplatform.infrastructure.dataqueries.data.GenericResultsetData; import org.mifosplatform.infrastructure.dataqueries.data.ResultsetColumnHeaderData; @@ -82,7 +82,7 @@ public class ReadWriteNonCoreDataServiceImpl implements ReadWriteNonCoreDataServ private final DatatableCommandFromApiJsonDeserializer fromApiJsonDeserializer; @Autowired - public ReadWriteNonCoreDataServiceImpl(final TenantAwareRoutingDataSource dataSource, final PlatformSecurityContext context, + public ReadWriteNonCoreDataServiceImpl(final RoutingDataSource dataSource, final PlatformSecurityContext context, final FromJsonHelper fromJsonHelper, final GenericDataService genericDataService, final DatatableCommandFromApiJsonDeserializer fromApiJsonDeserializer) { this.dataSource = dataSource; diff --git a/mifosng-provider/src/main/java/org/mifosplatform/infrastructure/documentmanagement/service/DocumentReadPlatformServiceImpl.java b/mifosng-provider/src/main/java/org/mifosplatform/infrastructure/documentmanagement/service/DocumentReadPlatformServiceImpl.java index dfedcce55..1b3d31d9b 100644 --- a/mifosng-provider/src/main/java/org/mifosplatform/infrastructure/documentmanagement/service/DocumentReadPlatformServiceImpl.java +++ b/mifosng-provider/src/main/java/org/mifosplatform/infrastructure/documentmanagement/service/DocumentReadPlatformServiceImpl.java @@ -6,7 +6,7 @@ package org.mifosplatform.infrastructure.documentmanagement.service; import org.mifosplatform.infrastructure.core.domain.JdbcSupport; -import org.mifosplatform.infrastructure.core.service.TenantAwareRoutingDataSource; +import org.mifosplatform.infrastructure.core.service.RoutingDataSource; import org.mifosplatform.infrastructure.documentmanagement.contentrepository.ContentRepository; import org.mifosplatform.infrastructure.documentmanagement.contentrepository.ContentRepositoryFactory; import org.mifosplatform.infrastructure.documentmanagement.data.DocumentData; @@ -31,7 +31,7 @@ public class DocumentReadPlatformServiceImpl implements DocumentReadPlatformServ private final ContentRepositoryFactory contentRepositoryFactory; @Autowired - public DocumentReadPlatformServiceImpl(final PlatformSecurityContext context, final TenantAwareRoutingDataSource dataSource, + public DocumentReadPlatformServiceImpl(final PlatformSecurityContext context, final RoutingDataSource dataSource, final ContentRepositoryFactory documentStoreFactory) { this.context = context; this.jdbcTemplate = new JdbcTemplate(dataSource); diff --git a/mifosng-provider/src/main/java/org/mifosplatform/infrastructure/documentmanagement/service/ImageReadPlatformServiceImpl.java b/mifosng-provider/src/main/java/org/mifosplatform/infrastructure/documentmanagement/service/ImageReadPlatformServiceImpl.java index c4e560658..173d11a83 100755 --- a/mifosng-provider/src/main/java/org/mifosplatform/infrastructure/documentmanagement/service/ImageReadPlatformServiceImpl.java +++ b/mifosng-provider/src/main/java/org/mifosplatform/infrastructure/documentmanagement/service/ImageReadPlatformServiceImpl.java @@ -9,7 +9,7 @@ import java.sql.ResultSet; import java.sql.SQLException; import org.mifosplatform.infrastructure.core.domain.JdbcSupport; -import org.mifosplatform.infrastructure.core.service.TenantAwareRoutingDataSource; +import org.mifosplatform.infrastructure.core.service.RoutingDataSource; import org.mifosplatform.infrastructure.documentmanagement.contentrepository.ContentRepository; import org.mifosplatform.infrastructure.documentmanagement.contentrepository.ContentRepositoryFactory; import org.mifosplatform.infrastructure.documentmanagement.data.ImageData; @@ -30,7 +30,7 @@ public class ImageReadPlatformServiceImpl implements ImageReadPlatformService { private final ClientRepositoryWrapper clientRepositoryWrapper; @Autowired - public ImageReadPlatformServiceImpl(final TenantAwareRoutingDataSource dataSource, final ContentRepositoryFactory documentStoreFactory, + public ImageReadPlatformServiceImpl(final RoutingDataSource dataSource, final ContentRepositoryFactory documentStoreFactory, final ClientRepositoryWrapper clientRepositoryWrapper) { this.jdbcTemplate = new JdbcTemplate(dataSource); this.contentRepositoryFactory = documentStoreFactory; diff --git a/mifosng-provider/src/main/java/org/mifosplatform/infrastructure/security/service/JdbcTenantDetailsService.java b/mifosng-provider/src/main/java/org/mifosplatform/infrastructure/security/service/JdbcTenantDetailsService.java index c286e7c2b..8f04bd37b 100644 --- a/mifosng-provider/src/main/java/org/mifosplatform/infrastructure/security/service/JdbcTenantDetailsService.java +++ b/mifosng-provider/src/main/java/org/mifosplatform/infrastructure/security/service/JdbcTenantDetailsService.java @@ -37,7 +37,7 @@ public class JdbcTenantDetailsService implements TenantDetailsService { private static final class TenantMapper implements RowMapper { private StringBuilder sqlBuilder = new StringBuilder( - "id, name, schema_name as schemaName, schema_server as schemaServer, schema_server_port as schemaServerPort, auto_update as autoUpdate, ")// + "id, name,identifier, schema_name as schemaName, schema_server as schemaServer, schema_server_port as schemaServerPort, auto_update as autoUpdate, ")// .append(" schema_username as schemaUsername, schema_password as schemaPassword , timezone_id as timezoneId ")// .append(" from tenants t");// @@ -49,6 +49,7 @@ public class JdbcTenantDetailsService implements TenantDetailsService { public MifosPlatformTenant mapRow(final ResultSet rs, @SuppressWarnings("unused") final int rowNum) throws SQLException { Long id = rs.getLong("id"); + String tenantIdentifier = rs.getString("identifier"); String name = rs.getString("name"); String schemaName = rs.getString("schemaName"); String schemaServer = rs.getString("schemaServer"); @@ -58,7 +59,7 @@ public class JdbcTenantDetailsService implements TenantDetailsService { String timezoneId = rs.getString("timezoneId"); boolean autoUpdateEnabled = rs.getBoolean("autoUpdate"); - return new MifosPlatformTenant(id, name, schemaName, schemaServer, schemaServerPort, schemaUsername, schemaPassword, + return new MifosPlatformTenant(id, tenantIdentifier,name, schemaName, schemaServer, schemaServerPort, schemaUsername, schemaPassword, timezoneId, autoUpdateEnabled); } } diff --git a/mifosng-provider/src/main/java/org/mifosplatform/organisation/monetary/service/CurrencyReadPlatformServiceImpl.java b/mifosng-provider/src/main/java/org/mifosplatform/organisation/monetary/service/CurrencyReadPlatformServiceImpl.java index f481437e2..661a58bc8 100644 --- a/mifosng-provider/src/main/java/org/mifosplatform/organisation/monetary/service/CurrencyReadPlatformServiceImpl.java +++ b/mifosng-provider/src/main/java/org/mifosplatform/organisation/monetary/service/CurrencyReadPlatformServiceImpl.java @@ -10,7 +10,7 @@ import java.sql.SQLException; import java.util.Collection; import org.mifosplatform.infrastructure.core.domain.JdbcSupport; -import org.mifosplatform.infrastructure.core.service.TenantAwareRoutingDataSource; +import org.mifosplatform.infrastructure.core.service.RoutingDataSource; import org.mifosplatform.infrastructure.security.service.PlatformSecurityContext; import org.mifosplatform.organisation.monetary.data.CurrencyData; import org.springframework.beans.factory.annotation.Autowired; @@ -26,7 +26,7 @@ public class CurrencyReadPlatformServiceImpl implements CurrencyReadPlatformServ private final CurrencyMapper currencyRowMapper; @Autowired - public CurrencyReadPlatformServiceImpl(final PlatformSecurityContext context, final TenantAwareRoutingDataSource dataSource) { + public CurrencyReadPlatformServiceImpl(final PlatformSecurityContext context, final RoutingDataSource dataSource) { this.context = context; this.jdbcTemplate = new JdbcTemplate(dataSource); this.currencyRowMapper = new CurrencyMapper(); diff --git a/mifosng-provider/src/main/java/org/mifosplatform/organisation/office/service/OfficeReadPlatformServiceImpl.java b/mifosng-provider/src/main/java/org/mifosplatform/organisation/office/service/OfficeReadPlatformServiceImpl.java index 5a0162570..564da7eee 100644 --- a/mifosng-provider/src/main/java/org/mifosplatform/organisation/office/service/OfficeReadPlatformServiceImpl.java +++ b/mifosng-provider/src/main/java/org/mifosplatform/organisation/office/service/OfficeReadPlatformServiceImpl.java @@ -13,7 +13,7 @@ import java.util.Collection; import org.joda.time.LocalDate; import org.mifosplatform.infrastructure.core.domain.JdbcSupport; -import org.mifosplatform.infrastructure.core.service.TenantAwareRoutingDataSource; +import org.mifosplatform.infrastructure.core.service.RoutingDataSource; import org.mifosplatform.infrastructure.security.service.PlatformSecurityContext; import org.mifosplatform.organisation.monetary.data.CurrencyData; import org.mifosplatform.organisation.monetary.service.CurrencyReadPlatformService; @@ -37,7 +37,7 @@ public class OfficeReadPlatformServiceImpl implements OfficeReadPlatformService @Autowired public OfficeReadPlatformServiceImpl(final PlatformSecurityContext context, - final CurrencyReadPlatformService currencyReadPlatformService, final TenantAwareRoutingDataSource dataSource) { + final CurrencyReadPlatformService currencyReadPlatformService, final RoutingDataSource dataSource) { this.context = context; this.currencyReadPlatformService = currencyReadPlatformService; this.jdbcTemplate = new JdbcTemplate(dataSource); diff --git a/mifosng-provider/src/main/java/org/mifosplatform/organisation/staff/service/StaffReadPlatformServiceImpl.java b/mifosng-provider/src/main/java/org/mifosplatform/organisation/staff/service/StaffReadPlatformServiceImpl.java index 5e71696e6..cbd0d1791 100644 --- a/mifosng-provider/src/main/java/org/mifosplatform/organisation/staff/service/StaffReadPlatformServiceImpl.java +++ b/mifosng-provider/src/main/java/org/mifosplatform/organisation/staff/service/StaffReadPlatformServiceImpl.java @@ -10,7 +10,7 @@ import java.sql.SQLException; import java.util.Collection; import org.apache.commons.lang.StringUtils; -import org.mifosplatform.infrastructure.core.service.TenantAwareRoutingDataSource; +import org.mifosplatform.infrastructure.core.service.RoutingDataSource; import org.mifosplatform.infrastructure.security.service.PlatformSecurityContext; import org.mifosplatform.organisation.staff.data.StaffData; import org.mifosplatform.organisation.staff.exception.StaffNotFoundException; @@ -29,7 +29,7 @@ public class StaffReadPlatformServiceImpl implements StaffReadPlatformService { private final StaffInOfficeHierarchyMapper staffInOfficeHierarchyMapper = new StaffInOfficeHierarchyMapper(); @Autowired - public StaffReadPlatformServiceImpl(final PlatformSecurityContext context, final TenantAwareRoutingDataSource dataSource) { + public StaffReadPlatformServiceImpl(final PlatformSecurityContext context, final RoutingDataSource dataSource) { this.context = context; this.jdbcTemplate = new JdbcTemplate(dataSource); } diff --git a/mifosng-provider/src/main/java/org/mifosplatform/portfolio/calendar/service/CalendarReadPlatformServiceImpl.java b/mifosng-provider/src/main/java/org/mifosplatform/portfolio/calendar/service/CalendarReadPlatformServiceImpl.java index 8069b7463..9927279ea 100644 --- a/mifosng-provider/src/main/java/org/mifosplatform/portfolio/calendar/service/CalendarReadPlatformServiceImpl.java +++ b/mifosng-provider/src/main/java/org/mifosplatform/portfolio/calendar/service/CalendarReadPlatformServiceImpl.java @@ -15,7 +15,7 @@ import org.joda.time.LocalDate; import org.mifosplatform.infrastructure.core.data.EnumOptionData; import org.mifosplatform.infrastructure.core.domain.JdbcSupport; import org.mifosplatform.infrastructure.core.service.DateUtils; -import org.mifosplatform.infrastructure.core.service.TenantAwareRoutingDataSource; +import org.mifosplatform.infrastructure.core.service.RoutingDataSource; import org.mifosplatform.portfolio.calendar.data.CalendarData; import org.mifosplatform.portfolio.calendar.domain.CalendarEntityType; import org.mifosplatform.portfolio.calendar.exception.CalendarNotFoundException; @@ -32,7 +32,7 @@ public class CalendarReadPlatformServiceImpl implements CalendarReadPlatformServ private final JdbcTemplate jdbcTemplate; @Autowired - public CalendarReadPlatformServiceImpl(final TenantAwareRoutingDataSource dataSource) { + public CalendarReadPlatformServiceImpl(final RoutingDataSource dataSource) { this.jdbcTemplate = new JdbcTemplate(dataSource); } diff --git a/mifosng-provider/src/main/java/org/mifosplatform/portfolio/charge/service/ChargeReadPlatformServiceImpl.java b/mifosng-provider/src/main/java/org/mifosplatform/portfolio/charge/service/ChargeReadPlatformServiceImpl.java index 4031760b9..c18d08db2 100644 --- a/mifosng-provider/src/main/java/org/mifosplatform/portfolio/charge/service/ChargeReadPlatformServiceImpl.java +++ b/mifosng-provider/src/main/java/org/mifosplatform/portfolio/charge/service/ChargeReadPlatformServiceImpl.java @@ -13,7 +13,7 @@ import java.util.List; import org.mifosplatform.infrastructure.core.data.EnumOptionData; import org.mifosplatform.infrastructure.core.domain.JdbcSupport; -import org.mifosplatform.infrastructure.core.service.TenantAwareRoutingDataSource; +import org.mifosplatform.infrastructure.core.service.RoutingDataSource; import org.mifosplatform.infrastructure.security.service.PlatformSecurityContext; import org.mifosplatform.organisation.monetary.data.CurrencyData; import org.mifosplatform.organisation.monetary.service.CurrencyReadPlatformService; @@ -37,7 +37,7 @@ public class ChargeReadPlatformServiceImpl implements ChargeReadPlatformService @Autowired public ChargeReadPlatformServiceImpl(final PlatformSecurityContext context, final CurrencyReadPlatformService currencyReadPlatformService, - final ChargeDropdownReadPlatformService chargeDropdownReadPlatformService, final TenantAwareRoutingDataSource dataSource) { + final ChargeDropdownReadPlatformService chargeDropdownReadPlatformService, final RoutingDataSource dataSource) { this.context = context; this.chargeDropdownReadPlatformService = chargeDropdownReadPlatformService; this.jdbcTemplate = new JdbcTemplate(dataSource); diff --git a/mifosng-provider/src/main/java/org/mifosplatform/portfolio/client/service/ClientIdentifierReadPlatformServiceImpl.java b/mifosng-provider/src/main/java/org/mifosplatform/portfolio/client/service/ClientIdentifierReadPlatformServiceImpl.java index 1e2121180..e36d9a2d1 100755 --- a/mifosng-provider/src/main/java/org/mifosplatform/portfolio/client/service/ClientIdentifierReadPlatformServiceImpl.java +++ b/mifosng-provider/src/main/java/org/mifosplatform/portfolio/client/service/ClientIdentifierReadPlatformServiceImpl.java @@ -11,7 +11,7 @@ import java.util.Collection; import org.mifosplatform.infrastructure.codes.data.CodeValueData; import org.mifosplatform.infrastructure.core.domain.JdbcSupport; -import org.mifosplatform.infrastructure.core.service.TenantAwareRoutingDataSource; +import org.mifosplatform.infrastructure.core.service.RoutingDataSource; import org.mifosplatform.infrastructure.security.service.PlatformSecurityContext; import org.mifosplatform.portfolio.client.data.ClientIdentifierData; import org.mifosplatform.portfolio.client.exception.ClientIdentifierNotFoundException; @@ -29,7 +29,7 @@ public class ClientIdentifierReadPlatformServiceImpl implements ClientIdentifier private final PlatformSecurityContext context; @Autowired - public ClientIdentifierReadPlatformServiceImpl(final PlatformSecurityContext context, final TenantAwareRoutingDataSource dataSource) { + public ClientIdentifierReadPlatformServiceImpl(final PlatformSecurityContext context, final RoutingDataSource dataSource) { this.context = context; this.jdbcTemplate = new JdbcTemplate(dataSource); } diff --git a/mifosng-provider/src/main/java/org/mifosplatform/portfolio/client/service/ClientReadPlatformServiceImpl.java b/mifosng-provider/src/main/java/org/mifosplatform/portfolio/client/service/ClientReadPlatformServiceImpl.java index bfdd95966..4cef44bb0 100644 --- a/mifosng-provider/src/main/java/org/mifosplatform/portfolio/client/service/ClientReadPlatformServiceImpl.java +++ b/mifosng-provider/src/main/java/org/mifosplatform/portfolio/client/service/ClientReadPlatformServiceImpl.java @@ -20,7 +20,7 @@ import org.mifosplatform.infrastructure.core.data.EnumOptionData; import org.mifosplatform.infrastructure.core.domain.JdbcSupport; import org.mifosplatform.infrastructure.core.service.Page; import org.mifosplatform.infrastructure.core.service.PaginationHelper; -import org.mifosplatform.infrastructure.core.service.TenantAwareRoutingDataSource; +import org.mifosplatform.infrastructure.core.service.RoutingDataSource; import org.mifosplatform.infrastructure.security.service.PlatformSecurityContext; import org.mifosplatform.organisation.office.data.OfficeData; import org.mifosplatform.organisation.office.service.OfficeReadPlatformService; @@ -63,7 +63,7 @@ public class ClientReadPlatformServiceImpl implements ClientReadPlatformService private final ParentGroupsMapper clientGroupsMapper = new ParentGroupsMapper(); @Autowired - public ClientReadPlatformServiceImpl(final PlatformSecurityContext context, final TenantAwareRoutingDataSource dataSource, + public ClientReadPlatformServiceImpl(final PlatformSecurityContext context, final RoutingDataSource dataSource, final OfficeReadPlatformService officeReadPlatformService, final StaffReadPlatformService staffReadPlatformService, final CodeValueReadPlatformService codeValueReadPlatformService) { this.context = context; diff --git a/mifosng-provider/src/main/java/org/mifosplatform/portfolio/collateral/service/CollateralReadPlatformServiceImpl.java b/mifosng-provider/src/main/java/org/mifosplatform/portfolio/collateral/service/CollateralReadPlatformServiceImpl.java index 54f9fb5aa..53703d30d 100644 --- a/mifosng-provider/src/main/java/org/mifosplatform/portfolio/collateral/service/CollateralReadPlatformServiceImpl.java +++ b/mifosng-provider/src/main/java/org/mifosplatform/portfolio/collateral/service/CollateralReadPlatformServiceImpl.java @@ -12,7 +12,7 @@ import java.util.List; import org.mifosplatform.infrastructure.codes.data.CodeValueData; import org.mifosplatform.infrastructure.core.domain.JdbcSupport; -import org.mifosplatform.infrastructure.core.service.TenantAwareRoutingDataSource; +import org.mifosplatform.infrastructure.core.service.RoutingDataSource; import org.mifosplatform.infrastructure.security.service.PlatformSecurityContext; import org.mifosplatform.organisation.monetary.data.CurrencyData; import org.mifosplatform.portfolio.collateral.data.CollateralData; @@ -34,7 +34,7 @@ public class CollateralReadPlatformServiceImpl implements CollateralReadPlatform private final LoanRepository loanRepository; @Autowired - public CollateralReadPlatformServiceImpl(final PlatformSecurityContext context, final TenantAwareRoutingDataSource dataSource, + public CollateralReadPlatformServiceImpl(final PlatformSecurityContext context, final RoutingDataSource dataSource, final LoanRepository loanRepository) { this.context = context; this.jdbcTemplate = new JdbcTemplate(dataSource); diff --git a/mifosng-provider/src/main/java/org/mifosplatform/portfolio/collectionsheet/service/CollectionSheetReadPlatformServiceImpl.java b/mifosng-provider/src/main/java/org/mifosplatform/portfolio/collectionsheet/service/CollectionSheetReadPlatformServiceImpl.java index 4b910fc0d..60e57cf00 100644 --- a/mifosng-provider/src/main/java/org/mifosplatform/portfolio/collectionsheet/service/CollectionSheetReadPlatformServiceImpl.java +++ b/mifosng-provider/src/main/java/org/mifosplatform/portfolio/collectionsheet/service/CollectionSheetReadPlatformServiceImpl.java @@ -19,7 +19,7 @@ import java.util.Set; import org.joda.time.LocalDate; import org.mifosplatform.infrastructure.core.api.JsonQuery; import org.mifosplatform.infrastructure.core.domain.JdbcSupport; -import org.mifosplatform.infrastructure.core.service.TenantAwareRoutingDataSource; +import org.mifosplatform.infrastructure.core.service.RoutingDataSource; import org.mifosplatform.infrastructure.security.service.PlatformSecurityContext; import org.mifosplatform.organisation.monetary.data.CurrencyData; import org.mifosplatform.portfolio.collectionsheet.data.ClientLoansData; @@ -51,7 +51,7 @@ public class CollectionSheetReadPlatformServiceImpl implements CollectionSheetRe private final CollectionSheetGenerateCommandFromApiJsonDeserializer collectionSheetGenerateCommandFromApiJsonDeserializer; @Autowired - public CollectionSheetReadPlatformServiceImpl(final PlatformSecurityContext context, final TenantAwareRoutingDataSource dataSource, + public CollectionSheetReadPlatformServiceImpl(final PlatformSecurityContext context, final RoutingDataSource dataSource, final CenterReadPlatformService centerReadPlatformService, final GroupReadPlatformService groupReadPlatformService, final CollectionSheetGenerateCommandFromApiJsonDeserializer collectionSheetGenerateCommandFromApiJsonDeserializer) { this.context = context; this.centerReadPlatformService = centerReadPlatformService; diff --git a/mifosng-provider/src/main/java/org/mifosplatform/portfolio/fund/service/FundReadPlatformServiceImpl.java b/mifosng-provider/src/main/java/org/mifosplatform/portfolio/fund/service/FundReadPlatformServiceImpl.java index 184108718..4ee3c08a3 100644 --- a/mifosng-provider/src/main/java/org/mifosplatform/portfolio/fund/service/FundReadPlatformServiceImpl.java +++ b/mifosng-provider/src/main/java/org/mifosplatform/portfolio/fund/service/FundReadPlatformServiceImpl.java @@ -9,7 +9,7 @@ import java.sql.ResultSet; import java.sql.SQLException; import java.util.Collection; -import org.mifosplatform.infrastructure.core.service.TenantAwareRoutingDataSource; +import org.mifosplatform.infrastructure.core.service.RoutingDataSource; import org.mifosplatform.infrastructure.security.service.PlatformSecurityContext; import org.mifosplatform.portfolio.fund.data.FundData; import org.mifosplatform.portfolio.fund.exception.FundNotFoundException; @@ -26,7 +26,7 @@ public class FundReadPlatformServiceImpl implements FundReadPlatformService { private final PlatformSecurityContext context; @Autowired - public FundReadPlatformServiceImpl(final PlatformSecurityContext context, final TenantAwareRoutingDataSource dataSource) { + public FundReadPlatformServiceImpl(final PlatformSecurityContext context, final RoutingDataSource dataSource) { this.context = context; this.jdbcTemplate = new JdbcTemplate(dataSource); } diff --git a/mifosng-provider/src/main/java/org/mifosplatform/portfolio/group/service/CenterReadPlatformServiceImpl.java b/mifosng-provider/src/main/java/org/mifosplatform/portfolio/group/service/CenterReadPlatformServiceImpl.java index 5673e0c8d..245ead56e 100644 --- a/mifosng-provider/src/main/java/org/mifosplatform/portfolio/group/service/CenterReadPlatformServiceImpl.java +++ b/mifosng-provider/src/main/java/org/mifosplatform/portfolio/group/service/CenterReadPlatformServiceImpl.java @@ -17,7 +17,7 @@ import org.mifosplatform.infrastructure.core.data.EnumOptionData; import org.mifosplatform.infrastructure.core.domain.JdbcSupport; import org.mifosplatform.infrastructure.core.service.Page; import org.mifosplatform.infrastructure.core.service.PaginationHelper; -import org.mifosplatform.infrastructure.core.service.TenantAwareRoutingDataSource; +import org.mifosplatform.infrastructure.core.service.RoutingDataSource; import org.mifosplatform.infrastructure.security.service.PlatformSecurityContext; import org.mifosplatform.organisation.office.data.OfficeData; import org.mifosplatform.organisation.office.service.OfficeReadPlatformService; @@ -58,7 +58,7 @@ public class CenterReadPlatformServiceImpl implements CenterReadPlatformService private final PaginationHelper paginationHelper = new PaginationHelper(); @Autowired - public CenterReadPlatformServiceImpl(final PlatformSecurityContext context, final TenantAwareRoutingDataSource dataSource, + public CenterReadPlatformServiceImpl(final PlatformSecurityContext context, final RoutingDataSource dataSource, final ClientReadPlatformService clientReadPlatformService, final OfficeReadPlatformService officeReadPlatformService, final StaffReadPlatformService staffReadPlatformService) { this.context = context; diff --git a/mifosng-provider/src/main/java/org/mifosplatform/portfolio/group/service/GroupLevelReadPlatformServiceImpl.java b/mifosng-provider/src/main/java/org/mifosplatform/portfolio/group/service/GroupLevelReadPlatformServiceImpl.java index f1ef9d3da..3a6f402fa 100644 --- a/mifosng-provider/src/main/java/org/mifosplatform/portfolio/group/service/GroupLevelReadPlatformServiceImpl.java +++ b/mifosng-provider/src/main/java/org/mifosplatform/portfolio/group/service/GroupLevelReadPlatformServiceImpl.java @@ -10,7 +10,7 @@ import java.sql.SQLException; import java.util.Collection; import org.mifosplatform.infrastructure.core.domain.JdbcSupport; -import org.mifosplatform.infrastructure.core.service.TenantAwareRoutingDataSource; +import org.mifosplatform.infrastructure.core.service.RoutingDataSource; import org.mifosplatform.infrastructure.security.service.PlatformSecurityContext; import org.mifosplatform.portfolio.group.data.GroupLevelData; import org.springframework.beans.factory.annotation.Autowired; @@ -26,7 +26,7 @@ public class GroupLevelReadPlatformServiceImpl implements GroupLevelReadPlatform @Autowired - public GroupLevelReadPlatformServiceImpl(final PlatformSecurityContext context , final TenantAwareRoutingDataSource dataSource) { + public GroupLevelReadPlatformServiceImpl(final PlatformSecurityContext context , final RoutingDataSource dataSource) { this.context = context; this.jdbcTemplate = new JdbcTemplate(dataSource); } diff --git a/mifosng-provider/src/main/java/org/mifosplatform/portfolio/group/service/GroupReadPlatformServiceImpl.java b/mifosng-provider/src/main/java/org/mifosplatform/portfolio/group/service/GroupReadPlatformServiceImpl.java index 99f643bea..d75be5e33 100644 --- a/mifosng-provider/src/main/java/org/mifosplatform/portfolio/group/service/GroupReadPlatformServiceImpl.java +++ b/mifosng-provider/src/main/java/org/mifosplatform/portfolio/group/service/GroupReadPlatformServiceImpl.java @@ -18,7 +18,7 @@ import org.mifosplatform.infrastructure.core.api.ApiParameterHelper; import org.mifosplatform.infrastructure.core.domain.JdbcSupport; import org.mifosplatform.infrastructure.core.service.Page; import org.mifosplatform.infrastructure.core.service.PaginationHelper; -import org.mifosplatform.infrastructure.core.service.TenantAwareRoutingDataSource; +import org.mifosplatform.infrastructure.core.service.RoutingDataSource; import org.mifosplatform.infrastructure.security.service.PlatformSecurityContext; import org.mifosplatform.organisation.office.data.OfficeData; import org.mifosplatform.organisation.office.service.OfficeReadPlatformService; @@ -57,7 +57,7 @@ public class GroupReadPlatformServiceImpl implements GroupReadPlatformService { private final PaginationHelper paginationHelper = new PaginationHelper(); @Autowired - public GroupReadPlatformServiceImpl(final PlatformSecurityContext context, final TenantAwareRoutingDataSource dataSource, + public GroupReadPlatformServiceImpl(final PlatformSecurityContext context, final RoutingDataSource dataSource, final CenterReadPlatformService centerReadPlatformService, final ClientReadPlatformService clientReadPlatformService, final OfficeReadPlatformService officeReadPlatformService, final StaffReadPlatformService staffReadPlatformService, final CodeValueReadPlatformService codeValueReadPlatformService) { diff --git a/mifosng-provider/src/main/java/org/mifosplatform/portfolio/group/service/GroupRolesReadPlatformServiceImpl.java b/mifosng-provider/src/main/java/org/mifosplatform/portfolio/group/service/GroupRolesReadPlatformServiceImpl.java index d08be9cbf..f2af4baad 100644 --- a/mifosng-provider/src/main/java/org/mifosplatform/portfolio/group/service/GroupRolesReadPlatformServiceImpl.java +++ b/mifosng-provider/src/main/java/org/mifosplatform/portfolio/group/service/GroupRolesReadPlatformServiceImpl.java @@ -6,7 +6,7 @@ import java.util.Collection; import org.mifosplatform.infrastructure.codes.data.CodeValueData; import org.mifosplatform.infrastructure.core.domain.JdbcSupport; -import org.mifosplatform.infrastructure.core.service.TenantAwareRoutingDataSource; +import org.mifosplatform.infrastructure.core.service.RoutingDataSource; import org.mifosplatform.infrastructure.security.service.PlatformSecurityContext; import org.mifosplatform.portfolio.group.data.GroupRoleData; import org.mifosplatform.portfolio.group.exception.GroupRoleNotFoundException; @@ -23,7 +23,7 @@ public class GroupRolesReadPlatformServiceImpl implements GroupRolesReadPlatform private final PlatformSecurityContext context; @Autowired - public GroupRolesReadPlatformServiceImpl(final PlatformSecurityContext context, final TenantAwareRoutingDataSource dataSource) { + public GroupRolesReadPlatformServiceImpl(final PlatformSecurityContext context, final RoutingDataSource dataSource) { this.context = context; this.jdbcTemplate = new JdbcTemplate(dataSource); } diff --git a/mifosng-provider/src/main/java/org/mifosplatform/portfolio/loanaccount/domain/LoanSummary.java b/mifosng-provider/src/main/java/org/mifosplatform/portfolio/loanaccount/domain/LoanSummary.java index 98cdfeaf7..df99ab781 100644 --- a/mifosng-provider/src/main/java/org/mifosplatform/portfolio/loanaccount/domain/LoanSummary.java +++ b/mifosng-provider/src/main/java/org/mifosplatform/portfolio/loanaccount/domain/LoanSummary.java @@ -13,7 +13,6 @@ import javax.persistence.Embeddable; import org.mifosplatform.organisation.monetary.domain.MonetaryCurrency; import org.mifosplatform.organisation.monetary.domain.Money; -import org.mifosplatform.scheduledjobs.UpdateLoanSummariesScheduledJob; /** * Encapsulates all the summary details of a {@link Loan}. diff --git a/mifosng-provider/src/main/java/org/mifosplatform/portfolio/loanaccount/guarantor/service/GuarantorReadPlatformServiceImpl.java b/mifosng-provider/src/main/java/org/mifosplatform/portfolio/loanaccount/guarantor/service/GuarantorReadPlatformServiceImpl.java index 40197e2f9..318e1916b 100644 --- a/mifosng-provider/src/main/java/org/mifosplatform/portfolio/loanaccount/guarantor/service/GuarantorReadPlatformServiceImpl.java +++ b/mifosng-provider/src/main/java/org/mifosplatform/portfolio/loanaccount/guarantor/service/GuarantorReadPlatformServiceImpl.java @@ -14,7 +14,7 @@ import org.joda.time.LocalDate; import org.mifosplatform.infrastructure.codes.data.CodeValueData; import org.mifosplatform.infrastructure.core.data.EnumOptionData; import org.mifosplatform.infrastructure.core.domain.JdbcSupport; -import org.mifosplatform.infrastructure.core.service.TenantAwareRoutingDataSource; +import org.mifosplatform.infrastructure.core.service.RoutingDataSource; import org.mifosplatform.organisation.staff.data.StaffData; import org.mifosplatform.organisation.staff.service.StaffReadPlatformService; import org.mifosplatform.portfolio.client.data.ClientData; @@ -37,7 +37,7 @@ public class GuarantorReadPlatformServiceImpl implements GuarantorReadPlatformSe private final LoanRepository loanRepository; @Autowired - public GuarantorReadPlatformServiceImpl(final TenantAwareRoutingDataSource dataSource, + public GuarantorReadPlatformServiceImpl(final RoutingDataSource dataSource, final ClientReadPlatformService clientReadPlatformService, final StaffReadPlatformService staffReadPlatformService, final LoanRepository loanRepository) { this.jdbcTemplate = new JdbcTemplate(dataSource); diff --git a/mifosng-provider/src/main/java/org/mifosplatform/portfolio/loanaccount/service/BulkLoansReadPlatformServiceImpl.java b/mifosng-provider/src/main/java/org/mifosplatform/portfolio/loanaccount/service/BulkLoansReadPlatformServiceImpl.java index a82cacdd0..ce9603d02 100644 --- a/mifosng-provider/src/main/java/org/mifosplatform/portfolio/loanaccount/service/BulkLoansReadPlatformServiceImpl.java +++ b/mifosng-provider/src/main/java/org/mifosplatform/portfolio/loanaccount/service/BulkLoansReadPlatformServiceImpl.java @@ -11,7 +11,7 @@ import java.util.Collection; import java.util.List; import org.mifosplatform.infrastructure.core.domain.JdbcSupport; -import org.mifosplatform.infrastructure.core.service.TenantAwareRoutingDataSource; +import org.mifosplatform.infrastructure.core.service.RoutingDataSource; import org.mifosplatform.infrastructure.security.service.PlatformSecurityContext; import org.mifosplatform.organisation.staff.data.StaffAccountSummaryCollectionData; import org.mifosplatform.portfolio.client.data.ClientAccountSummaryData; @@ -32,7 +32,7 @@ public class BulkLoansReadPlatformServiceImpl implements BulkLoansReadPlatformSe private final GroupReadPlatformService groupReadPlatformService; @Autowired - public BulkLoansReadPlatformServiceImpl(final PlatformSecurityContext context, final TenantAwareRoutingDataSource dataSource, + public BulkLoansReadPlatformServiceImpl(final PlatformSecurityContext context, final RoutingDataSource dataSource, final ClientReadPlatformService clientReadPlatformService, final GroupReadPlatformService groupReadPlatformService) { this.context = context; this.jdbcTemplate = new JdbcTemplate(dataSource); diff --git a/mifosng-provider/src/main/java/org/mifosplatform/portfolio/loanaccount/service/LoanChargeReadPlatformServiceImpl.java b/mifosng-provider/src/main/java/org/mifosplatform/portfolio/loanaccount/service/LoanChargeReadPlatformServiceImpl.java index 437344681..e2ddbd66d 100644 --- a/mifosng-provider/src/main/java/org/mifosplatform/portfolio/loanaccount/service/LoanChargeReadPlatformServiceImpl.java +++ b/mifosng-provider/src/main/java/org/mifosplatform/portfolio/loanaccount/service/LoanChargeReadPlatformServiceImpl.java @@ -14,7 +14,7 @@ import java.util.List; import org.joda.time.LocalDate; import org.mifosplatform.infrastructure.core.data.EnumOptionData; import org.mifosplatform.infrastructure.core.domain.JdbcSupport; -import org.mifosplatform.infrastructure.core.service.TenantAwareRoutingDataSource; +import org.mifosplatform.infrastructure.core.service.RoutingDataSource; import org.mifosplatform.infrastructure.security.service.PlatformSecurityContext; import org.mifosplatform.organisation.monetary.data.CurrencyData; import org.mifosplatform.portfolio.charge.data.ChargeData; @@ -35,7 +35,7 @@ public class LoanChargeReadPlatformServiceImpl implements LoanChargeReadPlatform @Autowired public LoanChargeReadPlatformServiceImpl(final PlatformSecurityContext context, - final ChargeDropdownReadPlatformService chargeDropdownReadPlatformService, final TenantAwareRoutingDataSource dataSource) { + final ChargeDropdownReadPlatformService chargeDropdownReadPlatformService, final RoutingDataSource dataSource) { this.context = context; this.chargeDropdownReadPlatformService = chargeDropdownReadPlatformService; this.jdbcTemplate = new JdbcTemplate(dataSource); diff --git a/mifosng-provider/src/main/java/org/mifosplatform/portfolio/loanaccount/service/LoanReadPlatformServiceImpl.java b/mifosng-provider/src/main/java/org/mifosplatform/portfolio/loanaccount/service/LoanReadPlatformServiceImpl.java index e867ddfcd..9445e383f 100644 --- a/mifosng-provider/src/main/java/org/mifosplatform/portfolio/loanaccount/service/LoanReadPlatformServiceImpl.java +++ b/mifosng-provider/src/main/java/org/mifosplatform/portfolio/loanaccount/service/LoanReadPlatformServiceImpl.java @@ -22,7 +22,7 @@ import org.mifosplatform.infrastructure.core.domain.JdbcSupport; import org.mifosplatform.infrastructure.core.service.DateUtils; import org.mifosplatform.infrastructure.core.service.Page; import org.mifosplatform.infrastructure.core.service.PaginationHelper; -import org.mifosplatform.infrastructure.core.service.TenantAwareRoutingDataSource; +import org.mifosplatform.infrastructure.core.service.RoutingDataSource; import org.mifosplatform.infrastructure.security.service.PlatformSecurityContext; import org.mifosplatform.organisation.monetary.data.CurrencyData; import org.mifosplatform.organisation.monetary.domain.ApplicationCurrency; @@ -102,7 +102,7 @@ public class LoanReadPlatformServiceImpl implements LoanReadPlatformService { final LoanProductReadPlatformService loanProductReadPlatformService, final ClientReadPlatformService clientReadPlatformService, final GroupReadPlatformService groupReadPlatformService, final LoanDropdownReadPlatformService loanDropdownReadPlatformService, final FundReadPlatformService fundReadPlatformService, final ChargeReadPlatformService chargeReadPlatformService, - final CodeValueReadPlatformService codeValueReadPlatformService, final TenantAwareRoutingDataSource dataSource, + final CodeValueReadPlatformService codeValueReadPlatformService, final RoutingDataSource dataSource, final CalendarReadPlatformService calendarReadPlatformService) { this.context = context; this.loanRepository = loanRepository; diff --git a/mifosng-provider/src/main/java/org/mifosplatform/portfolio/loanaccount/service/LoanWritePlatformServiceJpaRepositoryImpl.java b/mifosng-provider/src/main/java/org/mifosplatform/portfolio/loanaccount/service/LoanWritePlatformServiceJpaRepositoryImpl.java index 3dc5ed4da..edf21277b 100644 --- a/mifosng-provider/src/main/java/org/mifosplatform/portfolio/loanaccount/service/LoanWritePlatformServiceJpaRepositoryImpl.java +++ b/mifosng-provider/src/main/java/org/mifosplatform/portfolio/loanaccount/service/LoanWritePlatformServiceJpaRepositoryImpl.java @@ -75,6 +75,7 @@ import org.mifosplatform.portfolio.note.domain.Note; import org.mifosplatform.portfolio.note.domain.NoteRepository; import org.mifosplatform.portfolio.paymentdetail.domain.PaymentDetail; import org.mifosplatform.portfolio.paymentdetail.service.PaymentDetailWritePlatformService; +import org.mifosplatform.scheduledjobs.annotation.CronTargetMethod; import org.mifosplatform.useradministration.domain.AppUser; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Service; @@ -1178,6 +1179,7 @@ public class LoanWritePlatformServiceJpaRepositoryImpl implements LoanWritePlatf @Transactional @Override + @CronTargetMethod(jobName="Apply Holidays To Loans") public void applyHolidaysToLoans() { final Collection loanStatuses = new ArrayList(Arrays.asList(LoanStatus.SUBMITTED_AND_PENDING_APPROVAL.getValue(), diff --git a/mifosng-provider/src/main/java/org/mifosplatform/portfolio/loanproduct/service/LoanProductReadPlatformServiceImpl.java b/mifosng-provider/src/main/java/org/mifosplatform/portfolio/loanproduct/service/LoanProductReadPlatformServiceImpl.java index 27c35db5d..49e1a28eb 100644 --- a/mifosng-provider/src/main/java/org/mifosplatform/portfolio/loanproduct/service/LoanProductReadPlatformServiceImpl.java +++ b/mifosng-provider/src/main/java/org/mifosplatform/portfolio/loanproduct/service/LoanProductReadPlatformServiceImpl.java @@ -15,7 +15,7 @@ import org.mifosplatform.accounting.common.AccountingEnumerations; import org.mifosplatform.infrastructure.core.data.EnumOptionData; import org.mifosplatform.infrastructure.core.domain.JdbcSupport; import org.mifosplatform.infrastructure.core.service.DateUtils; -import org.mifosplatform.infrastructure.core.service.TenantAwareRoutingDataSource; +import org.mifosplatform.infrastructure.core.service.RoutingDataSource; import org.mifosplatform.infrastructure.security.service.PlatformSecurityContext; import org.mifosplatform.organisation.monetary.data.CurrencyData; import org.mifosplatform.portfolio.charge.data.ChargeData; @@ -37,7 +37,7 @@ public class LoanProductReadPlatformServiceImpl implements LoanProductReadPlatfo @Autowired public LoanProductReadPlatformServiceImpl(final PlatformSecurityContext context, - final ChargeReadPlatformService chargeReadPlatformService, final TenantAwareRoutingDataSource dataSource) { + final ChargeReadPlatformService chargeReadPlatformService, final RoutingDataSource dataSource) { this.context = context; this.chargeReadPlatformService = chargeReadPlatformService; this.jdbcTemplate = new JdbcTemplate(dataSource); diff --git a/mifosng-provider/src/main/java/org/mifosplatform/portfolio/note/service/NoteReadPlatformServiceImpl.java b/mifosng-provider/src/main/java/org/mifosplatform/portfolio/note/service/NoteReadPlatformServiceImpl.java index 33998c9cf..cb0cac204 100644 --- a/mifosng-provider/src/main/java/org/mifosplatform/portfolio/note/service/NoteReadPlatformServiceImpl.java +++ b/mifosng-provider/src/main/java/org/mifosplatform/portfolio/note/service/NoteReadPlatformServiceImpl.java @@ -13,7 +13,7 @@ import org.apache.commons.lang.StringUtils; import org.joda.time.DateTime; import org.mifosplatform.infrastructure.core.data.EnumOptionData; import org.mifosplatform.infrastructure.core.domain.JdbcSupport; -import org.mifosplatform.infrastructure.core.service.TenantAwareRoutingDataSource; +import org.mifosplatform.infrastructure.core.service.RoutingDataSource; import org.mifosplatform.portfolio.note.data.NoteData; import org.mifosplatform.portfolio.note.domain.NoteType; import org.mifosplatform.portfolio.note.exception.NoteNotFoundException; @@ -29,7 +29,7 @@ public class NoteReadPlatformServiceImpl implements NoteReadPlatformService { private final JdbcTemplate jdbcTemplate; @Autowired - public NoteReadPlatformServiceImpl(final TenantAwareRoutingDataSource dataSource) { + public NoteReadPlatformServiceImpl(final RoutingDataSource dataSource) { this.jdbcTemplate = new JdbcTemplate(dataSource); } diff --git a/mifosng-provider/src/main/java/org/mifosplatform/portfolio/savings/service/SavingsAccountReadPlatformServiceImpl.java b/mifosng-provider/src/main/java/org/mifosplatform/portfolio/savings/service/SavingsAccountReadPlatformServiceImpl.java index af9e35ecb..ebea988ba 100644 --- a/mifosng-provider/src/main/java/org/mifosplatform/portfolio/savings/service/SavingsAccountReadPlatformServiceImpl.java +++ b/mifosng-provider/src/main/java/org/mifosplatform/portfolio/savings/service/SavingsAccountReadPlatformServiceImpl.java @@ -20,7 +20,7 @@ import org.mifosplatform.infrastructure.core.domain.JdbcSupport; import org.mifosplatform.infrastructure.core.service.DateUtils; import org.mifosplatform.infrastructure.core.service.Page; import org.mifosplatform.infrastructure.core.service.PaginationHelper; -import org.mifosplatform.infrastructure.core.service.TenantAwareRoutingDataSource; +import org.mifosplatform.infrastructure.core.service.RoutingDataSource; import org.mifosplatform.infrastructure.security.service.PlatformSecurityContext; import org.mifosplatform.organisation.monetary.data.CurrencyData; import org.mifosplatform.portfolio.client.data.ClientData; @@ -64,7 +64,7 @@ public class SavingsAccountReadPlatformServiceImpl implements SavingsAccountRead private final SavingAccountMapper savingAccountMapper = new SavingAccountMapper(); @Autowired - public SavingsAccountReadPlatformServiceImpl(final PlatformSecurityContext context, final TenantAwareRoutingDataSource dataSource, + public SavingsAccountReadPlatformServiceImpl(final PlatformSecurityContext context, final RoutingDataSource dataSource, final ClientReadPlatformService clientReadPlatformService, final GroupReadPlatformService groupReadPlatformService, final SavingsProductReadPlatformService savingProductReadPlatformService, final SavingsDropdownReadPlatformService dropdownReadPlatformService) { diff --git a/mifosng-provider/src/main/java/org/mifosplatform/portfolio/savings/service/SavingsProductReadPlatformServiceImpl.java b/mifosng-provider/src/main/java/org/mifosplatform/portfolio/savings/service/SavingsProductReadPlatformServiceImpl.java index 575414fe7..a66c18f53 100644 --- a/mifosng-provider/src/main/java/org/mifosplatform/portfolio/savings/service/SavingsProductReadPlatformServiceImpl.java +++ b/mifosng-provider/src/main/java/org/mifosplatform/portfolio/savings/service/SavingsProductReadPlatformServiceImpl.java @@ -14,7 +14,7 @@ import org.joda.time.MonthDay; import org.mifosplatform.accounting.common.AccountingEnumerations; import org.mifosplatform.infrastructure.core.data.EnumOptionData; import org.mifosplatform.infrastructure.core.domain.JdbcSupport; -import org.mifosplatform.infrastructure.core.service.TenantAwareRoutingDataSource; +import org.mifosplatform.infrastructure.core.service.RoutingDataSource; import org.mifosplatform.infrastructure.security.service.PlatformSecurityContext; import org.mifosplatform.organisation.monetary.data.CurrencyData; import org.mifosplatform.portfolio.savings.data.SavingsProductData; @@ -34,7 +34,7 @@ public class SavingsProductReadPlatformServiceImpl implements SavingsProductRead private final SavingProductLookupMapper savingsProductLookupsRowMapper = new SavingProductLookupMapper(); @Autowired - public SavingsProductReadPlatformServiceImpl(final PlatformSecurityContext context, final TenantAwareRoutingDataSource dataSource) { + public SavingsProductReadPlatformServiceImpl(final PlatformSecurityContext context, final RoutingDataSource dataSource) { this.context = context; jdbcTemplate = new JdbcTemplate(dataSource); } diff --git a/mifosng-provider/src/main/java/org/mifosplatform/portfolio/search/service/SearchReadPlatformServiceImpl.java b/mifosng-provider/src/main/java/org/mifosplatform/portfolio/search/service/SearchReadPlatformServiceImpl.java index 7347bad0a..cd80e94b0 100644 --- a/mifosng-provider/src/main/java/org/mifosplatform/portfolio/search/service/SearchReadPlatformServiceImpl.java +++ b/mifosng-provider/src/main/java/org/mifosplatform/portfolio/search/service/SearchReadPlatformServiceImpl.java @@ -10,7 +10,7 @@ import java.sql.SQLException; import java.util.Collection; import org.mifosplatform.infrastructure.core.domain.JdbcSupport; -import org.mifosplatform.infrastructure.core.service.TenantAwareRoutingDataSource; +import org.mifosplatform.infrastructure.core.service.RoutingDataSource; import org.mifosplatform.infrastructure.security.service.PlatformSecurityContext; import org.mifosplatform.portfolio.search.data.SearchConditions; import org.mifosplatform.portfolio.search.data.SearchData; @@ -28,7 +28,7 @@ public class SearchReadPlatformServiceImpl implements SearchReadPlatformService private final PlatformSecurityContext context; @Autowired - public SearchReadPlatformServiceImpl(final PlatformSecurityContext context, final TenantAwareRoutingDataSource dataSource) { + public SearchReadPlatformServiceImpl(final PlatformSecurityContext context, final RoutingDataSource dataSource) { this.context = context; this.namedParameterjdbcTemplate = new NamedParameterJdbcTemplate(dataSource); } diff --git a/mifosng-provider/src/main/java/org/mifosplatform/scheduledjobs/ApplyAnnualFeeForSavingsScheduledJob.java b/mifosng-provider/src/main/java/org/mifosplatform/scheduledjobs/ApplyAnnualFeeForSavingsScheduledJob.java deleted file mode 100644 index d266bb6fa..000000000 --- a/mifosng-provider/src/main/java/org/mifosplatform/scheduledjobs/ApplyAnnualFeeForSavingsScheduledJob.java +++ /dev/null @@ -1,31 +0,0 @@ -/** - * This Source Code Form is subject to the terms of the Mozilla Public - * License, v. 2.0. If a copy of the MPL was not distributed with this file, - * You can obtain one at http://mozilla.org/MPL/2.0/. - */ -package org.mifosplatform.scheduledjobs; - -import java.util.Date; - -import org.mifosplatform.scheduledjobs.service.ScheduledJobRunnerService; -import org.slf4j.Logger; -import org.slf4j.LoggerFactory; - -public class ApplyAnnualFeeForSavingsScheduledJob { - - private final static Logger logger = LoggerFactory.getLogger(ApplyAnnualFeeForSavingsScheduledJob.class); - - private final ScheduledJobRunnerService scheduledJobRunnerService; - - public ApplyAnnualFeeForSavingsScheduledJob(final ScheduledJobRunnerService scheduledJobRunnerService) { - this.scheduledJobRunnerService = scheduledJobRunnerService; - } - - public void execute() { - logger.info("Running Job ApplyAnnualFeeForSavingsScheduledJob " + new Date()); - - this.scheduledJobRunnerService.applyAnnualFeeForSavings(); - - logger.info("Finishing Job ApplyAnnualFeeForSavingsScheduledJob " + new Date()); - } -} diff --git a/mifosng-provider/src/main/java/org/mifosplatform/scheduledjobs/ApplyHolidaysToLoansScheduledJob.java b/mifosng-provider/src/main/java/org/mifosplatform/scheduledjobs/ApplyHolidaysToLoansScheduledJob.java deleted file mode 100644 index b6673c792..000000000 --- a/mifosng-provider/src/main/java/org/mifosplatform/scheduledjobs/ApplyHolidaysToLoansScheduledJob.java +++ /dev/null @@ -1,31 +0,0 @@ -/** - * This Source Code Form is subject to the terms of the Mozilla Public - * License, v. 2.0. If a copy of the MPL was not distributed with this file, - * You can obtain one at http://mozilla.org/MPL/2.0/. - */ -package org.mifosplatform.scheduledjobs; - -import java.util.Date; - -import org.mifosplatform.scheduledjobs.service.ScheduledJobRunnerService; -import org.slf4j.Logger; -import org.slf4j.LoggerFactory; - -public class ApplyHolidaysToLoansScheduledJob { - - private final static Logger logger = LoggerFactory.getLogger(ApplyHolidaysToLoansScheduledJob.class); - - private final ScheduledJobRunnerService scheduledJobRunnerService; - - public ApplyHolidaysToLoansScheduledJob(final ScheduledJobRunnerService scheduledJobRunnerService) { - this.scheduledJobRunnerService = scheduledJobRunnerService; - } - - public void execute() { - logger.info("Running Job ApplyHolidaysToLoansScheduledJob " + new Date()); - - this.scheduledJobRunnerService.applyHolidaysToLoans(); - - logger.info("Finishing Job ApplyHolidaysToLoansScheduledJob " + new Date()); - } -} diff --git a/mifosng-provider/src/main/java/org/mifosplatform/scheduledjobs/UpdateLoanArrearsAgeingScheduledJob.java b/mifosng-provider/src/main/java/org/mifosplatform/scheduledjobs/UpdateLoanArrearsAgeingScheduledJob.java deleted file mode 100644 index 2ba5ba0fb..000000000 --- a/mifosng-provider/src/main/java/org/mifosplatform/scheduledjobs/UpdateLoanArrearsAgeingScheduledJob.java +++ /dev/null @@ -1,31 +0,0 @@ -/** - * This Source Code Form is subject to the terms of the Mozilla Public - * License, v. 2.0. If a copy of the MPL was not distributed with this file, - * You can obtain one at http://mozilla.org/MPL/2.0/. - */ -package org.mifosplatform.scheduledjobs; - -import java.util.Date; - -import org.mifosplatform.scheduledjobs.service.ScheduledJobRunnerService; -import org.slf4j.Logger; -import org.slf4j.LoggerFactory; - -public class UpdateLoanArrearsAgeingScheduledJob { - - private final static Logger logger = LoggerFactory.getLogger(UpdateLoanArrearsAgeingScheduledJob.class); - - private final ScheduledJobRunnerService scheduledJobRunnerService; - - public UpdateLoanArrearsAgeingScheduledJob(final ScheduledJobRunnerService scheduledJobRunnerService) { - this.scheduledJobRunnerService = scheduledJobRunnerService; - } - - public void execute() { - logger.info("Running Job UpdateLoanArrearsAgeingScheduledJob " + new Date()); - - this.scheduledJobRunnerService.updateLoanArrearsAgeingDetails(); - - logger.info("Finishing Job UpdateLoanArrearsAgeingScheduledJob " + new Date()); - } -} diff --git a/mifosng-provider/src/main/java/org/mifosplatform/scheduledjobs/UpdateLoanPaidInAdvanceScheduledJob.java b/mifosng-provider/src/main/java/org/mifosplatform/scheduledjobs/UpdateLoanPaidInAdvanceScheduledJob.java deleted file mode 100644 index de53d40d7..000000000 --- a/mifosng-provider/src/main/java/org/mifosplatform/scheduledjobs/UpdateLoanPaidInAdvanceScheduledJob.java +++ /dev/null @@ -1,31 +0,0 @@ -/** - * This Source Code Form is subject to the terms of the Mozilla Public - * License, v. 2.0. If a copy of the MPL was not distributed with this file, - * You can obtain one at http://mozilla.org/MPL/2.0/. - */ -package org.mifosplatform.scheduledjobs; - -import java.util.Date; - -import org.mifosplatform.scheduledjobs.service.ScheduledJobRunnerService; -import org.slf4j.Logger; -import org.slf4j.LoggerFactory; - -public class UpdateLoanPaidInAdvanceScheduledJob { - - private final static Logger logger = LoggerFactory.getLogger(UpdateLoanPaidInAdvanceScheduledJob.class); - - private final ScheduledJobRunnerService scheduledJobRunnerService; - - public UpdateLoanPaidInAdvanceScheduledJob(final ScheduledJobRunnerService scheduledJobRunnerService) { - this.scheduledJobRunnerService = scheduledJobRunnerService; - } - - public void execute() { - logger.info("Running Job UpdateLoanPaidInAdvanceScheduledJob " + new Date()); - - this.scheduledJobRunnerService.updateLoanPaidInAdvance(); - - logger.info("Finishing Job UpdateLoanPaidInAdvanceScheduledJob " + new Date()); - } -} diff --git a/mifosng-provider/src/main/java/org/mifosplatform/scheduledjobs/UpdateLoanSummariesScheduledJob.java b/mifosng-provider/src/main/java/org/mifosplatform/scheduledjobs/UpdateLoanSummariesScheduledJob.java deleted file mode 100644 index 6bcdbaac2..000000000 --- a/mifosng-provider/src/main/java/org/mifosplatform/scheduledjobs/UpdateLoanSummariesScheduledJob.java +++ /dev/null @@ -1,34 +0,0 @@ -/** - * This Source Code Form is subject to the terms of the Mozilla Public - * License, v. 2.0. If a copy of the MPL was not distributed with this file, - * You can obtain one at http://mozilla.org/MPL/2.0/. - */ -package org.mifosplatform.scheduledjobs; - -import java.util.Date; - -import org.mifosplatform.scheduledjobs.service.ScheduledJobRunnerService; -import org.slf4j.Logger; -import org.slf4j.LoggerFactory; - -/** - * Update loan summary - */ -public class UpdateLoanSummariesScheduledJob { - - private final static Logger logger = LoggerFactory.getLogger(UpdateLoanSummariesScheduledJob.class); - - private final ScheduledJobRunnerService scheduledJobRunnerService; - - public UpdateLoanSummariesScheduledJob(final ScheduledJobRunnerService scheduledJobRunnerService) { - this.scheduledJobRunnerService = scheduledJobRunnerService; - } - - public void execute() { - logger.info("Running Job UpdateLoanSummariesScheduledJob " + new Date()); - - this.scheduledJobRunnerService.updateLoanSummaryDetails(); - - logger.info("Finishing Job UpdateLoanSummariesScheduledJob " + new Date()); - } -} \ No newline at end of file diff --git a/mifosng-provider/src/main/java/org/mifosplatform/scheduledjobs/annotation/CronMethodParser.java b/mifosng-provider/src/main/java/org/mifosplatform/scheduledjobs/annotation/CronMethodParser.java new file mode 100755 index 000000000..4fa3702bc --- /dev/null +++ b/mifosng-provider/src/main/java/org/mifosplatform/scheduledjobs/annotation/CronMethodParser.java @@ -0,0 +1,76 @@ +package org.mifosplatform.scheduledjobs.annotation; + +import java.io.IOException; +import java.lang.annotation.Annotation; +import java.util.HashMap; +import java.util.Map; +import java.util.Set; + +import org.springframework.core.env.StandardEnvironment; +import org.springframework.core.io.Resource; +import org.springframework.core.io.support.PathMatchingResourcePatternResolver; +import org.springframework.core.io.support.ResourcePatternResolver; +import org.springframework.core.type.MethodMetadata; +import org.springframework.core.type.classreading.CachingMetadataReaderFactory; +import org.springframework.core.type.classreading.MetadataReader; +import org.springframework.core.type.classreading.MetadataReaderFactory; +import org.springframework.util.ClassUtils; + +/** + * Parser to find method which is marked with CronTargetMethod annotation + * + */ +public class CronMethodParser { + + private static final String SEARCH_PACKAGE = "org.mifosplatform."; + + private static final String CRON_ANNOTATION_ATTRIBUTE_NAME = "jobName"; + + private static final String RESOURCE_PATTERN = "**/*.class"; + + private static final Map targetMethosMap = new HashMap(); + + private static final ResourcePatternResolver resourcePatternResolver = new PathMatchingResourcePatternResolver(); + + private static final MetadataReaderFactory metadataReaderFactory = new CachingMetadataReaderFactory(resourcePatternResolver); + + public static final int CLASS_INDEX = 0; + + public static final int METHOD_INDEX = 1; + + public static String[] findTargetMethodDetails(String attriuteValue) throws IOException { + if (!targetMethosMap.containsKey(attriuteValue)) { + findAnnotationMethods(CronTargetMethod.class, CRON_ANNOTATION_ATTRIBUTE_NAME); + } + return targetMethosMap.get(attriuteValue); + } + + /** + * method adds all the method names to map with annotation attribute value + * as key + */ + private static void findAnnotationMethods(Class annotationClass, String attributeName) throws IOException { + String basePackagePath = ClassUtils.convertClassNameToResourcePath(new StandardEnvironment() + .resolveRequiredPlaceholders(SEARCH_PACKAGE)); + String packageSearchPath = ResourcePatternResolver.CLASSPATH_ALL_URL_PREFIX + basePackagePath + "/" + RESOURCE_PATTERN; + Resource[] resources = resourcePatternResolver.getResources(packageSearchPath); + for (Resource resource : resources) { + if (resource.isReadable()) { + MetadataReader metadataReader = metadataReaderFactory.getMetadataReader(resource); + Set metadataSet = metadataReader.getAnnotationMetadata().getAnnotatedMethods(annotationClass.getName()); + if (metadataSet != null && metadataSet.size() > 0) { + for (MethodMetadata metadata : metadataSet) { + Map attributes = metadata.getAnnotationAttributes(annotationClass.getName()); + String attributeValue = (String) attributes.get(attributeName); + String className = metadata.getDeclaringClassName(); + if (attributeValue == null || attributeValue.trim().length() < 1) { + attributeValue = className.substring(className.lastIndexOf(".") + 1); + } + String[] mapVal = { className, metadata.getMethodName() }; + targetMethosMap.put(attributeValue, mapVal); + } + } + } + } + } +} diff --git a/mifosng-provider/src/main/java/org/mifosplatform/scheduledjobs/annotation/CronTargetMethod.java b/mifosng-provider/src/main/java/org/mifosplatform/scheduledjobs/annotation/CronTargetMethod.java new file mode 100755 index 000000000..e6b2cb4be --- /dev/null +++ b/mifosng-provider/src/main/java/org/mifosplatform/scheduledjobs/annotation/CronTargetMethod.java @@ -0,0 +1,18 @@ +package org.mifosplatform.scheduledjobs.annotation; + +import java.lang.annotation.ElementType; +import java.lang.annotation.Retention; +import java.lang.annotation.RetentionPolicy; +import java.lang.annotation.Target; + +/** + * Annotation that marks a method to be picked while scheduling a cron jobs. + * + */ + +@Target(ElementType.METHOD) +@Retention(RetentionPolicy.RUNTIME) +public @interface CronTargetMethod { + + String jobName() default ""; +} diff --git a/mifosng-provider/src/main/java/org/mifosplatform/scheduledjobs/domain/ScheduledJobDetails.java b/mifosng-provider/src/main/java/org/mifosplatform/scheduledjobs/domain/ScheduledJobDetails.java new file mode 100755 index 000000000..59b03d9cc --- /dev/null +++ b/mifosng-provider/src/main/java/org/mifosplatform/scheduledjobs/domain/ScheduledJobDetails.java @@ -0,0 +1,117 @@ +package org.mifosplatform.scheduledjobs.domain; + +import java.util.Date; + +import javax.persistence.Column; +import javax.persistence.Entity; +import javax.persistence.Table; +import javax.persistence.Temporal; +import javax.persistence.TemporalType; + +import org.springframework.data.jpa.domain.AbstractPersistable; + +@Entity +@Table(name = "scheduled_jobs") +public class ScheduledJobDetails extends AbstractPersistable { + + @Column(name = "job_name") + private String jobName; + + @Column(name = "job_display_name") + private String jobDisplayName; + + @Column(name = "cron_expression") + private String croneExpression; + + @Column(name = "create_time") + @Temporal(TemporalType.TIMESTAMP) + private Date createTime; + + @Column(name = "task_priority") + private Short taskPriority; + + @Column(name = "group_name") + private String groupName; + + @Column(name = "previous_run_start_time") + @Temporal(TemporalType.TIMESTAMP) + private Date previousRunStartTime; + + @Column(name = "next_run_time") + @Temporal(TemporalType.TIMESTAMP) + private Date nextRunTime; + + @Column(name = "trigger_key") + private String triggerKey; + + @Column(name = "job_initializing_errorlog") + private String errorLog; + + @Column(name = "is_active") + private boolean activeSchedular; + + public ScheduledJobDetails() { + + } + + public ScheduledJobDetails(final String jobName, final String jobDisplayName, final String croneExpression, Date createTime, + final Short taskPriority, final String groupName, final Date previousRunStartTime, final Date nextRunTime, + final String triggKey, final String errorLog, final boolean activeSchedular) { + this.jobName = jobName; + this.jobDisplayName = jobDisplayName; + this.croneExpression = croneExpression; + this.createTime = createTime; + this.taskPriority = taskPriority; + this.groupName = groupName; + this.previousRunStartTime = previousRunStartTime; + this.nextRunTime = nextRunTime; + this.triggerKey = triggKey; + this.errorLog = errorLog; + this.activeSchedular = activeSchedular; + } + + public String getJobName() { + return this.jobName; + } + + public String getCroneExpression() { + return this.croneExpression; + } + + public Short getTaskPriority() { + return this.taskPriority; + } + + public String getGroupName() { + return this.groupName; + } + + public String getTriggerKey() { + return this.triggerKey; + } + + public boolean isActiveSchedular() { + return this.activeSchedular; + } + + public void updateCroneExpression(String croneExpression) { + this.croneExpression = croneExpression; + } + + public void updatePreviousRunStartTime(Date previousRunStartTime) { + this.previousRunStartTime = previousRunStartTime; + } + + public void updateNextRunTime(Date nextRunTime) { + this.nextRunTime = nextRunTime; + } + + public void updateTriggerKey(String triggerKey) { + this.triggerKey = triggerKey; + } + + public void updateErrorLog(String errorLog) { + this.errorLog = errorLog; + } + +} diff --git a/mifosng-provider/src/main/java/org/mifosplatform/scheduledjobs/domain/ScheduledJobDetailsRepository.java b/mifosng-provider/src/main/java/org/mifosplatform/scheduledjobs/domain/ScheduledJobDetailsRepository.java new file mode 100755 index 000000000..7e804d74b --- /dev/null +++ b/mifosng-provider/src/main/java/org/mifosplatform/scheduledjobs/domain/ScheduledJobDetailsRepository.java @@ -0,0 +1,14 @@ +package org.mifosplatform.scheduledjobs.domain; + +import org.springframework.data.jpa.repository.JpaRepository; +import org.springframework.data.jpa.repository.JpaSpecificationExecutor; +import org.springframework.data.jpa.repository.Query; +import org.springframework.data.repository.query.Param; + +public interface ScheduledJobDetailsRepository extends JpaRepository, + JpaSpecificationExecutor { + + @Query("from ScheduledJobDetails jobDetails where jobDetails.triggerKey = :triggerKey") + ScheduledJobDetails findByTriggerKey(@Param("triggerKey") String triggerKey); + +} diff --git a/mifosng-provider/src/main/java/org/mifosplatform/scheduledjobs/domain/ScheduledJobRunHistory.java b/mifosng-provider/src/main/java/org/mifosplatform/scheduledjobs/domain/ScheduledJobRunHistory.java new file mode 100755 index 000000000..f1f5f0ad2 --- /dev/null +++ b/mifosng-provider/src/main/java/org/mifosplatform/scheduledjobs/domain/ScheduledJobRunHistory.java @@ -0,0 +1,62 @@ +package org.mifosplatform.scheduledjobs.domain; + +import java.util.Date; + +import javax.persistence.Column; +import javax.persistence.Entity; +import javax.persistence.JoinColumn; +import javax.persistence.ManyToOne; +import javax.persistence.Table; +import javax.persistence.Temporal; +import javax.persistence.TemporalType; + +import org.springframework.data.jpa.domain.AbstractPersistable; + +@Entity +@Table(name = "scheduled_job_runhistory") +public class ScheduledJobRunHistory extends AbstractPersistable { + + @ManyToOne + @JoinColumn(name = "job_id") + private ScheduledJobDetails scheduledJobDetails; + + @Column(name = "version") + private Long version; + + @Column(name = "start_time") + @Temporal(TemporalType.TIMESTAMP) + private Date startTime; + + @Column(name = "end_time") + @Temporal(TemporalType.TIMESTAMP) + private Date endTime; + + @Column(name = "status") + private String status; + + @Column(name = "errormessage") + private String errorMessage; + + @Column(name = "triggertype") + private String triggerType; + + @Column(name = "errorlog") + private String errorLog; + + public ScheduledJobRunHistory() { + + } + + public ScheduledJobRunHistory(final ScheduledJobDetails scheduledJobDetails, final Long version, final Date startTime, + final Date endTime, final String status, final String errorMessage, final String triggerType, final String errorLog) { + this.scheduledJobDetails = scheduledJobDetails; + this.version = version; + this.startTime = startTime; + this.endTime = endTime; + this.status = status; + this.errorMessage = errorMessage; + this.triggerType = triggerType; + this.errorLog = errorLog; + } + +} diff --git a/mifosng-provider/src/main/java/org/mifosplatform/scheduledjobs/domain/ScheduledJobRunHistoryRepository.java b/mifosng-provider/src/main/java/org/mifosplatform/scheduledjobs/domain/ScheduledJobRunHistoryRepository.java new file mode 100755 index 000000000..08b8b4036 --- /dev/null +++ b/mifosng-provider/src/main/java/org/mifosplatform/scheduledjobs/domain/ScheduledJobRunHistoryRepository.java @@ -0,0 +1,14 @@ +package org.mifosplatform.scheduledjobs.domain; + +import org.springframework.data.jpa.repository.JpaRepository; +import org.springframework.data.jpa.repository.JpaSpecificationExecutor; +import org.springframework.data.jpa.repository.Query; +import org.springframework.data.repository.query.Param; + +public interface ScheduledJobRunHistoryRepository extends JpaRepository, + JpaSpecificationExecutor { + + @Query("select max(sjrh.version) from ScheduledJobRunHistory sjrh where sjrh.scheduledJobDetails.triggerKey = :triggerKey") + Long findMaxVersionByTriggerKey(@Param("triggerKey") String triggerKey); + +} diff --git a/mifosng-provider/src/main/java/org/mifosplatform/scheduledjobs/service/JobRegisterService.java b/mifosng-provider/src/main/java/org/mifosplatform/scheduledjobs/service/JobRegisterService.java new file mode 100755 index 000000000..62604ae37 --- /dev/null +++ b/mifosng-provider/src/main/java/org/mifosplatform/scheduledjobs/service/JobRegisterService.java @@ -0,0 +1,172 @@ +package org.mifosplatform.scheduledjobs.service; + +import java.util.List; +import java.util.TimeZone; + +import javax.annotation.PostConstruct; + +import org.mifosplatform.infrastructure.core.domain.MifosPlatformTenant; +import org.mifosplatform.infrastructure.core.service.ThreadLocalContextUtil; +import org.mifosplatform.infrastructure.security.service.TenantDetailsService; +import org.mifosplatform.scheduledjobs.annotation.CronMethodParser; +import org.mifosplatform.scheduledjobs.domain.ScheduledJobDetails; +import org.quartz.JobDataMap; +import org.quartz.JobDetail; +import org.quartz.JobKey; +import org.quartz.SchedulerException; +import org.quartz.Trigger; +import org.quartz.TriggerKey; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.context.ApplicationContext; +import org.springframework.scheduling.quartz.CronTriggerFactoryBean; +import org.springframework.scheduling.quartz.MethodInvokingJobDetailFactoryBean; +import org.springframework.scheduling.quartz.SchedulerFactoryBean; +import org.springframework.stereotype.Service; + +/** + * Service class to create and load batch jobs to Scheduler using + * {@link SchedulerFactoryBean} ,{@link MethodInvokingJobDetailFactoryBean} and + * {@link CronTriggerFactoryBean} + * + */ +@Service +public class JobRegisterService { + + private final ApplicationContext applicationContext; + + private final SchedulerFactoryBean schedulerFactoryBean; + + private final SchedularService schedularService; + + private final TenantDetailsService tenantDetailsService; + + @Autowired + public JobRegisterService(final ApplicationContext applicationContext, final SchedulerFactoryBean schedulerFactoryBean, + final SchedularService schedularService, final TenantDetailsService tenantDetailsService) { + this.applicationContext = applicationContext; + this.schedularService = schedularService; + this.schedulerFactoryBean = schedulerFactoryBean; + this.tenantDetailsService = tenantDetailsService; + } + + @PostConstruct + public void loadAllJobs() { + List allTenants = this.tenantDetailsService.findAllTenants(); + for (MifosPlatformTenant tenant : allTenants) { + ThreadLocalContextUtil.setTenant(tenant); + List scheduledJobDetails = this.schedularService.getScheduledJobDetails(); + for (ScheduledJobDetails jobDetails : scheduledJobDetails) { + if (jobDetails.isActiveSchedular()) { + scheduleJob(jobDetails); + this.schedularService.saveOrUpdate(jobDetails); + } + } + } + } + + public void excuteJob(TriggerKey triggerKey) { + JobDataMap jobDataMap = new JobDataMap(); + jobDataMap.put(SchedularServiceConstants.TRIGGER_TYPE_REFERENCE, SchedularServiceConstants.TRIGGER_TYPE_APPLICATION); + try { + JobKey jobKey = schedulerFactoryBean.getScheduler().getTrigger(triggerKey).getJobKey(); + schedulerFactoryBean.getScheduler().triggerJob(jobKey); + } catch (SchedulerException e) { + e.printStackTrace(); + } + + } + + public void rescheduleJob(ScheduledJobDetails scheduledJobDetails) { + try { + String triggerIdentity = scheduledJobDetails.getTriggerKey(); + String[] triggerKeyIds = triggerIdentity.split(SchedularServiceConstants.TRIGGER_KEY_SEPERATOR); + TriggerKey triggerKey = new TriggerKey(triggerKeyIds[0].trim(), triggerKeyIds[1].trim()); + JobDetail jobDetail = createJobDetail(scheduledJobDetails); + Trigger trigger = createTrigger(scheduledJobDetails, jobDetail); + schedulerFactoryBean.getScheduler().rescheduleJob(triggerKey, trigger); + scheduledJobDetails.updateTriggerKey(getTriggerKey(trigger.getKey())); + scheduledJobDetails.updateNextRunTime(trigger.getNextFireTime()); + scheduledJobDetails.updateErrorLog(null); + this.schedularService.saveOrUpdate(scheduledJobDetails); + } catch (Throwable throwable) { + String stackTrace = getStackTraceAsString(throwable); + scheduledJobDetails.updateErrorLog(stackTrace); + this.schedularService.saveOrUpdate(scheduledJobDetails); + } + } + + private void scheduleJob(ScheduledJobDetails scheduledJobDetails) { + try { + JobDetail jobDetail = createJobDetail(scheduledJobDetails); + Trigger trigger = createTrigger(scheduledJobDetails, jobDetail); + schedulerFactoryBean.getScheduler().scheduleJob(jobDetail, trigger); + scheduledJobDetails.updateTriggerKey(getTriggerKey(trigger.getKey())); + scheduledJobDetails.updateNextRunTime(trigger.getNextFireTime()); + scheduledJobDetails.updateErrorLog(null); + } catch (Throwable throwable) { + String stackTrace = getStackTraceAsString(throwable); + scheduledJobDetails.updateErrorLog(stackTrace); + } + } + + private JobDetail createJobDetail(ScheduledJobDetails scheduledJobDetails) throws Exception { + MifosPlatformTenant tenant = ThreadLocalContextUtil.getTenant(); + String[] jobDetails = CronMethodParser.findTargetMethodDetails(scheduledJobDetails.getJobName()); + String[] beanNames = this.applicationContext.getBeanNamesForType(Class.forName(jobDetails[CronMethodParser.CLASS_INDEX])); + Object targetObject = this.applicationContext.getBean(beanNames[0]); + for(String beanName:beanNames){ + Object nextObject = this.applicationContext.getBean(beanName); + if (nextObject != null && !targetObject.getClass().isAssignableFrom(nextObject.getClass())){ + targetObject = nextObject; + } + } + MethodInvokingJobDetailFactoryBean jobDetailFactoryBean = new MethodInvokingJobDetailFactoryBean(); + jobDetailFactoryBean.setName(scheduledJobDetails.getJobName() + "JobDetail-" + tenant.getId()); + jobDetailFactoryBean.setTargetObject(targetObject); + jobDetailFactoryBean.setTargetMethod(jobDetails[CronMethodParser.METHOD_INDEX]); + jobDetailFactoryBean.setGroup(scheduledJobDetails.getGroupName()); + jobDetailFactoryBean.setConcurrent(false); + jobDetailFactoryBean.afterPropertiesSet(); + return jobDetailFactoryBean.getObject(); + } + + /** + * @param scheduledJobDetails + * @return + */ + private Trigger createTrigger(ScheduledJobDetails scheduledJobDetails, JobDetail jobDetail) { + MifosPlatformTenant tenant = ThreadLocalContextUtil.getTenant(); + CronTriggerFactoryBean cronTriggerFactoryBean = new CronTriggerFactoryBean(); + cronTriggerFactoryBean.setName(scheduledJobDetails.getJobName() + "Trigger-" + tenant.getId()); + cronTriggerFactoryBean.setJobDetail(jobDetail); + JobDataMap jobDataMap = new JobDataMap(); + jobDataMap.put(SchedularServiceConstants.TENANT_IDENTIFIER, tenant.getTenantIdentifier()); + cronTriggerFactoryBean.setJobDataMap(jobDataMap); + TimeZone timeZone = TimeZone.getTimeZone(tenant.getTimezoneId()); + cronTriggerFactoryBean.setTimeZone(timeZone); + cronTriggerFactoryBean.setGroup(scheduledJobDetails.getGroupName()); + cronTriggerFactoryBean.setCronExpression(scheduledJobDetails.getCroneExpression()); + cronTriggerFactoryBean.setPriority(scheduledJobDetails.getTaskPriority()); + cronTriggerFactoryBean.afterPropertiesSet(); + return cronTriggerFactoryBean.getObject(); + } + + /** + * @param throwable + * @return + */ + private String getStackTraceAsString(Throwable throwable) { + StackTraceElement[] stackTraceElements = throwable.getStackTrace(); + StringBuffer sb = new StringBuffer(throwable.toString()); + for (StackTraceElement element : stackTraceElements) { + sb.append("\n \t at ").append(element.getClassName()).append(".").append(element.getMethodName()).append("(") + .append(element.getLineNumber()).append(")"); + } + return sb.toString(); + } + + private String getTriggerKey(TriggerKey triggerKey) { + return triggerKey.getName() + SchedularServiceConstants.TRIGGER_KEY_SEPERATOR + triggerKey.getGroup(); + } + +} diff --git a/mifosng-provider/src/main/java/org/mifosplatform/scheduledjobs/service/SchedularService.java b/mifosng-provider/src/main/java/org/mifosplatform/scheduledjobs/service/SchedularService.java new file mode 100755 index 000000000..ab635758e --- /dev/null +++ b/mifosng-provider/src/main/java/org/mifosplatform/scheduledjobs/service/SchedularService.java @@ -0,0 +1,20 @@ +package org.mifosplatform.scheduledjobs.service; + +import java.util.List; + +import org.mifosplatform.scheduledjobs.domain.ScheduledJobDetails; +import org.mifosplatform.scheduledjobs.domain.ScheduledJobRunHistory; + +public interface SchedularService { + + public List getScheduledJobDetails(); + + public ScheduledJobDetails getByTriggerKey(String triggerKey); + + public void saveOrUpdate(ScheduledJobDetails scheduledJobDetails); + + public void saveOrUpdate(ScheduledJobDetails scheduledJobDetails, ScheduledJobRunHistory scheduledJobRunHistory); + + public Long getMaxVersionBy(String triggerKey); + +} diff --git a/mifosng-provider/src/main/java/org/mifosplatform/scheduledjobs/service/SchedularServiceConstants.java b/mifosng-provider/src/main/java/org/mifosplatform/scheduledjobs/service/SchedularServiceConstants.java new file mode 100755 index 000000000..9b69dc784 --- /dev/null +++ b/mifosng-provider/src/main/java/org/mifosplatform/scheduledjobs/service/SchedularServiceConstants.java @@ -0,0 +1,17 @@ +package org.mifosplatform.scheduledjobs.service; + +public interface SchedularServiceConstants { + + public static final String TRIGGER_KEY_SEPERATOR = " _ "; + public static final String TRIGGER_TYPE_CRON = "cron"; + public static final String TRIGGER_TYPE_APPLICATION = "application"; + public static final String TRIGGER_TYPE_REFERENCE = "TRIGGER_TYPE_REFERENCE"; + public static final String SCHEDULAR_EXCEPTION = "SchedulerException"; + public static final String JOB_EXECUTION_EXCEPTION = "JobExecutionException"; + public static final String JOB_METHOD_INVOCATION_FAILED_EXCEPTION = "JobMethodInvocationFailedException"; + public static final String STATUS_SUCCESS = "success"; + public static final String STATUS_FAILED = "failed"; + public static final String DEFAULT_LISTENER_NAME = "Global Listner"; + public static final int STACK_TRACE_LEVEL = 7; + public static final String TENANT_IDENTIFIER = "tenantIdentifier"; +} \ No newline at end of file diff --git a/mifosng-provider/src/main/java/org/mifosplatform/scheduledjobs/service/SchedularServiceJpaRepositoryImpl.java b/mifosng-provider/src/main/java/org/mifosplatform/scheduledjobs/service/SchedularServiceJpaRepositoryImpl.java new file mode 100755 index 000000000..593d40573 --- /dev/null +++ b/mifosng-provider/src/main/java/org/mifosplatform/scheduledjobs/service/SchedularServiceJpaRepositoryImpl.java @@ -0,0 +1,59 @@ +package org.mifosplatform.scheduledjobs.service; + +import java.util.List; + +import org.mifosplatform.scheduledjobs.domain.ScheduledJobDetails; +import org.mifosplatform.scheduledjobs.domain.ScheduledJobDetailsRepository; +import org.mifosplatform.scheduledjobs.domain.ScheduledJobRunHistory; +import org.mifosplatform.scheduledjobs.domain.ScheduledJobRunHistoryRepository; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.stereotype.Service; +import org.springframework.transaction.annotation.Transactional; + +@Service +public class SchedularServiceJpaRepositoryImpl implements SchedularService { + + private final ScheduledJobDetailsRepository scheduledJobDetailsRepository; + + private final ScheduledJobRunHistoryRepository scheduledJobRunHistoryRepository; + + @Autowired + public SchedularServiceJpaRepositoryImpl(final ScheduledJobDetailsRepository scheduledJobDetailsRepository, + final ScheduledJobRunHistoryRepository scheduledJobRunHistoryRepository) { + this.scheduledJobDetailsRepository = scheduledJobDetailsRepository; + this.scheduledJobRunHistoryRepository = scheduledJobRunHistoryRepository; + } + + @Override + public List getScheduledJobDetails() { + return scheduledJobDetailsRepository.findAll(); + } + + @Override + public ScheduledJobDetails getByTriggerKey(final String triggerKey) { + return scheduledJobDetailsRepository.findByTriggerKey(triggerKey); + } + + @Transactional + @Override + public void saveOrUpdate(final ScheduledJobDetails scheduledJobDetails) { + this.scheduledJobDetailsRepository.save(scheduledJobDetails); + } + + @Transactional + @Override + public void saveOrUpdate(final ScheduledJobDetails scheduledJobDetails, final ScheduledJobRunHistory scheduledJobRunHistory) { + this.scheduledJobDetailsRepository.save(scheduledJobDetails); + this.scheduledJobRunHistoryRepository.save(scheduledJobRunHistory); + } + + @Override + public Long getMaxVersionBy(final String triggerKey) { + Long version = 0L; + Long versionFromDB = scheduledJobRunHistoryRepository.findMaxVersionByTriggerKey(triggerKey); + if (versionFromDB != null) { + version = versionFromDB; + } + return version; + } +} diff --git a/mifosng-provider/src/main/java/org/mifosplatform/scheduledjobs/service/ScheduledJobRunnerService.java b/mifosng-provider/src/main/java/org/mifosplatform/scheduledjobs/service/ScheduledJobRunnerService.java index 219f827af..704d43d4b 100644 --- a/mifosng-provider/src/main/java/org/mifosplatform/scheduledjobs/service/ScheduledJobRunnerService.java +++ b/mifosng-provider/src/main/java/org/mifosplatform/scheduledjobs/service/ScheduledJobRunnerService.java @@ -10,10 +10,8 @@ public interface ScheduledJobRunnerService { void updateLoanSummaryDetails(); void updateLoanArrearsAgeingDetails(); - + void updateLoanPaidInAdvance(); - - void applyAnnualFeeForSavings(); - - void applyHolidaysToLoans(); + + void applyAnnualFeeForSavings(); } diff --git a/mifosng-provider/src/main/java/org/mifosplatform/scheduledjobs/service/ScheduledJobRunnerServiceImpl.java b/mifosng-provider/src/main/java/org/mifosplatform/scheduledjobs/service/ScheduledJobRunnerServiceImpl.java index 801d7d899..a8992da89 100644 --- a/mifosng-provider/src/main/java/org/mifosplatform/scheduledjobs/service/ScheduledJobRunnerServiceImpl.java +++ b/mifosng-provider/src/main/java/org/mifosplatform/scheduledjobs/service/ScheduledJobRunnerServiceImpl.java @@ -7,12 +7,10 @@ package org.mifosplatform.scheduledjobs.service; import java.util.List; -import org.mifosplatform.infrastructure.core.domain.MifosPlatformTenant; -import org.mifosplatform.infrastructure.core.service.DataSourcePerTenantService; +import org.mifosplatform.infrastructure.core.service.RoutingDataSourceServiceFactory; import org.mifosplatform.infrastructure.core.service.ThreadLocalContextUtil; -import org.mifosplatform.infrastructure.security.service.TenantDetailsService; -import org.mifosplatform.portfolio.loanaccount.service.LoanWritePlatformService; import org.mifosplatform.portfolio.savings.service.SavingsAccountWritePlatformService; +import org.mifosplatform.scheduledjobs.annotation.CronTargetMethod; import org.slf4j.Logger; import org.slf4j.LoggerFactory; import org.springframework.beans.factory.annotation.Autowired; @@ -24,31 +22,22 @@ import org.springframework.transaction.annotation.Transactional; public class ScheduledJobRunnerServiceImpl implements ScheduledJobRunnerService { private final static Logger logger = LoggerFactory.getLogger(ScheduledJobRunnerServiceImpl.class); - - private final TenantDetailsService tenantDetailsService; - private final DataSourcePerTenantService dataSourcePerTenantService; + private final RoutingDataSourceServiceFactory dataSourceServiceFactory; private final SavingsAccountWritePlatformService savingsAccountWritePlatformService; - private final LoanWritePlatformService loanWritePlatformService; @Autowired - public ScheduledJobRunnerServiceImpl(final DataSourcePerTenantService dataSourcePerTenantService, - final TenantDetailsService tenantDetailsService, final SavingsAccountWritePlatformService savingsAccountWritePlatformService, - final LoanWritePlatformService loanWritePlatformService) { - this.dataSourcePerTenantService = dataSourcePerTenantService; - this.tenantDetailsService = tenantDetailsService; + public ScheduledJobRunnerServiceImpl(final RoutingDataSourceServiceFactory dataSourceServiceFactory, + final SavingsAccountWritePlatformService savingsAccountWritePlatformService) { + this.dataSourceServiceFactory = dataSourceServiceFactory; this.savingsAccountWritePlatformService = savingsAccountWritePlatformService; - this.loanWritePlatformService = loanWritePlatformService; } @Transactional @Override + @CronTargetMethod(jobName="Update loan Summary") public void updateLoanSummaryDetails() { - List allTenants = this.tenantDetailsService.findAllTenants(); - for (MifosPlatformTenant tenant : allTenants) { - ThreadLocalContextUtil.setTenant(tenant); - - JdbcTemplate jdbcTemplate = new JdbcTemplate(dataSourcePerTenantService.retrieveTenantAwareDataSource()); + JdbcTemplate jdbcTemplate = new JdbcTemplate(dataSourceServiceFactory.determineDataSourceService().retrieveDataSource()); StringBuilder updateSqlBuilder = new StringBuilder(900); updateSqlBuilder.append("update m_loan "); @@ -121,19 +110,15 @@ public class ScheduledJobRunnerServiceImpl implements ScheduledJobRunnerService int result = jdbcTemplate.update(updateSqlBuilder.toString()); - logger.info(tenant.getName() + ": Results affected by update: " + result); - } + logger.info(ThreadLocalContextUtil.getTenant().getName() + ": Results affected by update: " + result); } @Transactional @Override + @CronTargetMethod(jobName="Update Loan Arrears Ageing") public void updateLoanArrearsAgeingDetails() { - List allTenants = this.tenantDetailsService.findAllTenants(); - for (MifosPlatformTenant tenant : allTenants) { - ThreadLocalContextUtil.setTenant(tenant); - - JdbcTemplate jdbcTemplate = new JdbcTemplate(dataSourcePerTenantService.retrieveTenantAwareDataSource()); + JdbcTemplate jdbcTemplate = new JdbcTemplate(dataSourceServiceFactory.determineDataSourceService().retrieveDataSource()); jdbcTemplate.execute("truncate table m_loan_arrears_aging"); @@ -165,19 +150,15 @@ public class ScheduledJobRunnerServiceImpl implements ScheduledJobRunnerService int result = jdbcTemplate.update(updateSqlBuilder.toString()); - logger.info(tenant.getName() + ": Results affected by update: " + result); - } + logger.info(ThreadLocalContextUtil.getTenant().getName() + ": Results affected by update: " + result); } @Transactional @Override + @CronTargetMethod(jobName="Update Loan Paid In Advance") public void updateLoanPaidInAdvance() { - List allTenants = this.tenantDetailsService.findAllTenants(); - for (MifosPlatformTenant tenant : allTenants) { - ThreadLocalContextUtil.setTenant(tenant); - - JdbcTemplate jdbcTemplate = new JdbcTemplate(dataSourcePerTenantService.retrieveTenantAwareDataSource()); + JdbcTemplate jdbcTemplate = new JdbcTemplate(dataSourceServiceFactory.determineDataSourceService().retrieveDataSource()); jdbcTemplate.execute("truncate table m_loan_paid_in_advance"); @@ -200,19 +181,15 @@ public class ScheduledJobRunnerServiceImpl implements ScheduledJobRunnerService int result = jdbcTemplate.update(updateSqlBuilder.toString()); - logger.info(tenant.getName() + ": Results affected by update: " + result); - } + logger.info(ThreadLocalContextUtil.getTenant().getName() + ": Results affected by update: " + result); } @Transactional @Override + @CronTargetMethod(jobName="Apply Annual Fee For Savings") public void applyAnnualFeeForSavings() { - List allTenants = this.tenantDetailsService.findAllTenants(); - for (MifosPlatformTenant tenant : allTenants) { - ThreadLocalContextUtil.setTenant(tenant); - - JdbcTemplate jdbcTemplate = new JdbcTemplate(dataSourcePerTenantService.retrieveTenantAwareDataSource()); + JdbcTemplate jdbcTemplate = new JdbcTemplate(dataSourceServiceFactory.determineDataSourceService().retrieveDataSource()); String sql = "SELECT ms.id as savingsAccountId FROM m_savings_account ms WHERE ms.annual_fee_next_due_date <= NOW() "; List savingsIds = jdbcTemplate.queryForList(sql, Long.class); @@ -221,17 +198,7 @@ public class ScheduledJobRunnerServiceImpl implements ScheduledJobRunnerService this.savingsAccountWritePlatformService.applyAnnualFee(savingsId); } - logger.info(tenant.getName() + ": Results affected by update: " + savingsIds.size()); - } + logger.info(ThreadLocalContextUtil.getTenant().getName() + ": Results affected by update: " + savingsIds.size()); } - @Transactional - @Override - public void applyHolidaysToLoans() { - List allTenants = this.tenantDetailsService.findAllTenants(); - for (MifosPlatformTenant tenant : allTenants) { - ThreadLocalContextUtil.setTenant(tenant); - this.loanWritePlatformService.applyHolidaysToLoans(); - } - } } \ No newline at end of file diff --git a/mifosng-provider/src/main/java/org/mifosplatform/scheduledjobs/service/SchedulerJobListener.java b/mifosng-provider/src/main/java/org/mifosplatform/scheduledjobs/service/SchedulerJobListener.java new file mode 100755 index 000000000..1dc761d64 --- /dev/null +++ b/mifosng-provider/src/main/java/org/mifosplatform/scheduledjobs/service/SchedulerJobListener.java @@ -0,0 +1,113 @@ +package org.mifosplatform.scheduledjobs.service; + +import java.util.Date; + +import org.mifosplatform.infrastructure.core.domain.MifosPlatformTenant; +import org.mifosplatform.infrastructure.core.service.ThreadLocalContextUtil; +import org.mifosplatform.infrastructure.security.service.TenantDetailsService; +import org.mifosplatform.scheduledjobs.domain.ScheduledJobDetails; +import org.mifosplatform.scheduledjobs.domain.ScheduledJobRunHistory; +import org.quartz.JobExecutionContext; +import org.quartz.JobExecutionException; +import org.quartz.JobListener; +import org.quartz.Trigger; +import org.quartz.TriggerKey; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.stereotype.Component; + +/** + * Global job Listener class to set Tenant details to + * {@link ThreadLocalContextUtil} for batch Job and stores the batch job status + * to database after the execution + * + */ +@Component +public class SchedulerJobListener implements JobListener { + + private int stackTraceLevel = 0; + + private String name = SchedularServiceConstants.DEFAULT_LISTENER_NAME; + + private final SchedularService schedularService; + + private final TenantDetailsService tenantDetailsService; + + @Autowired + public SchedulerJobListener(SchedularService schedularService, TenantDetailsService tenantDetailsService) { + this.schedularService = schedularService; + this.tenantDetailsService = tenantDetailsService; + } + + @Override + public String getName() { + return this.name; + } + + @Override + public void jobToBeExecuted(JobExecutionContext context) { + String tenantIdentifier = context.getTrigger().getJobDataMap().getString(SchedularServiceConstants.TENANT_IDENTIFIER); + MifosPlatformTenant tenant = this.tenantDetailsService.loadTenantById(tenantIdentifier); + ThreadLocalContextUtil.setTenant(tenant); + } + + @Override + public void jobExecutionVetoed(JobExecutionContext context) { + + } + + @Override + public void jobWasExecuted(JobExecutionContext context, JobExecutionException jobException) { + Trigger trigger = context.getTrigger(); + TriggerKey key = trigger.getKey(); + String triggerKey = key.getName() + SchedularServiceConstants.TRIGGER_KEY_SEPERATOR + key.getGroup(); + final ScheduledJobDetails scheduledJobDetails = schedularService.getByTriggerKey(triggerKey); + Long version = schedularService.getMaxVersionBy(triggerKey) + 1; + String status = SchedularServiceConstants.STATUS_SUCCESS; + String errorMessage = null; + String errorLog = null; + if (jobException != null) { + status = SchedularServiceConstants.STATUS_FAILED; + stackTraceLevel = 0; + Throwable throwable = getCauseFromException(jobException); + stackTraceLevel = 0; + StackTraceElement[] stackTraceElements = null; + errorMessage = throwable.getMessage(); + stackTraceElements = throwable.getStackTrace(); + StringBuffer sb = new StringBuffer(throwable.toString()); + for (StackTraceElement element : stackTraceElements) { + sb.append("\n \t at ").append(element.getClassName()).append(".").append(element.getMethodName()).append("(") + .append(element.getLineNumber()).append(")"); + } + errorLog = sb.toString(); + + } + String triggerType = SchedularServiceConstants.TRIGGER_TYPE_CRON; + if (context.getMergedJobDataMap().containsKey(SchedularServiceConstants.TRIGGER_TYPE_REFERENCE)) { + triggerType = context.getMergedJobDataMap().getString(SchedularServiceConstants.TRIGGER_TYPE_REFERENCE); + + } + + scheduledJobDetails.updatePreviousRunStartTime(context.getFireTime()); + scheduledJobDetails.updateNextRunTime(trigger.getNextFireTime()); + + ScheduledJobRunHistory runHistory = new ScheduledJobRunHistory(scheduledJobDetails, version, context.getFireTime(), new Date(), + status, errorMessage, triggerType, errorLog); + // scheduledJobDetails.addRunHistory(runHistory); + + schedularService.saveOrUpdate(scheduledJobDetails, runHistory); + + } + + private Throwable getCauseFromException(Throwable exception) { + if (stackTraceLevel <= SchedularServiceConstants.STACK_TRACE_LEVEL + && exception.getCause() != null + && (exception.getCause().toString().contains(SchedularServiceConstants.SCHEDULAR_EXCEPTION) + || exception.getCause().toString().contains(SchedularServiceConstants.JOB_EXECUTION_EXCEPTION) || exception + .getCause().toString().contains(SchedularServiceConstants.JOB_METHOD_INVOCATION_FAILED_EXCEPTION))) { + stackTraceLevel++; + return getCauseFromException(exception.getCause()); + } else if (exception.getCause() != null) { return exception.getCause(); } + return exception; + } + +} diff --git a/mifosng-provider/src/main/java/org/mifosplatform/useradministration/service/AppUserReadPlatformServiceImpl.java b/mifosng-provider/src/main/java/org/mifosplatform/useradministration/service/AppUserReadPlatformServiceImpl.java index 8e1576af5..1f0f952f6 100644 --- a/mifosng-provider/src/main/java/org/mifosplatform/useradministration/service/AppUserReadPlatformServiceImpl.java +++ b/mifosng-provider/src/main/java/org/mifosplatform/useradministration/service/AppUserReadPlatformServiceImpl.java @@ -12,7 +12,7 @@ import java.util.Collection; import java.util.Set; import org.mifosplatform.infrastructure.core.domain.JdbcSupport; -import org.mifosplatform.infrastructure.core.service.TenantAwareRoutingDataSource; +import org.mifosplatform.infrastructure.core.service.RoutingDataSource; import org.mifosplatform.infrastructure.security.service.PlatformSecurityContext; import org.mifosplatform.organisation.office.data.OfficeData; import org.mifosplatform.organisation.office.service.OfficeReadPlatformService; @@ -37,7 +37,7 @@ public class AppUserReadPlatformServiceImpl implements AppUserReadPlatformServic private final AppUserRepository appUserRepository; @Autowired - public AppUserReadPlatformServiceImpl(final PlatformSecurityContext context, final TenantAwareRoutingDataSource dataSource, + public AppUserReadPlatformServiceImpl(final PlatformSecurityContext context, final RoutingDataSource dataSource, final OfficeReadPlatformService officeReadPlatformService, final RoleReadPlatformService roleReadPlatformService, final AppUserRepository appUserRepository) { this.context = context; diff --git a/mifosng-provider/src/main/java/org/mifosplatform/useradministration/service/PermissionReadPlatformServiceImpl.java b/mifosng-provider/src/main/java/org/mifosplatform/useradministration/service/PermissionReadPlatformServiceImpl.java index 9cc7decf6..4668ad69b 100644 --- a/mifosng-provider/src/main/java/org/mifosplatform/useradministration/service/PermissionReadPlatformServiceImpl.java +++ b/mifosng-provider/src/main/java/org/mifosplatform/useradministration/service/PermissionReadPlatformServiceImpl.java @@ -9,7 +9,7 @@ import java.sql.ResultSet; import java.sql.SQLException; import java.util.Collection; -import org.mifosplatform.infrastructure.core.service.TenantAwareRoutingDataSource; +import org.mifosplatform.infrastructure.core.service.RoutingDataSource; import org.mifosplatform.infrastructure.security.service.PlatformSecurityContext; import org.mifosplatform.useradministration.data.PermissionData; import org.slf4j.Logger; @@ -28,7 +28,7 @@ public class PermissionReadPlatformServiceImpl implements PermissionReadPlatform private final PlatformSecurityContext context; @Autowired - public PermissionReadPlatformServiceImpl(final PlatformSecurityContext context, final TenantAwareRoutingDataSource dataSource) { + public PermissionReadPlatformServiceImpl(final PlatformSecurityContext context, final RoutingDataSource dataSource) { this.context = context; this.jdbcTemplate = new JdbcTemplate(dataSource); } diff --git a/mifosng-provider/src/main/java/org/mifosplatform/useradministration/service/RoleReadPlatformServiceImpl.java b/mifosng-provider/src/main/java/org/mifosplatform/useradministration/service/RoleReadPlatformServiceImpl.java index 739a9f3d2..71e1769d2 100644 --- a/mifosng-provider/src/main/java/org/mifosplatform/useradministration/service/RoleReadPlatformServiceImpl.java +++ b/mifosng-provider/src/main/java/org/mifosplatform/useradministration/service/RoleReadPlatformServiceImpl.java @@ -10,7 +10,7 @@ import java.sql.SQLException; import java.util.Collection; import org.mifosplatform.infrastructure.core.domain.JdbcSupport; -import org.mifosplatform.infrastructure.core.service.TenantAwareRoutingDataSource; +import org.mifosplatform.infrastructure.core.service.RoutingDataSource; import org.mifosplatform.useradministration.data.RoleData; import org.mifosplatform.useradministration.exception.RoleNotFoundException; import org.springframework.beans.factory.annotation.Autowired; @@ -26,7 +26,7 @@ public class RoleReadPlatformServiceImpl implements RoleReadPlatformService { private final RoleMapper roleRowMapper; @Autowired - public RoleReadPlatformServiceImpl(final TenantAwareRoutingDataSource dataSource) { + public RoleReadPlatformServiceImpl(final RoutingDataSource dataSource) { this.jdbcTemplate = new JdbcTemplate(dataSource); this.roleRowMapper = new RoleMapper(); } diff --git a/mifosng-provider/src/main/resources/META-INF/spring/appContext.xml b/mifosng-provider/src/main/resources/META-INF/spring/appContext.xml index a3bca1119..f14d54ba0 100644 --- a/mifosng-provider/src/main/resources/META-INF/spring/appContext.xml +++ b/mifosng-provider/src/main/resources/META-INF/spring/appContext.xml @@ -29,7 +29,7 @@ org.mifosplatform.audit.*, org.mifosplatform.infrastructure.*, org.mifosplatform.scheduledjobs.*, - org.mifosplatform.organisation.*, + org.mifosplatform.organisation.*, org.mifosplatform.portfolio.loanaccount.*, org.mifosplatform.portfolio.savingsaccount.*, org.mifosplatform.portfolio.*, @@ -46,6 +46,7 @@ + diff --git a/mifosng-provider/src/main/resources/META-INF/spring/infrastructure.xml b/mifosng-provider/src/main/resources/META-INF/spring/infrastructure.xml index 031b14a11..7a267e4c3 100644 --- a/mifosng-provider/src/main/resources/META-INF/spring/infrastructure.xml +++ b/mifosng-provider/src/main/resources/META-INF/spring/infrastructure.xml @@ -14,7 +14,7 @@ http://www.springframework.org/schema/jee http://www.springframework.org/schema/jee/spring-jee-3.0.xsd"> - + diff --git a/mifosng-provider/src/main/resources/META-INF/spring/scheduler.xml b/mifosng-provider/src/main/resources/META-INF/spring/scheduler.xml index 28ec8b3ad..4302beb10 100644 --- a/mifosng-provider/src/main/resources/META-INF/spring/scheduler.xml +++ b/mifosng-provider/src/main/resources/META-INF/spring/scheduler.xml @@ -10,107 +10,13 @@ xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans.xsd"> - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - + - - - - - + + \ No newline at end of file