private ObjectAction getAction(
     final List<ObjectAction> availableActions, final ActionType type, final String id) {
   if (id == null) {
     return null;
   }
   outer:
   for (int i = 0; i < availableActions.size(); i++) {
     final ObjectAction action = availableActions.get(i);
     if (action.getActions().size() > 0) {
       // deal with action set
       final ObjectAction a = getAction(action.getActions(), type, id);
       if (a != null) {
         return a;
       }
     } else {
       // regular action
       if (!type.matchesTypeOf(action)) {
         continue outer;
       }
       if (id.equals(action.getIdentifier().toNameParmsIdentityString())) {
         return action;
       }
       if (id.equals(action.getIdentifier().toNameIdentityString())) {
         return action;
       }
       continue outer;
     }
   }
   return null;
 }
 private ObjectAction findAction(final ObjectSpecification specification, final String actionId) {
   final List<ObjectAction> objectActions = specification.getObjectActions(Contributed.INCLUDED);
   for (final ObjectAction objectAction : objectActions) {
     if (objectAction.getIdentifier().toClassAndNameIdentityString().equals(actionId)) {
       return objectAction;
     }
   }
   return null;
 }
  @SuppressWarnings({"rawtypes"})
  private void postEvent(
      final ObjectAction owningAction,
      final ObjectAdapter targetAdapter,
      final ObjectAdapter[] argumentAdapters) {

    try {
      final Class type = eventType;
      Identifier actionIdentifier = owningAction.getIdentifier();
      final Object source = AdapterUtils.unwrap(targetAdapter);
      final Object[] arguments = AdapterUtils.unwrap(argumentAdapters);
      @SuppressWarnings("unchecked")
      final ActionInvokedEvent<?> event =
          org.apache.isis.core.metamodel.facets.actions.event.PostsActionInvokedEventFacet.Util
              .newEvent(type, source, actionIdentifier, arguments);
      getEventBusService().post(event);
    } catch (Exception e) {
      throw new FatalException(e);
    }
  }