Ejemplo n.º 1
0
 private static Map<ActionType, List<ObjectAction>> createObjectActionsByType() {
   final Map<ActionType, List<ObjectAction>> map = Maps.newHashMap();
   for (final ActionType type : ActionType.values()) {
     map.put(type, Lists.<ObjectAction>newArrayList());
   }
   return map;
 }
Ejemplo n.º 2
0
  protected void sortCacheAndUpdateActions(final List<ObjectAction> objectActions) {
    final List<ObjectAction> orderedActions = sortActions(objectActions);
    synchronized (this.objectActions) {
      this.objectActions.clear();
      this.objectActions.addAll(orderedActions);

      for (final ActionType type : ActionType.values()) {
        final List<ObjectAction> objectActionForType = objectActionsByType.get(type);
        objectActionForType.clear();
        objectActionForType.addAll(
            Collections2.filter(objectActions, ObjectAction.Predicates.ofType(type)));
      }
    }
  }