当前位置: 首页>>代码示例>>Java>>正文


Java ScheduledPaymentQuery类代码示例

本文整理汇总了Java中nl.strohalm.cyclos.entities.accounts.transactions.ScheduledPaymentQuery的典型用法代码示例。如果您正苦于以下问题:Java ScheduledPaymentQuery类的具体用法?Java ScheduledPaymentQuery怎么用?Java ScheduledPaymentQuery使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。


ScheduledPaymentQuery类属于nl.strohalm.cyclos.entities.accounts.transactions包,在下文中一共展示了ScheduledPaymentQuery类的12个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: searchScheduledPayments

import nl.strohalm.cyclos.entities.accounts.transactions.ScheduledPaymentQuery; //导入依赖的package包/类
private ScheduledPaymentsResultPage searchScheduledPayments(final MemberAccount account, final SearchScheduledPaymentParams params) {
    Member member = memberService.loadByIdOrPrincipal(params.getMemberId(), null, params.getMemberPrincipal());

    // Convert the params to a TransferQuery
    ScheduledPaymentQuery query = new ScheduledPaymentQuery();
    queryHelper.fill(params, query);
    query.setOwner(account.getOwner());
    query.setMember(member);
    query.setPeriod(Period.between(params.getBeginDate(), params.getEndDate()));
    query.setSearchType(params.getIncoming() ? SearchType.INCOMING : SearchType.OUTGOING);
    if (params.getStatus() == null) {
        query.setStatusGroup(StatusGroup.OPEN);
    } else {
        query.setStatusGroup(StatusGroup.valueOf(params.getStatus().name()));
    }

    // Execute the search
    List<ScheduledPayment> scheduledPayments = scheduledPaymentService.search(query);
    return toScheduledResultPage(scheduledPayments);
}
 
开发者ID:mateli,项目名称:OpenCyclos,代码行数:21,代码来源:AccountsRestController.java

示例2: applyQueryRestrictions

import nl.strohalm.cyclos.entities.accounts.transactions.ScheduledPaymentQuery; //导入依赖的package包/类
private boolean applyQueryRestrictions(final ScheduledPaymentQuery query) {

        if (!permissionService.permission().admin(AdminSystemPermission.ACCOUNTS_SCHEDULED_INFORMATION, AdminMemberPermission.ACCOUNTS_SCHEDULED_INFORMATION)
                .broker(BrokerPermission.ACCOUNTS_SCHEDULED_INFORMATION)
                .member(MemberPermission.ACCOUNT_SCHEDULED_INFORMATION)
                .operator(OperatorPermission.ACCOUNT_SCHEDULED_INFORMATION).hasPermission()) {
            return false;
        }

        if (!canAccessAccount(query.getOwner(), query.getAccountType())) {
            return false;
        }

        // Must only filter by a managed member
        if (query.getMember() != null) {
            if (LoggedUser.isAdministrator() || LoggedUser.isBroker()) {
                if (!permissionService.manages(query.getMember())) {
                    return false;
                }
            } else if ((LoggedUser.isMember() || LoggedUser.isOperator()) && !LoggedUser.member().equals(query.getOwner())) {
                return false;
            }
        }
        return true;
    }
 
开发者ID:mateli,项目名称:OpenCyclos,代码行数:26,代码来源:ScheduledPaymentServiceSecurity.java

示例3: search

import nl.strohalm.cyclos.entities.accounts.transactions.ScheduledPaymentQuery; //导入依赖的package包/类
@Override
public List<ScheduledPayment> search(final ScheduledPaymentQuery query) {
    if (!applyQueryRestrictions(query)) {
        return Collections.emptyList();
    }
    return scheduledPaymentService.search(query);
}
 
开发者ID:mateli,项目名称:OpenCyclos,代码行数:8,代码来源:ScheduledPaymentServiceSecurity.java

示例4: executeQuery

