private VisitorbookTimedDO getNewestEntry(final VisitorbookDO visitor) { List<VisitorbookTimedDO> timeableAttributes = timeableService.getTimeableAttrRowsForGroupName(visitor, "timeofvisit"); if (timeableAttributes != null && timeableAttributes.size() > 0) { List<VisitorbookTimedDO> sortedList = timeableService.sortTimeableAttrRowsByDateDescending(timeableAttributes); return sortedList.get(0); } return null; }
private List<T> getTimeableAttrRowsOfThisGroupSorted() { return timeableService.sortTimeableAttrRowsByDateDescending(getTimeableAttrRowsOfThisGroup()); }
/** * @see org.projectforge.web.wicket.CellItemListenerPropertyColumn#populateItem(org.apache.wicket.markup.repeater.Item, * java.lang.String, org.apache.wicket.model.IModel) */ @Override public void populateItem(final Item<ICellPopulator<VisitorbookDO>> item, final String componentId, final IModel<VisitorbookDO> rowModel) { final VisitorbookDO visitor = rowModel.getObject(); String value = ""; List<VisitorbookTimedDO> timeableAttributes = timeableService.getTimeableAttrRowsForGroupName(visitor, "timeofvisit"); if (timeableAttributes != null && timeableAttributes.size() > 0) { List<VisitorbookTimedDO> sortedList = timeableService.sortTimeableAttrRowsByDateDescending(timeableAttributes); VisitorbookTimedDO newestEntry = sortedList.get(0); SimpleDateFormat sdfParser = new SimpleDateFormat("dd.MM.yyyy"); String date = sdfParser.format(newestEntry.getStartTime()); String time = newestEntry.getAttribute("depart") != null ? newestEntry.getAttribute("depart", String.class) : ""; value = date + " " + time; } item.add(new TextPanel(componentId, value)); cellItemListener.populateItem(item, componentId, rowModel); } });
/** * @see org.projectforge.web.wicket.CellItemListenerPropertyColumn#populateItem(org.apache.wicket.markup.repeater.Item, * java.lang.String, org.apache.wicket.model.IModel) */ @Override public void populateItem(final Item<ICellPopulator<VisitorbookDO>> item, final String componentId, final IModel<VisitorbookDO> rowModel) { final VisitorbookDO visitor = rowModel.getObject(); String value = ""; List<VisitorbookTimedDO> timeableAttributes = timeableService.getTimeableAttrRowsForGroupName(visitor, "timeofvisit"); if (timeableAttributes != null && timeableAttributes.size() > 0) { List<VisitorbookTimedDO> sortedList = timeableService.sortTimeableAttrRowsByDateDescending(timeableAttributes); VisitorbookTimedDO newestEntry = sortedList.get(0); SimpleDateFormat sdfParser = new SimpleDateFormat("dd.MM.yyyy"); String date = sdfParser.format(newestEntry.getStartTime()); String time = newestEntry.getAttribute("arrive") != null ? newestEntry.getAttribute("arrive", String.class) : ""; value = date + " " + time; } item.add(new TextPanel(componentId, value)); cellItemListener.populateItem(item, componentId, rowModel); } });