All Downloads are FREE. Search and download functionalities are using the official Maven repository.

com.global.api.builders.ReportBuilder Maven / Gradle / Ivy

There is a newer version: 14.2.3
Show newest version
package com.global.api.builders;

import com.global.api.ServicesContainer;
import com.global.api.entities.enums.ReportType;
import com.global.api.entities.enums.TimeZoneConversion;
import com.global.api.entities.exceptions.ApiException;
import com.global.api.entities.reporting.SearchCriteriaBuilder;
import com.global.api.gateways.IReportingService;

public abstract class ReportBuilder extends BaseBuilder {
    private ReportType reportType;
    private TimeZoneConversion timeZoneConversion;
    private Class clazz;

    private SearchCriteriaBuilder _searchBuilder;

    public SearchCriteriaBuilder getSearchBuilder() {
        if (_searchBuilder == null) {
            _searchBuilder = new SearchCriteriaBuilder(this);
        }
        return _searchBuilder;
    }

    public ReportType getReportType() {
        return reportType;
    }
    public void setReportType(ReportType reportType) {
        this.reportType = reportType;
    }
    public TimeZoneConversion getTimeZoneConversion() {
        return timeZoneConversion;
    }
    public void setTimeZoneConversion(TimeZoneConversion timeZoneConversion) {
        this.timeZoneConversion = timeZoneConversion;
    }

    public ReportBuilder(ReportType type, Class clazz) {
        super();
        this.reportType = type;
        this.clazz = clazz;
    }

    public TResult execute(String configName) throws ApiException {
        super.execute(configName);
        Object client;

        switch (reportType) {
            case FindBankPayment:
                client = ServicesContainer.getInstance().getOpenBankingClient(configName);
                break;

            default:
                client = ServicesContainer.getInstance().getGateway(configName);
        }

        return ((IReportingService) client).processReport(this, clazz);
    }

}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy