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

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

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

import com.global.api.entities.enums.*;
import com.global.api.entities.reporting.SearchCriteria;
import com.global.api.entities.reporting.SearchCriteriaBuilder;
import lombok.Getter;
import lombok.Setter;
import lombok.experimental.Accessors;

@Accessors(chain = true)
@Getter
@Setter
public class UserReportBuilder extends ReportBuilder {
    @Getter @Setter private int page = 1;       // 1: DEFAULT PARAM VALUE
    @Getter @Setter private int pageSize = 5;   // 5: DEFAULT PARAM VALUE


    public SortDirection order;
    public MerchantAccountsSortProperty accountOrderBy;

    public TransactionType transactionType;

    public SearchCriteriaBuilder _searchBuilder;

    public TransactionModifier transactionModifier = TransactionModifier.None;

    public UserReportBuilder(ReportType type, Class clazz) {
        super(type, clazz);
    }

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

    @Override
    public void setupValidations() {

    }

    public UserReportBuilder orderBy(MerchantAccountsSortProperty orderBy, SortDirection direction) {
        accountOrderBy = orderBy;
        order = (direction != null) ? direction : SortDirection.Ascending;
        return this;
    }

    public UserReportBuilder withModifier(TransactionModifier transactionModifier) {
        this.transactionModifier = transactionModifier;
        return this;
    }

    public UserReportBuilder withAccountId(String accountId) {
        this.getSearchBuilder().setAccountId(accountId);
        return this;
    }

    public  SearchCriteriaBuilder where(SearchCriteria criteria, T value) {
        return getSearchBuilder().and(criteria, value);
    }

    public UserReportBuilder withPaging(int page, int pageSize) {
        this.page = page;
        this.pageSize = pageSize;
        return this;
    }

}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy