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


Java Period.isInclusiveBegin方法代码示例

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


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

示例1: getBeginParameter

import nl.strohalm.cyclos.utils.Period; //导入方法依赖的package包/类
/**
 * Returns the begin date of the given period, handling null
 */
public static QueryParameter getBeginParameter(final Period period) {
    if (period == null) {
        return null;
    }
    Calendar begin = period.getBegin();
    if (begin == null) {
        return null;
    }
    // We must consider the time when explicitly set
    if (!period.isUseTime()) {
        // Truncate the begin date
        begin = DateHelper.truncate(begin);
    }
    String operator = period.isInclusiveBegin() ? ">=" : ">";
    return new QueryParameter(begin, operator);
}
 
开发者ID:crypto-coder,项目名称:open-cyclos,代码行数:20,代码来源:HibernateHelper.java

示例2: balanceDiff

import nl.strohalm.cyclos.utils.Period; //导入方法依赖的package包/类
@Override
public BigDecimal balanceDiff(final Account account, Period period, final Transfer transfer) {
    if (account == null) {
        return BigDecimal.ZERO;
    }
    period = period.clone();
    period.setEnd(null);
    Map<String, Object> params = new HashMap<String, Object>();
    params.put("account", account.getId());
    StringBuilder hql = new StringBuilder();
    hql.append(" select sum( ");
    hql.append("     case when t.chargebackOf.id is null then ");
    hql.append("         case when t.from.id = :account then -t.amount else t.amount end ");
    hql.append("     else ");
    hql.append("         case when t.to.id = :account then t.amount else -t.amount end ");
    hql.append("     end)");
    hql.append(" from Transfer t ");
    hql.append(" where (t.from.id = :account or t.to.id = :account) ");
    hql.append("   and t.processDate is not null ");
    if (period != null && period.getBegin() != null) {
        hql.append("   and (t.processDate >");
        if (period.isInclusiveBegin()) {
            hql.append("=");
        }
        hql.append(" :beginDate ) ");
        params.put("beginDate", period.getBegin());
    }
    params.put("endDate", transfer.getProcessDate());
    params.put("transferId", transfer.getId());
    hql.append("   and (t.processDate < :endDate or (t.processDate = :endDate and t.id <");
    if (period != null && period.isInclusiveEnd()) {
        hql.append("=");
    }
    hql.append(" :transferId) ) ");
    BigDecimal diff = (BigDecimal) uniqueResult(hql.toString().trim(), params);
    return BigDecimalHelper.nvl(diff);
}
 
开发者ID:crypto-coder,项目名称:open-cyclos,代码行数:38,代码来源:TransferDAOImpl.java


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