Executes the action

@param  \CaptainHook\App\Config           $config
@param  \CaptainHook\App\Console\IO       $io
@param  \SebastianFeldmann\Git\Repository $repository
@param  \CaptainHook\App\Config\Action    $action
@return void
@throws \Exception
187060
public function execute(Config $config, IO $io, Repository $repository, Config\Action $action) : void
    {
        $options = $action->getOptions();
        $oldMsg  = $repository->getCommitMsg();

        if (!$repository->isMerging()) {
            $repository->setCommitMsg(new CommitMessage($options->get('message', ''), $oldMsg->getCommentCharacter()));
        }
    }
136760
protected function configureHook(Config\Hook $config, array $json) : void
    {
        $config->setEnabled($json['enabled']);
        foreach ($json['actions'] as $actionJson) {
            $options    = isset($actionJson['options']) && is_array($actionJson['options'])
                        ? $actionJson['options']
                        : [];
            $conditions = isset($actionJson['conditions']) && is_array($actionJson['conditions'])
                        ? $actionJson['conditions']
                        : [];
            $config->addAction(new Config\Action($actionJson['action'], $options, $conditions));
        }
    }
49804
protected function execute(InputInterface $input, OutputInterface $output) : void
    {
        $io     = $this->getIO($input, $output);
        $config = $this->getConfig($input->getOption('configuration'), true);

        $editor = new Editor($io, $config);
        $editor->setHook((string) $input->getArgument('hook'))
               ->setChange('AddAction');

        $editor->run();
    }
