fineract-issues mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From nazeer1100126 <...@git.apache.org>
Subject [GitHub] fineract pull request #365: PR AdHocQuery API
Date Wed, 14 Jun 2017 12:49:33 GMT
Github user nazeer1100126 commented on a diff in the pull request:

    https://github.com/apache/fineract/pull/365#discussion_r121935446
  
    --- Diff: fineract-provider/src/main/java/org/apache/fineract/adhocquery/service/AdHocScheduledJobRunnerServiceImpl.java
---
    @@ -0,0 +1,80 @@
    +/**
    + * Licensed to the Apache Software Foundation (ASF) under one
    + * or more contributor license agreements. See the NOTICE file
    + * distributed with this work for additional information
    + * regarding copyright ownership. The ASF licenses this file
    + * to you under the Apache License, Version 2.0 (the
    + * "License"); you may not use this file except in compliance
    + * with the License. You may obtain a copy of the License at
    + *
    + * http://www.apache.org/licenses/LICENSE-2.0
    + *
    + * Unless required by applicable law or agreed to in writing,
    + * software distributed under the License is distributed on an
    + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
    + * KIND, either express or implied. See the License for the
    + * specific language governing permissions and limitations
    + * under the License.
    + */
    +package org.apache.fineract.adhocquery.service;
    +
    +import java.util.Collection;
    +
    +import org.apache.fineract.adhocquery.data.AdHocData;
    +import org.apache.fineract.adhocquery.service.AdHocReadPlatformService;
    +import org.apache.fineract.infrastructure.core.service.RoutingDataSourceServiceFactory;
    +import org.apache.fineract.infrastructure.core.service.ThreadLocalContextUtil;
    +import org.apache.fineract.infrastructure.jobs.annotation.CronTarget;
    +import org.apache.fineract.infrastructure.jobs.service.JobName;
    +import org.slf4j.Logger;
    +import org.slf4j.LoggerFactory;
    +import org.springframework.beans.factory.annotation.Autowired;
    +import org.springframework.jdbc.core.JdbcTemplate;
    +import org.springframework.stereotype.Service;
    +import org.springframework.transaction.annotation.Transactional;
    +
    +@Service(value = "adHocScheduledJobRunnerService")
    +public class AdHocScheduledJobRunnerServiceImpl implements AdHocScheduledJobRunnerService
{
    +
    +    private final static Logger logger = LoggerFactory.getLogger(AdHocScheduledJobRunnerServiceImpl.class);
    +    private final RoutingDataSourceServiceFactory dataSourceServiceFactory;
    +    private final AdHocReadPlatformService adHocReadPlatformService;
    +    
    +    @Autowired
    +    public AdHocScheduledJobRunnerServiceImpl(final RoutingDataSourceServiceFactory dataSourceServiceFactory,
    +    		final AdHocReadPlatformService adHocReadPlatformService
    +            ) {
    +        this.dataSourceServiceFactory = dataSourceServiceFactory;
    +        this.adHocReadPlatformService = adHocReadPlatformService;
    +       
    +    }
    +
    +    @Transactional
    +    @Override
    +    @CronTarget(jobName = JobName.GENERATE_ADHOCCLIENT_SCEHDULE)
    +    public void generateClientSchedule() {
    +    	final JdbcTemplate jdbcTemplate = new JdbcTemplate(this.dataSourceServiceFactory.determineDataSourceService().retrieveDataSource());
    --- End diff --
    
    You can create jdbcTemplate by autowiring  RoutingDataSource dataSource in the constructor
itself? Instead of creating the JDBCTemplate object here?


---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at infrastructure@apache.org or file a JIRA ticket
with INFRA.
---

Mime
View raw message