org.openmrs.Order.isActivated()方法的使用及代码示例

x33g5p2x  于2022-01-26 转载在 其他  
字(3.4k)|赞(0)|评价(0)|浏览(124)

本文整理了Java中org.openmrs.Order.isActivated()方法的一些代码示例,展示了Order.isActivated()的具体用法。这些代码示例主要来源于Github/Stackoverflow/Maven等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。Order.isActivated()方法的具体详情如下:
包路径:org.openmrs.Order
类名称:Order
方法名:isActivated

Order.isActivated介绍

[英]Convenience method to determine if the order is activated as of the current date
[中]确定订单是否在当前日期激活的便捷方法

代码示例

代码示例来源:origin: openmrs/openmrs-core

/**
 * Convenience method to determine if the order is activated as of the current date
 * 
 * @return boolean indicating whether the order was activated before or on the current date
 * @since 2.0
 * @see #isActivated(java.util.Date)
 */
public boolean isActivated() {
  return isActivated(new Date());
}

代码示例来源:origin: openmrs/openmrs-core

if (!isActivated(checkDate) || dateStopped == null) {
  return false;

代码示例来源:origin: openmrs/openmrs-core

if (!isActivated(checkDate)) {
  return false;

代码示例来源:origin: openmrs/openmrs-core

/**
 * Convenience method to determine if the order is active as of the specified date
 * 
 * @param checkDate - the date on which to check order. if null, will use current date
 * @return boolean indicating whether the order was active on the check date
 * @since 1.10.1
 * @should return true if an order expired on the check date
 * @should return true if an order was discontinued on the check date
 * @should return true if an order was activated on the check date
 * @should return true if an order was activated on the check date but scheduled for the future
 * @should return false for a voided order
 * @should return false for a discontinued order
 * @should return false for an expired order
 * @should return false for an order activated after the check date
 * @should return false for a discontinuation order
 */
public boolean isActive(Date aCheckDate) {
  if (getVoided() || action == Action.DISCONTINUE) {
    return false;
  }
  Date checkDate = aCheckDate == null ? new Date() : aCheckDate;
  return isActivated(checkDate) && !isDiscontinued(checkDate) && !isExpired(checkDate);
}

代码示例来源:origin: openmrs/openmrs-core

/**
 * @see Order#isActivated(Date)
 */
@Test
public void isActivated_shouldReturnFalseIfDateActivatedIsNull() throws Exception {
  Order order = new Order();
  assertNull(order.getDateActivated());
  assertNull(order.getAutoExpireDate());
  assertFalse(order.isActivated(DateUtils.parseDate("2014-11-01 11:11:10", DATE_FORMAT)));
}

代码示例来源:origin: openmrs/openmrs-core

/**
 * @see Order#isActivated(Date)
 */
@Test
public void isActivated_shouldReturnTrueIfAnOrderWasActivatedOnTheCheckDate() throws Exception {
  Order order = new Order();
  Date activationDate = DateUtils.parseDate("2014-11-01 11:11:10", DATE_FORMAT);
  order.setDateActivated(activationDate);
  assertNull(order.getDateStopped());
  assertNull(order.getAutoExpireDate());
  assertTrue(order.isActivated(activationDate));
}

代码示例来源:origin: openmrs/openmrs-core

/**
 * @see Order#isActivated(Date)
 */
@Test
public void isActivated_shouldReturnTrueIfAnOrderWasActivatedBeforeTheCheckDate() throws Exception {
  Order order = new Order();
  Date activationDate = DateUtils.parseDate("2014-11-01 11:11:10", DATE_FORMAT);
  order.setDateActivated(activationDate);
  assertNull(order.getDateStopped());
  assertNull(order.getAutoExpireDate());
  assertTrue(order.isActivated(DateUtils.addMonths(activationDate, 2)));
}

代码示例来源:origin: openmrs/openmrs-core

/**
 * @see Order#isActivated(Date)
 */
@Test
public void isActivated_shouldReturnFalseForAnOrderActivatedAfterTheCheckDate() throws Exception {
  Order order = new Order();
  order.setDateActivated(DateUtils.parseDate("2014-11-01 11:11:10", DATE_FORMAT));
  assertNull(order.getDateStopped());
  assertNull(order.getAutoExpireDate());
  assertFalse(order.isActivated(DateUtils.addMonths(order.getDateActivated(), -2)));
}

相关文章