/*
(non-Javadoc)

@see
com.microsoft.windowsazure.services.media.entityoperations.EntityContract
#action(com.microsoft.windowsazure.services.media.entityoperations.
EntityActionOperation)
761578
@Override
    public String action(EntityActionOperation entityActionOperation)
            throws ServiceException {
        try {
            return service.action(entityActionOperation);
        } catch (UniformInterfaceException e) {
            throw processCatch(new ServiceException(e));
        } catch (ClientHandlerException e) {
            throw processCatch(new ServiceException(e));
        }
    }
951185
public void setAction(String action) throws ApplicationException {
	action = action.toLowerCase().trim();
	if (action.equals("get")) this.action = GET;
	else if (action.equals("put")) this.action = PUT;

	else if (action.equals("cache")) this.action = CACHE;
	else if (action.equals("clientcache")) this.action = CACHE_CLIENT;
	else if (action.equals("servercache")) this.action = CACHE_SERVER;
	else if (action.equals("flush")) this.action = FLUSH;
	else if (action.equals("optimal")) this.action = CACHE;

	else if (action.equals("client-cache")) this.action = CACHE_CLIENT;
	else if (action.equals("client_cache")) this.action = CACHE_CLIENT;

	else if (action.equals("server-cache")) this.action = CACHE_SERVER;
	else if (action.equals("server_cache")) this.action = CACHE_SERVER;

	else if (action.equals("content")) this.action = CONTENT;
	else if (action.equals("content_cache")) this.action = CONTENT;
	else if (action.equals("contentcache")) this.action = CONTENT;
	else if (action.equals("content-cache")) this.action = CONTENT;
	else throw new ApplicationException("invalid value for attribute action for tag cache [" + action + "], "
		+ "valid actions are [get,put,cache, clientcache, servercache, flush, optimal, contentcache]");

	// get: get an object from the cache.
	// put: Add an object to the cache.

    }
60869
@Override
    public void execute(DelegateExecution execution) {
        ActionDefinition actionDefinition = findRelatedActionDefinition(execution);

        Connector connector = getConnector(getImplementation(execution));
        IntegrationContext integrationContext = connector.apply(integrationContextBuilder.from(execution,
                                                                                    actionDefinition));

        execution.setVariables(outboundVariablesProvider.calculateVariables(integrationContext,
                                                                            actionDefinition));

        leave(execution);
    }
285386
public void setAction(String action)
    {
        ExtendedInfo info = getInfo(action);
        if (info != null)
            info._action = action;
    }
140927
public <T> T manageTransaction( DatabaseContext ctx, TransactionManagedAction<T> action )
	{
		ctx.db.startTransaction();
		try
		{
			T result = action.execute( ctx );

			ctx.db.commit();

			return result;
		}
		catch( Exception exception )
		{
			ctx.db.rollback();

			throw new ManagedTransactionException( "Exception during managed transaction, see cause for details", exception );
		}
	}
88084
public <T> T doInTransaction(final SpecificTxAction<T, C> action) {
        return doInTransaction(null, action);
    }
866913
public void setActions(java.util.Collection<ActionDeclaration> actions) {
        if (actions == null) {
            this.actions = null;
            return;
        }

        this.actions = new java.util.ArrayList<ActionDeclaration>(actions);
    }
630102
public void act(ActionExec action, List<ActionExec> feedback) {
        if (!isRunning())
            return;
        if (this.getSimulation() == null)
            return;

        boolean result = false;

        Structure actionStructure = action.getActionTerm();
        String actionID = actionStructure.getFunctor();

        try {
            if (this.actions.containsKey(actionID)) {

                Constructor<? extends JasonShanksAgentAction> c = this.actions
                        .get(actionID).getConstructor(
                                new Class[] { String.class, Steppable.class });

                JasonShanksAgentAction shanksAction = c.newInstance(
                        this.getID(), this, this.getLogger());

                result = shanksAction.executeAction(this.getSimulation(), this,
                        actionStructure.getTerms());
            } else {
                throw new UnknownShanksAgentActionException(actionID,
                        this.getID());
            }

        } catch (UnknownShanksAgentActionException e) {
            logger.severe("Action was not executed -> " + e.getMessage());
            e.printStackTrace();
        } catch (InstantiationException e) {
            logger.severe("InstantiationException" + e.getMessage());
            e.printStackTrace();
        } catch (IllegalAccessException e) {
            logger.severe("IllegalAccessException" + e.getMessage());
            e.printStackTrace();
        } catch (SecurityException e) {
            logger.severe("SecurityException" + e.getMessage());
            e.printStackTrace();
        } catch (NoSuchMethodException e) {
            logger.severe("NoSuchMethodException" + e.getMessage());
            e.printStackTrace();
        } catch (IllegalArgumentException e) {
            logger.severe("IllegalArgumentException" + e.getMessage());
            e.printStackTrace();
        } catch (InvocationTargetException e) {
            logger.severe("InvocationTargetException" + e.getMessage());
            e.printStackTrace();
        }

        action.setResult(result);
        this.getTS().getC().addFeedbackAction(action);
    }
1127276
void executeAction( Action action ) throws PluginException {

		try {
			switch( action.actionType ) {
			case DELETE:
				this.logger.fine( "Deleting " + action.parameter + "..." );
				File f = new File( action.parameter );
				Utils.deleteFilesRecursively( f );
				break;

			case DOWNLOAD:
				this.logger.fine( "Downloading " + action.parameter + "..." );
				URI uri = UriUtils.urlToUri( action.parameter );
				File targetFile = new File( System.getProperty( "java.io.tmpdir" ), TMP_FILE );
				InputStream in = null;
				try {
					in = uri.toURL().openStream();
					Utils.copyStream( in, targetFile );

				} finally {
					Utils.closeQuietly( in );
				}

				break;

			case MOVE:
				List<String> parts = Utils.splitNicely( action.parameter, "->" );
				if( parts.size() != 2 ) {
					this.logger.warning( "Invalid syntax for 'move' action. " + action.parameter );
				} else {
					File source = new File( parts.get( 0 ));
					File target = new File( parts.get( 1 ));
					this.logger.fine( "Moving " + source + " to " + target + "..." );
					if( ! source.renameTo( target ))
						throw new IOException( source + " could not be moved to " + target );
				}

				break;

			case COPY:
				parts = Utils.splitNicely( action.parameter, "->" );
				if( parts.size() != 2 ) {
					this.logger.warning( "Invalid syntax for 'copy' action. " + action.parameter );
				} else {
					File source = new File( parts.get( 0 ));
					File target = new File( parts.get( 1 ));
					this.logger.fine( "Copying " + source + " to " + target + "..." );
					Utils.copyStream( source, target );
				}

				break;

			default:
				this.logger.fine( "Ignoring the action..." );
				break;
			}

		} catch( Exception e ) {
			throw new PluginException( e );
		}
	}
875835
public void addAction(M element, byte value)
    {
        actions.put(element, Byte.valueOf(value));
    }
342090
public ActionListDialogBuilder addAction(final String label, final Runnable action) {
        return addAction(new Runnable() {
            @Override
            public String toString() {
                return label;
            }

            @Override
            public void run() {
                action.run();
            }
        });
    }
574581
@Override
    public void actionPerformed(ActionEvent e) {
        int row = table.convertRowIndexToModel(table.getEditingRow());
        fireEditingStopped();

        //  Invoke the Action
        ActionEvent event = new ActionEvent(
                table,
                ActionEvent.ACTION_PERFORMED,
                Integer.toString(row));
        action.actionPerformed(event);
    }
1229648
public void setActions(java.util.Collection<DatasetActionSummary> actions) {
        if (actions == null) {
            this.actions = null;
            return;
        }

        this.actions = new java.util.ArrayList<DatasetActionSummary>(actions);
    }
335245
public void setActions(java.util.Collection<DatasetAction> actions) {
        if (actions == null) {
            this.actions = null;
            return;
        }

        this.actions = new java.util.ArrayList<DatasetAction>(actions);
    }
798838
public void addActionsToActionStateExecutionListAt(final Flow flow, final String actionStateId, final int position, final EvaluateAction... actions) {
        val actionState = getState(flow, actionStateId, ActionState.class);
        val currentActions = new ArrayList<Action>();
        val actionList = actionState.getActionList();
        actionList.forEach(currentActions::add);
        val index = position < 0 || position == Integer.MAX_VALUE ? currentActions.size() : position;
        currentActions.forEach(actionList::remove);
        Arrays.stream(actions).forEach(a -> currentActions.add(index, a));
        actionList.addAll(currentActions.toArray(Action[]::new));
    }
352693
def act(self, action):
    """"""
    if action and action.ListFields():  # Skip no-ops.
      return self.actions(sc_pb.RequestAction(actions=[action]))
1230059
public EntityBuilder addActions(List<Action> actions) {
    	if(actions == null) {
    		throw new IllegalArgumentException("actions cannot be null.");
    	}
        for (Action action : actions) {
            addAction(action);
        }
        return this;
    }