Changes the priority of the state.

@param mixed $stateId
@param int $priority
772527
public function setPriority($stateId, $priority)
    {
        $objectState = $this->load($stateId);
        $groupObjectStates = $this->loadObjectStates($objectState->groupId);

        $priorityList = array();
        foreach ($groupObjectStates as $index => $groupObjectState) {
            // Update given state and push all other states with same or higher priority down
            if ($objectState->id === $groupObjectState->id) {
                $priorityList[$groupObjectState->id] = (int)$priority;
            } else {
                $priorityList[$groupObjectState->id] = ($index < $priority ? $index : $index + 1);
            }
        }

        asort($priorityList, SORT_NUMERIC);

        foreach (array_keys($priorityList) as $objectStatePriority => $objectStateId) {
            $this->objectStateGateway->updateObjectStatePriority($objectStateId, $objectStatePriority);
        }
    }
1129448
@Override
	public final void setPriority(int priority) throws JMSException
    {
        if (priority < 0 || priority > 9)
            throw new FFMQException("Invalid priority value : "+priority,"INVALID_PRIORITY");
        
        this.defaultPriority = priority;
    }
318871
public function updateFilePriority( $downloadTaskId, $FileId, $Priority){
        $Service = sprintf( self::API_DOWNLOAD_FILES, $downloadTaskId);
        $rest = $this->getService( $Service . DIRECTORY_SEPARATOR . $FileId);
        $rest->PUT([
            'priority'  => $Priority,
        ]);

        return $rest->getSuccess();
    }
537150
public function setDescendantStates(array $states)
    {
        foreach ($this->getDescendants('SwatState') as $id => $object) {
            if (isset($states[$id])) {
                $object->setState($states[$id]);
            }
        }
    }
1166072
public function do_push($topic, $body, $priority = Queue::PRIORITY_NORMAL)
    {
        /** @var \ManaPHP\DbInterface $db */
        $db = $this->_di->getShared($this->_db);

        $db->insert($this->_source, ['topic' => $topic, 'body' => $body, 'priority' => $priority, 'created_time' => time(), 'deleted_time' => 0]);
    }
1225577
public void setMinPriority(String minPriority) {
        this.minPriority = minPriority;

        Integer value = priorityNameToValueMap.get(minPriority);
        if (value == null) {
            value = priorityNameToValueMap.get(DEFAULT_PRIORITY);
            if (value == null) {
                throw new IllegalStateException();
            }
        }

        this.minPriorityAsInt = value.intValue();

    }
914093
public function setState($state)
    {
        if (!isset($this->_states[$state])) {
            include_once 'Zend/Search/Exception.php';
            throw new Zend_Search_Exception('State \'' . $state . '\' is not on of the possible FSM states.');
        }

        $this->_currentState = $state;
    }
1343020
public function setStateDestination(\Core\Entity\State $state_destination = null) {
        $this->state_destination = $state_destination;

        return $this;
    }
1073788
public function setPriority($priority)
    {
        Argument::i()->test(1, 'string', 'number');

        switch ($priority) {
            case 'high':
                $this->priority = 9;
                break;

            case 'medium':
                $this->priority = 4;
                break;

            case 'low':
                $this->priority = 0;
                break;

            default:
                $this->priority = $priority;
                break;
        }

        return $this;
    }
120906
protected function changeWorkerState(string $workerId, int $workerState) : bool
    {
        $this->workerStates[$workerId] = $workerState;
        if ($workerState === Worker::WORKER_STATE_IDLE) {
            $this->pushJobs();
        }
        return true;
    }