909181
private static void executeAction(InitialContext jndi,
	                                  GuiceApplicationValueContainer config,
	                                  Map<String, String> parameters,
	                                  LiquibaseAction action) throws NamingException, SQLException, LiquibaseException, IOException, ParserConfigurationException
	{
		// Make sure we don't execute any write actions if the database connection is set to read-only
		// N.B. liquibase may create a databasechangeloglock / databasechangelog table if one does not already exist
		if (action.isWriteAction() && StringUtils.equalsIgnoreCase("true", config.getValue(HIBERNATE_IS_READONLY)))
		{
			log.info("Changing liquibase action from " +
			         action +
			         " to ASSERT_UPDATED because hibernate is set to read only mode");
			action = LiquibaseAction.ASSERT_UPDATED;
		}

		// Fail if hbm2ddl is enabled (Hibernate should not be involved in schema management)
		if (StringUtils.isNotEmpty(config.getValue(HIBERNATE_SCHEMA_MANAGEMENT)) && action != LiquibaseAction.GENERATE_CHANGELOG)
		{
			throw new RuntimeException("Liquibase is enabled but so is " +
			                           HIBERNATE_SCHEMA_MANAGEMENT +
			                           ". Only one of these schema management methods may be used at a time.");
		}

		final String dataSourceName = config.getDataSource();
		final String changeLogFile = config.getValue(GuiceProperties.LIQUIBASE_CHANGELOG);
		final String contexts = config.getValue(GuiceProperties.LIQUIBASE_CONTEXTS);
		final String labels = config.getValue(GuiceProperties.LIQUIBASE_LABELS);
		final String defaultSchema = config.getDefaultSchema();

		final String jdbcUrl = config.getValue(AvailableSettings.URL);
		final String jdbcUsername = config.getValue(AvailableSettings.USER);
		final String jdbcPassword = config.getValue(AvailableSettings.PASS);

		if (StringUtils.isEmpty(dataSourceName) && StringUtils.isEmpty(jdbcUrl))
			throw new RuntimeException("Cannot run Liquibase: no JNDI datasource or JDBC URL set");
		else if (changeLogFile == null)
			throw new RuntimeException("Cannot run Liquibase: " + GuiceProperties.LIQUIBASE_CHANGELOG + " is not set");

		int storedTransactionIsolation = Integer.MIN_VALUE;
		Connection connection = null;
		Database database = null;
		try
		{
			// Set up the resource accessor
			final ResourceAccessor resourceAccessor;
			{
				final CompositeResourceAccessor composite;
				{
					ClassLoader contextClassLoader = Thread.currentThread().getContextClassLoader();
					ResourceAccessor threadClFO = new ClassLoaderResourceAccessor(contextClassLoader);

					ResourceAccessor clFO = new ClassLoaderResourceAccessor();

					composite = new CompositeResourceAccessor(clFO, threadClFO);
				}

				// If loading a resource with an absolute path fails, re-try it as a path relative to /
				// This is for unit tests where /liquibase/changelog.xml needs to be accessed as liquibase/changelog.xml
				final ResourceAccessor fallback = new RetryAbsoluteAsRelativeResourceAccessor(composite);

				// Wrap the resource accessor in a filter that interprets ./ as the changeLogFile folder
				resourceAccessor = new RelativePathFilteringResourceAccessor(fallback, changeLogFile);
			}

			// Set up the database
			{
				if (StringUtils.isNotEmpty(dataSourceName))
				{
					if (log.isDebugEnabled())
						log.debug("Look up datasource for liquibase: " + dataSourceName);

					final DataSource dataSource = (DataSource) jndi.lookup(dataSourceName);

					connection = dataSource.getConnection();
				}
				else
				{
					if (log.isDebugEnabled())
						log.debug("Create JDBC Connection directly: " + jdbcUrl);

					// N.B. do we need to call Class.forName on the JDBC Driver URL?
					// JDBC drivers should expose themselves using the service provider interface nowadays so this shouldn't be necessary

					connection = DriverManager.getConnection(jdbcUrl, jdbcUsername, jdbcPassword);
				}

				// Allow changing the transaction isolation away from the default for liquibase
				// This is a hack inserted for SQL Server where the SNAPSHOT isolation is being used
				// because in this mode it refuses to execute certain DDL statements because of metadata not being versioned
				{
					storedTransactionIsolation = connection.getTransactionIsolation();

					// Special-case SQL Server's SNAPSHOT isolation (magic value 4096)
					// In this case we change to READ UNCOMMITTED for the duration of the liquibase run
					if (storedTransactionIsolation == 4096)
					{
						connection.setTransactionIsolation(Connection.TRANSACTION_READ_COMMITTED);
					}
				}

				database = DatabaseFactory.getInstance().findCorrectDatabaseImplementation(new JdbcConnection(connection));

				database.setDefaultSchemaName(defaultSchema);
			}

			Liquibase liquibase = new Liquibase(changeLogFile, resourceAccessor, database);


			for (Map.Entry<String, String> param : parameters.entrySet())
			{
				liquibase.setChangeLogParameter(param.getKey(), param.getValue());
			}

			if (log.isDebugEnabled())
				log.debug("Execute liquibase action: " + action);

			switch (action)
			{
				case ASSERT_UPDATED:
					// Figure out which changesets need to be run
					List<ChangeSet> unrun = liquibase.listUnrunChangeSets(new Contexts(contexts), new LabelExpression(labels));

					if (log.isDebugEnabled())
						log.debug("Pending changesets: " + unrun);

					// If any need to be run, fail
					if (unrun.size() > 0)
						throw new LiquibaseChangesetsPending(unrun);
					else
						return;
				case UPDATE:
					// Perform a schema update
					liquibase.update(new Contexts(contexts), new LabelExpression(labels));
					return;
				case MARK_UPDATED:
					// Mark all pending changesets as run
					liquibase.changeLogSync(new Contexts(contexts), new LabelExpression(labels));
					return;
				case GENERATE_CHANGELOG:
					CatalogAndSchema catalogueAndSchema = CatalogAndSchema.DEFAULT;
					DiffToChangeLog writer = new DiffToChangeLog(new DiffOutputControl(false,
					                                                                   false,
					                                                                   false,
					                                                                   new CompareControl.SchemaComparison[0]));

					ByteArrayOutputStream bos = new ByteArrayOutputStream();
					PrintStream pw = new PrintStream(bos);
					liquibase.generateChangeLog(catalogueAndSchema, writer, pw);

					System.out.println("********** GENERATED CHANGELOG START **********");
					System.out.println(new String(bos.toByteArray()));
					System.out.println("********** GENERATED CHANGELOG END **********");
					break;
				default:
					throw new RuntimeException("Unknown liquibase action: " + action);
			}
		}
		finally
		{
			// Restore the transaction isolation value to the Connection (if the previous isolation was known and we changed it).
			// This is just in case the Connection we get is actually a wrapper around a longer-lived Connection whose isolation
			// isn't changed to the desired value when being returned from a connection pool
			// N.B. we don't return to isolations < 0 (isolation at db defaults)
			if (connection != null && connection.getTransactionIsolation() != storedTransactionIsolation && storedTransactionIsolation >= 0)
			{
				connection.setTransactionIsolation(storedTransactionIsolation);
			}

			if (database != null)
				database.close();
			else if (connection != null)
				connection.close();
		}
	}
1002410
public function _execute( $action, $params = array() ) 
	{
		if ( method_exists( $this, 'action_'.$action ) ) 
		{
			call_user_func( array( $this, 'action_'.$action ), $params );
		} 
		else 
		{
			CCCli::line( "There is no action {$action}.", 'red' );
		}
	}
1018866
private static function install(Application $app, string $config, string $repo) : void
    {
        $options = [
            'command'         => 'install',
            '--configuration' => $config,
            '--git-directory' => $repo,
            '-f'              => '-f'
        ];
        $app->run(new ArrayInput($options));
    }
