Map<Long, T> idToItem = Maps.newHashMap();
for (T item : items) {
idToItem.put(item.getId(), item);
}
T item = items.get(0);
AccElementType type = item.getElementType();
Long parentProjectId = item.getParentProjectId();
Query query = pm.newQuery(AccLabel.class);
query.declareParameters("AccElementType elementTypeParam, Long projectIdParam");
query.setFilter("elementType == elementTypeParam && projectId == projectIdParam");
List<AccLabel> labels = (List<AccLabel>) query.execute(type, parentProjectId);