663261
public void increasePriority(int overrideId, int ordinal, int pathId, String clientUUID) {
        logger.info("Increase priority");

        int origPriority = -1;
        int newPriority = -1;
        int origId = 0;
        int newId = 0;

        PreparedStatement statement = null;
        ResultSet results = null;
        try (Connection sqlConnection = sqlService.getConnection()) {
            results = null;
            statement = sqlConnection.prepareStatement(
                "SELECT * FROM " + Constants.DB_TABLE_ENABLED_OVERRIDE +
                    " WHERE " + Constants.ENABLED_OVERRIDES_PATH_ID + " = ?" +
                    " AND " + Constants.GENERIC_CLIENT_UUID + " = ?" +
                    " ORDER BY " + Constants.ENABLED_OVERRIDES_PRIORITY
            );
            statement.setInt(1, pathId);
            statement.setString(2, clientUUID);
            results = statement.executeQuery();

            int ordinalCount = 0;
            while (results.next()) {
                if (results.getInt(Constants.ENABLED_OVERRIDES_OVERRIDE_ID) == overrideId) {
                    ordinalCount++;
                    if (ordinalCount == ordinal) {
                        origPriority = results.getInt(Constants.ENABLED_OVERRIDES_PRIORITY);
                        origId = results.getInt(Constants.GENERIC_ID);
                        break;
                    }
                }
                newPriority = results.getInt(Constants.ENABLED_OVERRIDES_PRIORITY);
                newId = results.getInt(Constants.GENERIC_ID);
            }
        } catch (Exception e) {
            e.printStackTrace();
        } finally {
            try {
                if (results != null) {
                    results.close();
                }
            } catch (Exception e) {
            }
            try {
                if (statement != null) {
                    statement.close();
                }
            } catch (Exception e) {
            }
        }

        try (Connection sqlConnection = sqlService.getConnection()) {
            // update priorities
            if (origPriority != -1 && newPriority != -1) {
                statement = sqlConnection.prepareStatement(
                    "UPDATE " + Constants.DB_TABLE_ENABLED_OVERRIDE +
                        " SET " + Constants.ENABLED_OVERRIDES_PRIORITY + "=?" +
                        " WHERE " + Constants.GENERIC_ID + "=?"
                );
                statement.setInt(1, origPriority);
                statement.setInt(2, newId);
                statement.executeUpdate();
                statement.close();

                statement = sqlConnection.prepareStatement(
                    "UPDATE " + Constants.DB_TABLE_ENABLED_OVERRIDE +
                        " SET " + Constants.ENABLED_OVERRIDES_PRIORITY + "=?" +
                        " WHERE " + Constants.GENERIC_ID + "=?"
                );
                statement.setInt(1, newPriority);
                statement.setInt(2, origId);
                statement.executeUpdate();
            }
        } catch (Exception e) {
        } finally {
            try {
                if (statement != null) {
                    statement.close();
                }
            } catch (Exception e) {
            }
        }
    }
1084488
public function jumpToState($state)
    {
        if (!$state instanceof StateInterface) {
            $state = $this->getState($state);
        }

        if (!$this->canJumpToState($state)) {
            throw new StateException(sprintf('Can not jump from state "%s" to "%s".',$this->currentState->getName(), $state->getName()));
        }

        $this->object->setFiniteState($state->getName());
        $this->currentState = $state;
    }
268785
public function deleteObjectState($stateId)
    {
        try {
            return $this->innerGateway->deleteObjectState($stateId);
        } catch (DBALException $e) {
            throw new RuntimeException('Database error', 0, $e);
        } catch (PDOException $e) {
            throw new RuntimeException('Database error', 0, $e);
        }
    }
521776
private function handleOnStateWasSet(State $state, Payload $payload)
    {
        while ($state->hasEvent(self::ON_STATE_WAS_SET)) {
            $newState = $state->triggerEvent(self::ON_STATE_WAS_SET, $payload);
            if ($newState === null) {
                break;
            }

            $state = $this->process->state($newState);
            $this->updatePayload($state, $payload);
        }
    }
343063
void changeState(State state) {

        m_state = state;
        switch (state) {
            case validationRunning:
                m_cancelButton.setEnabled(false);
                m_okButton.setEnabled(false);
                clearValidationError();
                break;
            case validationFailed:
                m_okButton.setEnabled(false);
                m_cancelButton.setEnabled(true);
                break;
            case validationUnknown:
            default:
                m_cancelButton.setEnabled(true);
                m_okButton.setEnabled(true);
                clearValidationError();
                break;

        }
    }
132382
public function setEntryState($entryId, $state)
    {
        /** @var SimpleWorkflowEntry $theEntry */
        $theEntry = $this->findEntry($entryId);
        $theEntry->setState($state);
    }
1148208
public function insert($datum, $priority)
    {
        if (!is_array($priority)) {
            $priority = [$priority, $this->serial--];
        } else {
            $priority[] = $this->serial--;
        }

        parent::insert($datum, $priority);
    }