コード例 #1
0
  @Override
  @Transactional
  public Map<String, List<GanttChartItem>> resolve(
      final GanttChartScale scale, final JSONObject context, final Locale locale) {
    List<Entity> orders =
        dataDefinitionService
            .get("orders", "order")
            .find()
            .add(SearchRestrictions.ne("state", "04completed"))
            .add(SearchRestrictions.lt("dateFrom", scale.getDateTo()))
            .add(SearchRestrictions.gt("dateTo", scale.getDateFrom()))
            .list()
            .getEntities();

    List<GanttChartItem> items = new ArrayList<GanttChartItem>();

    for (Entity order : orders) {
      items.add(getItemForOrder(order, scale, locale));
    }

    return Collections.singletonMap("", items);
  }
コード例 #2
0
  private GanttChartItem getItemForOrder(
      final Entity order, final GanttChartScale scale, final Locale locale) {
    Date from = (Date) order.getField("dateFrom");
    Date to = (Date) order.getField("dateTo");

    if (order.getField("effectiveDateFrom") != null) {
      long diff = to.getTime() - from.getTime();
      from = (Date) order.getField("effectiveDateFrom");
      to = new Date(from.getTime() + diff);
    }

    return scale.createGanttChartItem(
        "", getOrderDescription(order, locale), order.getId(), from, to);
  }