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


Java ScheduledPaymentQuery.getMember方法代码示例

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


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

示例1: 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

示例2: 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

示例3: 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

示例4: 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


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