import nl.strohalm.cyclos.entities.accounts.transactions.ScheduledPaymentQuery; //导入依赖的package包/类
@Override
protected void executeQuery(final ActionContext context, final QueryParameters queryParameters) {
    final ScheduledPaymentQuery query = (ScheduledPaymentQuery) queryParameters;
    List<ScheduledPayment> payments = null;
    if (LoggedUser.isAdministrator()) {
        query.setSearchType(SearchType.OUTGOING);
    }
    payments = scheduledPaymentService.search(query);
    context.getRequest().setAttribute("payments", payments);
}
 
开发者ID:mateli,项目名称:OpenCyclos,代码行数:11,代码来源:SearchScheduledPaymentsAction.java

示例5: getDataBinder

import nl.strohalm.cyclos.entities.accounts.transactions.ScheduledPaymentQuery; //导入依赖的package包/类
private DataBinder<ScheduledPaymentQuery> getDataBinder() {
    if (dataBinder == null) {
        final BeanBinder<ScheduledPaymentQuery> binder = BeanBinder.instance(ScheduledPaymentQuery.class);
        final LocalSettings localSettings = settingsService.getLocalSettings();
        binder.registerBinder("accountType", PropertyBinder.instance(AccountType.class, "accountType"));
        binder.registerBinder("searchType", PropertyBinder.instance(ScheduledPaymentQuery.SearchType.class, "searchType"));
        binder.registerBinder("statusGroup", PropertyBinder.instance(ScheduledPaymentQuery.StatusGroup.class, "statusGroup"));
        binder.registerBinder("period", DataBinderHelper.periodBinder(localSettings, "period"));
        binder.registerBinder("member", PropertyBinder.instance(Member.class, "member"));
        binder.registerBinder("pageParameters", DataBinderHelper.pageBinder());
        dataBinder = binder;
    }
    return dataBinder;
}
 
开发者ID:mateli,项目名称:OpenCyclos,代码行数:15,代码来源:SearchScheduledPaymentsAction.java

示例6: listScheduledPayments

import nl.strohalm.cyclos.entities.accounts.transactions.ScheduledPaymentQuery; //导入依赖的package包/类
public static List<Entry> listScheduledPayments(final ScheduledPaymentService scheduledPaymentService, final Member owner, final Calendar date) {
    final ScheduledPaymentQuery schedQuery = new ScheduledPaymentQuery();
    schedQuery.setIterateAll();
    schedQuery.setOwner(owner);
    schedQuery.setSearchType(SearchType.INCOMING);
    schedQuery.setPeriod(Period.day(date));
    final List<ScheduledPayment> scheduledPayments = scheduledPaymentService.search(schedQuery);
    final TransformedIteratorList<ScheduledPayment, Entry> scheduledPaymentEntries = new TransformedIteratorList<ScheduledPayment, Entry>(new TransformPaymentToEntry<ScheduledPayment>(owner), scheduledPayments);
    return scheduledPaymentEntries;
}
 
开发者ID:mateli,项目名称:OpenCyclos,代码行数:11,代码来源:SearchTransactionsAction.java

示例7: search

