本文整理汇总了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);
}
示例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);
}