1369499
@Process(actionType = ReadConfig.class)
    public void readConfig(final ReadConfig action, final Dispatcher.Channel channel) {
        readConfig(action.getAddressTemplate(), channel);
    }
1027012
public function applyTo(Config $config)
    {
        $hookConfig   = $config->getHookConfig($this->hookToChange);
        $setup        = new Advanced($this->io);
        $actionConfig = $setup->getActionConfig();

        $hookConfig->addAction($actionConfig);
    }
268331
private function commitMsgProcess(Config $configData)
    {
        /** @var CommitMsg $commitMsgData */
        $commitMsgData = $configData->getCommitMsg();

        return $this->commitMsgProcessor->process($commitMsgData, $this->io);
    }
371047
public function set($configOption, $configValue) {
        $this->repository->cmd(sprintf('config --local %s %s', $configOption, $configValue));
        unset($this->configuration[$configOption]);
    }
993445
public function authorize($action, $config = array())
    {
        if (is_string($config)) {
            $config = array($action => $config);
        }

        $config = AnConfig::unbox($config);

        $context = $this->_mixer->getRepository()->getCommandContext();

        $context->append($config)->append(array(
            'viewer' => get_viewer(),
            'mixer' => $this->_mixer,
        ));

        $authorizers = $this->_authorizers;
        $result = LibBaseDomainAuthorizerAbstract::AUTH_NOT_IMPLEMENTED;

        foreach ($authorizers as $authorizer) {
            $result = $authorizer->execute($action, $context);
            if ($result !== LibBaseDomainAuthorizerAbstract::AUTH_NOT_IMPLEMENTED) {
                break;
            }
        }

        $context->authorization = $result;

        $method = 'authorize'.ucfirst($action);

        if (method_exists($this->_mixer, $method)) {
            $ret = $this->_mixer->$method($context);

            if (!is_null($ret)) {
                $context->authorization = $ret;
            }
        }

        return $context->authorization;
    }
1123761
public function setAction($action)
    {
        //test validity of the action
        if ($action !== self::ACTION_CREATE && $action !== self::ACTION_OVERWRITE && $action !== self::ACTION_DELETE) {
            throw new \Exception('The action of the widget map is not valid. Action: ['.$action.']');
        }

        $this->action = $action;
    }
944103
protected function loadConfigurationFiles(Application $app, Config $repository)
    {
        Factory::fromFiles($repository, $this->getConfigurationFiles($app));
    }
122097
public function customAction($entity, $action, $id = null, Request $request)
    {
        $entityConfig = $this->get('lin3s_admin.configuration.factory.entity')->createFor($entity);
        $entityObject = null;
        $repository = $this->get($entityConfig->repositoryServiceId());
        $entityConfig->loadRepository($repository);

        if ($id) {
            $entityObject = $repository->find($entityConfig, $id);
        }
        if ($id && !$entityObject) {
            throw $this->createNotFoundException(
                sprintf(
                    '%s not found for id "%s"',
                    $entityConfig->name(),
                    $id
                )
            );
        }
        try {
            $callableAction = $entityConfig->getAction($action);
        } catch (\Exception $e) {
            throw $this->createNotFoundException(
                sprintf(
                    'Action "%s" for entity "%s" not found, did you registered it in the config?',
                    $action,
                    $entity
                )
            );
        }

        return $callableAction->execute($entityObject, $entityConfig, $request);
    }
1227053
public function execute(Config $config, IO $io, Repository $repository, Config\Action $action) : void
    {
        $changedPHPFiles = $repository->getIndexOperator()->getStagedFilesOfType('php');

        $io->write('linting files:', true, IO::VERBOSE);
        foreach ($changedPHPFiles as $file) {
            $io->write('  - ' . $file, true, IO::VERBOSE);
            if ($this->hasSyntaxErrors($file)) {
                throw new ActionFailed('syntax errors in file: ' . $file);
            }
        }
        $io->write('<info>No syntax errors detected</info>');
    }
242883
public function initCron($src, $controller, $action) {
        if (!Config::config()['user']['debug']['maintenance']) {
            $this->_routeCron($src, $controller, $action);

            if ($this->_route == true) {
                $this->_setFunction($this->request->src);
                $this->_setEvent($this->request->src);
            }
        }
    }
1279410
@Override
    public void doAction(Action action) {
        switch (action) {
            case REMOVE:
                close();
                break;
            
            case HIDE:
                setVisible(false);
                break;
            
            case SHOW:
                setVisible(true);
                break;
            
            case COLLAPSE:
                setSize(Size.MINIMIZED);
                break;
            
            case EXPAND:
                setSize(Size.NORMAL);
                break;
            
            case TOP:
                moveToTop();
                break;
        }
    }