import nl.strohalm.cyclos.entities.accounts.transactions.ScheduledPaymentQuery; //导入依赖的package包/类
@Override
public List<ScheduledPayment> search(final ScheduledPaymentQuery query) {
    final Map<String, Object> namedParameters = new HashMap<String, Object>();
    final StringBuilder hql = JpaQueryHelper.getInitialQuery(ScheduledPayment.class, "sp", query.getFetch());
    JpaQueryHelper.addInParameterToQuery(hql, namedParameters, "sp.status", query.getStatusList());
    JpaQueryHelper.addPeriodParameterToQuery(hql, namedParameters, "sp.date", query.getPeriod());

    // Account owner
    List<? extends Account> ownerAccounts = new ArrayList<Account>();
    final AccountQuery accountQuery = new AccountQuery();
    accountQuery.setOwner(query.getOwner());
    if (query.getAccountType() != null) {
        accountQuery.setType(query.getAccountType());
    }
    ownerAccounts = accountDao.search(accountQuery);
    if (CollectionUtils.isEmpty(ownerAccounts)) {
        // No accounts - nothing will be returned
        return Collections.emptyList();
    }
    namedParameters.put("ownerAccounts", ownerAccounts);

    // Member
    List<? extends Account> otherAccounts = new ArrayList<MemberAccount>();
    if (query.getMember() != null) {
        final AccountQuery otherAccountsQuery = new AccountQuery();
        otherAccountsQuery.setOwner(query.getMember());
        otherAccounts = accountDao.search(otherAccountsQuery);
        if (CollectionUtils.isEmpty(otherAccounts)) {
            // No accounts - nothing will be returned
            return Collections.emptyList();
        }
        namedParameters.put("otherAccounts", otherAccounts);
    }

    // Search type
    if (query.getSearchType() == ScheduledPaymentQuery.SearchType.OUTGOING) {
        hql.append(" and sp.from in :ownerAccounts ");
        if (CollectionUtils.isNotEmpty(otherAccounts)) {
            hql.append(" and sp.to in :otherAccounts ");
        }
    } else {
        hql.append(" and sp.to in :ownerAccounts ");
        if (CollectionUtils.isNotEmpty(otherAccounts)) {
            hql.append(" and sp.from in :otherAccounts ");
        }
        hql.append(" and sp.showToReceiver = true");
    }

    JpaQueryHelper.appendOrder(hql, "sp.date desc");

    return list(query, hql.toString(), namedParameters);
}
 
开发者ID:mateli,项目名称:OpenCyclos,代码行数:53,代码来源:ScheduledPaymentDAOImpl.java

示例8: search

import nl.strohalm.cyclos.entities.accounts.transactions.ScheduledPaymentQuery; //导入依赖的package包/类
@Override
public List<ScheduledPayment> search(final ScheduledPaymentQuery query) {
    return scheduledPaymentDao.search(query);
}
 
开发者ID:mateli,项目名称:OpenCyclos,代码行数:5,代码来源:ScheduledPaymentServiceImpl.java

示例9: search

import nl.strohalm.cyclos.entities.accounts.transactions.ScheduledPaymentQuery; //导入依赖的package包/类
@Override
public List<ScheduledPayment> search(final ScheduledPaymentQuery query) {
    final Map<String, Object> namedParameters = new HashMap<String, Object>();
    final StringBuilder hql = HibernateHelper.getInitialQuery(ScheduledPayment.class, "sp", query.getFetch());
    HibernateHelper.addInParameterToQuery(hql, namedParameters, "sp.status", query.getStatusList());
    HibernateHelper.addPeriodParameterToQuery(hql, namedParameters, "sp.date", query.getPeriod());

    // Account owner
    List<? extends Account> ownerAccounts = new ArrayList<Account>();
    final AccountQuery accountQuery = new AccountQuery();
    accountQuery.setOwner(query.getOwner());
    if (query.getAccountType() != null) {
        accountQuery.setType(query.getAccountType());
    }
    ownerAccounts = accountDao.search(accountQuery);
    if (CollectionUtils.isEmpty(ownerAccounts)) {
        // No accounts - nothing will be returned
        return Collections.emptyList();
    }
    namedParameters.put("ownerAccounts", ownerAccounts);

    // Member
    List<? extends Account> otherAccounts = new ArrayList<MemberAccount>();
    if (query.getMember() != null) {
        final AccountQuery otherAccountsQuery = new AccountQuery();
        otherAccountsQuery.setOwner(query.getMember());
        otherAccounts = accountDao.search(otherAccountsQuery);
        if (CollectionUtils.isEmpty(otherAccounts)) {
            // No accounts - nothing will be returned
            return Collections.emptyList();
        }
        namedParameters.put("otherAccounts", otherAccounts);
    }

    // Search type
    if (query.getSearchType() == ScheduledPaymentQuery.SearchType.OUTGOING) {
        hql.append(" and sp.from in (:ownerAccounts) ");
        if (CollectionUtils.isNotEmpty(otherAccounts)) {
            hql.append(" and sp.to in (:otherAccounts) ");
        }
    } else {
        hql.append(" and sp.to in (:ownerAccounts) ");
        if (CollectionUtils.isNotEmpty(otherAccounts)) {
            hql.append(" and sp.from in (:otherAccounts) ");
        }
        hql.append(" and sp.showToReceiver = true");
    }

    HibernateHelper.appendOrder(hql, "sp.date desc");

    return list(query, hql.toString(), namedParameters);
}
 
