示例#1
0
  @WebMethod
  public EventDescriptorPage listDocumentEventsByPage(
      @WebParam(name = "sessionId") String sessionId,
      @WebParam(name = "dataRangeQuery") String dateRangeQuery,
      @WebParam(name = "startDate") String startDate,
      @WebParam(name = "path") String path,
      @WebParam(name = "pageIndex") int page,
      @WebParam(name = "pageSize") int pageSize) {
    initSession(sessionId);

    String[] docCategories = {EVENT_DOCUMENT_CATEGORY, EVENT_LIFE_CYCLE_CATEGORY};

    List<LogEntry> logEntries;
    if (dateRangeQuery != null && dateRangeQuery.length() > 0) {
      logEntries =
          getLogsBean().queryLogsByPage(null, dateRangeQuery, docCategories, path, page, pageSize);
    } else {
      Date limit = DateParser.parseW3CDateTime(startDate);
      logEntries = getLogsBean().queryLogsByPage(null, limit, docCategories, path, page, pageSize);
    }
    boolean hasMorePage = logEntries.size() >= pageSize;

    List<EventDescriptor> events = new ArrayList<EventDescriptor>();

    for (LogEntry logEntry : logEntries) {
      events.add(new EventDescriptor(logEntry));
    }

    EventDescriptor[] evts = new EventDescriptor[events.size()];
    events.toArray(evts);

    return new EventDescriptorPage(evts, page, hasMorePage);
  }
 public static String getLastModifiedDate(PropertyMap map) {
   Date d = DateParser.parseDate(map.getString("dc:modified"));
   return sdf.format(d);
 }