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


Java Period.endingAt方法代码示例

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


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

示例1: activateAcceptedBrokerCommissionContracts

import nl.strohalm.cyclos.utils.Period; //导入方法依赖的package包/类
@Override
public void activateAcceptedBrokerCommissionContracts(final Calendar time) {
    final Period today = Period.endingAt(DateHelper.truncate(time));

    // Activate accepted contracts that begin today
    final BrokerCommissionContractQuery query = new BrokerCommissionContractQuery();
    query.setResultType(ResultType.ITERATOR);
    query.setStatus(BrokerCommissionContract.Status.ACCEPTED);
    query.setStartPeriod(today);
    final List<BrokerCommissionContract> contractsToActivate = brokerCommissionContractDao.search(query);
    try {
        for (final BrokerCommissionContract contractToActivate : contractsToActivate) {
            contractToActivate.setStatus(BrokerCommissionContract.Status.ACTIVE);
            brokerCommissionContractDao.update(contractToActivate);
        }
    } finally {
        DataIteratorHelper.close(contractsToActivate);
    }
}
 
开发者ID:crypto-coder,项目名称:open-cyclos,代码行数:20,代码来源:CommissionServiceImpl.java

示例2: getLatestReinitializedRates

import nl.strohalm.cyclos.utils.Period; //导入方法依赖的package包/类
@Override
public AccountRates getLatestReinitializedRates(final Account account, final Calendar date, final WhatRate whatRate) {
    Period period = Period.endingAt(date);
    // no period.setUseTime(true), because we should just find the latest reinitialized entiy, while the saved lastTransfer may be of a later time
    // that day.
    Map<String, Object> params = new HashMap<String, Object>();
    StringBuilder hql = new StringBuilder();
    hql.append(" from AccountRates r ");
    hql.append(" where 1=1 ");
    hql.append(" and r.account = :account ");
    params.put("account", account);
    HibernateHelper.addPeriodParameterToQuery(hql, params, "r.lastTransfer.processDate", period);
    hql.append(" order by r.lastTransfer.processDate desc");
    List<AccountRates> list = list(hql.toString(), params);
    AccountRates entity = null;
    boolean empty = false;
    if (list.size() > 0) {
        entity = list.get(0);
        if ((whatRate.isaRate() && entity.getEmissionDate() == null)
                || (whatRate.isdRate() && entity.getExpirationDate() == null)
                || (whatRate.isiRate() && entity.getiRate() == null)) {
            // this one is not yet processed, check out the previous if available
            if (list.size() > 1) {
                // we need to look back only one item, as this is called from an initializing iteration, and earlier items must be initialized yet
                // or non-existing
                entity = list.get(1);
                if ((whatRate.isaRate() && entity.getEmissionDate() == null)
                        || (whatRate.isdRate() && entity.getExpirationDate() == null)
                        || (whatRate.isiRate() && entity.getiRate() == null)) {
                    empty = true;
                }
            } else {
                empty = true;
            }
        }
    } else {
        empty = true;
    }
    return (empty) ? new AccountRates() : entity;
}
 
开发者ID:crypto-coder,项目名称:open-cyclos,代码行数:41,代码来源:AccountRatesDAOImpl.java

示例3: GetTransactionsDTO

import nl.strohalm.cyclos.utils.Period; //导入方法依赖的package包/类
public GetTransactionsDTO(final AccountOwner owner, final AccountType type, final Calendar date) {
    this(owner, type, Period.endingAt(date), null);
}
 
开发者ID:crypto-coder,项目名称:open-cyclos,代码行数:4,代码来源:GetTransactionsDTO.java


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