开发者ID:crypto-coder,项目名称:open-cyclos,代码行数:53,代码来源:ScheduledPaymentDAOImpl.java

示例10: prepareForm

import nl.strohalm.cyclos.entities.accounts.transactions.ScheduledPaymentQuery; //导入依赖的package包/类
@Override
protected QueryParameters prepareForm(final ActionContext context) {
    final SearchScheduledPaymentsForm form = context.getForm();
    final HttpServletRequest request = context.getRequest();

    final ScheduledPaymentQuery query = getDataBinder().readFromString(form.getQuery());
    query.fetch(ScheduledPayment.Relationships.TRANSFERS, RelationshipHelper.nested(Payment.Relationships.FROM, MemberAccount.Relationships.MEMBER), RelationshipHelper.nested(Payment.Relationships.TO, MemberAccount.Relationships.MEMBER));

    // Account owner
    AccountOwner owner = null;
    if (form.getMemberId() > 0) {
        owner = (Member) elementService.load(form.getMemberId());
        request.setAttribute("memberId", form.getMemberId());
    } else {
        // An admin or member or an operator searching his own scheduled payments
        owner = context.getAccountOwner();
    }
    query.setOwner(owner);

    List<? extends AccountType> accountTypes;
    if (context.isAdmin() && owner instanceof SystemAccountOwner) {
        final SystemAccountTypeQuery satq = new SystemAccountTypeQuery();
        accountTypes = accountTypeService.search(satq);
    } else {
        final MemberAccountTypeQuery matq = new MemberAccountTypeQuery();
        matq.setOwner((Member) owner);
        accountTypes = accountTypeService.search(matq);
    }
    request.setAttribute("accountTypes", accountTypes);

    if (query.getMember() != null) {
        final Member member = elementService.load(query.getMember().getId(), Element.Relationships.USER);
        query.setMember(member);
    }
    if (query.getStatusList() == null) {
        query.setStatusGroup(ScheduledPaymentQuery.StatusGroup.OPEN);
        form.setQuery("statusGroup", ScheduledPaymentQuery.StatusGroup.OPEN);
    }

    RequestHelper.storeEnum(request, ScheduledPaymentQuery.SearchType.class, "searchTypes");
    RequestHelper.storeEnum(request, ScheduledPaymentQuery.StatusGroup.class, "statusGroups");
    request.setAttribute("accountOwner", owner);
    return query;
}
 
开发者ID:crypto-coder,项目名称:open-cyclos,代码行数:45,代码来源:SearchScheduledPaymentsAction.java

示例11: search

import nl.strohalm.cyclos.entities.accounts.transactions.ScheduledPaymentQuery; //导入依赖的package包/类
/**
 * Searches for scheduled payments
 */
List<ScheduledPayment> search(final ScheduledPaymentQuery query) throws DaoException;
 
开发者ID:mateli,项目名称:OpenCyclos,代码行数:5,代码来源:ScheduledPaymentDAO.java

示例12: search

import nl.strohalm.cyclos.entities.accounts.transactions.ScheduledPaymentQuery; //导入依赖的package包/类
/**
 * Searches for scheduled payments
 */
List<ScheduledPayment> search(ScheduledPaymentQuery query);
 
开发者ID:mateli,项目名称:OpenCyclos,代码行数:5,代码来源:ScheduledPaymentService.java


注:本文中的nl.strohalm.cyclos.entities.accounts.transactions.ScheduledPaymentQuery类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。