Loads an object state.

@param $objectStateGroupId
@param $objectStateId

@return \eZ\Publish\Core\REST\Common\Values\RestObjectState
970132
public function loadObjectState($objectStateGroupId, $objectStateId)
    {
        return new RestObjectState(
            $this->objectStateService->loadObjectState($objectStateId, Language::ALL),
            $objectStateGroupId
        );
    }
717002
public function deleteObjectStateGroup($objectStateGroupId)
    {
        $this->objectStateService->deleteObjectStateGroup(
            $this->objectStateService->loadObjectStateGroup($objectStateGroupId)
        );

        return new Values\NoContent();
    }
1174540
public function readRecursively($objectID, $status = null) {
        $children = $this->read($objectID, $status);

        $tree = [];

        foreach ($children as $child) {
            if (!array_key_exists('id', $child)) {
                throw new RuntimeException('Broken result');
            }

            $node = $child;

            $childChildren = $this->read((int) $child['id'], $status);

            if (count($childChildren) > 0) {
                $node['children'] = $childChildren;
            }

            $tree[] = $node;
        }

        return $tree;
    }
640647
public function loadRoleAssignmentsByGroupId($groupId, $inherited = false)
    {
        try {
            return $this->innerGateway->loadRoleAssignmentsByGroupId($groupId, $inherited);
        } catch (DBALException $e) {
            throw new RuntimeException('Database error', 0, $e);
        } catch (PDOException $e) {
            throw new RuntimeException('Database error', 0, $e);
        }
    }
1074011
public function loadObjectStateDataByIdentifier($identifier, $groupId)
    {
        $query = $this->createObjectStateFindQuery();
        $query->where(
            $query->expr->lAnd(
                $query->expr->eq(
                    $this->dbHandler->quoteColumn('identifier', 'ezcobj_state'),
                    $query->bindValue($identifier, null, \PDO::PARAM_STR)
                ),
                $query->expr->eq(
                    $this->dbHandler->quoteColumn('group_id', 'ezcobj_state'),
                    $query->bindValue($groupId, null, \PDO::PARAM_INT)
                )
            )
        );

        $statement = $query->prepare();
        $statement->execute();

        return $statement->fetchAll(\PDO::FETCH_ASSOC);
    }
332111
public function loadContentLink($repositoryId, $documentId)
    {
        $result = $this->getRepositoryUrlCache()->getObjectUrl($repositoryId, $documentId, Constants::SELECTOR_CONTENT);
        return $result === null ? null : (string) $result;
    }
929161
private function getTypeDefinition($objectTypeId)
    {
        if (empty($objectTypeId) || !is_string($objectTypeId)) {
            throw new CmisInvalidArgumentException(
                'Type property must be set and must be of type string but is empty or not a string.'
            );
        }

        return $this->session->getTypeDefinition($objectTypeId);
    }
1197473
public function loadObjectStateData($stateId)
    {
        $query = $this->createObjectStateFindQuery();
        $query->where(
            $query->expr->eq(
                $this->dbHandler->quoteColumn('id', 'ezcobj_state'),
                $query->bindValue($stateId, null, \PDO::PARAM_INT)
            )
        );

        $statement = $query->prepare();
        $statement->execute();

        return $statement->fetchAll(\PDO::FETCH_ASSOC);
    }
548860
public function loadGroup($groupId)
    {
        $groups = $this->mapper->extractGroupsFromRows(
            $this->contentTypeGateway->loadGroupData([$groupId])
        );

        if (count($groups) !== 1) {
            throw new Exception\TypeGroupNotFound($groupId);
        }

        return $groups[0];
    }
1324523
public function insertObjectStateGroup(Group $objectStateGroup)
    {
        try {
            return $this->innerGateway->insertObjectStateGroup($objectStateGroup);
        } catch (DBALException $e) {
            throw new RuntimeException('Database error', 0, $e);
        } catch (PDOException $e) {
            throw new RuntimeException('Database error', 0, $e);
        }
    }
37979
public function load($stateId)
    {
        $data = $this->objectStateGateway->loadObjectStateData($stateId);

        if (empty($data)) {
            throw new NotFoundException('ObjectState', $stateId);
        }

        return $this->objectStateMapper->createObjectStateFromData($data);
    }
252661
public function fetchGroup($groupId)
    {
        $result = $this->_get($this->_groupUrl($groupId));
        return Deserialize::groupResponse($result);
    }
659198
public function updateObjectStateGroup($objectStateGroupId, Request $request)
    {
        $updateStruct = $this->inputDispatcher->parse(
            new Message(
                array('Content-Type' => $request->headers->get('Content-Type')),
                $request->getContent()
            )
        );

        $objectStateGroup = $this->objectStateService->loadObjectStateGroup($objectStateGroupId);

        try {
            $updatedStateGroup = $this->objectStateService->updateObjectStateGroup($objectStateGroup, $updateStruct);

            return $updatedStateGroup;
        } catch (InvalidArgumentException $e) {
            throw new ForbiddenException($e->getMessage());
        }
    }
272133
public function loadObjectStateListData($groupId)
    {
        try {
            return $this->innerGateway->loadObjectStateListData($groupId);
        } catch (DBALException $e) {
            throw new RuntimeException('Database error', 0, $e);
        } catch (PDOException $e) {
            throw new RuntimeException('Database error', 0, $e);
        }
    }
959583
static public function updateObjectState( $objectID, $selectedStateIDList )
    {
        $object = eZContentObject::fetch( $objectID );

        // we don't need to re-assign states the object currently already has assigned
        $currentStateIDArray = $object->attribute( 'state_id_array' );
        $selectedStateIDList = array_diff( $selectedStateIDList, $currentStateIDArray );

        // filter out any states the current user is not allowed to assign
        $canAssignStateIDList = $object->attribute( 'allowed_assign_state_id_list' );
        $selectedStateIDList = array_intersect( $selectedStateIDList, $canAssignStateIDList );

        foreach ( $selectedStateIDList as $selectedStateID )
        {
            $state = eZContentObjectState::fetchById( $selectedStateID );
            $object->assignState( $state );
        }
        eZAudit::writeAudit( 'state-assign', array( 'Content object ID' => $object->attribute( 'id' ),
                                                    'Content object name' => $object->attribute( 'name' ),
                                                    'Selected State ID Array' => implode( ', ' , $selectedStateIDList ),
                                                    'Comment' => 'Updated states of the current object: eZContentOperationCollection::updateObjectState()' ) );
        //call appropriate method from search engine
        eZSearch::updateObjectState($objectID, $selectedStateIDList);

        // Triggering content/state/assign event for persistence cache purge
        ezpEvent::getInstance()->notify( 'content/state/assign', array( $objectID, $selectedStateIDList ) );

        eZContentCacheManager::clearContentCacheIfNeeded( $objectID );

        return array( 'status' => true );
    }
51176
public function loadTypesDataForGroup($groupId, $status)
    {
        $q = $this->getLoadTypeQueryBuilder();
        $q
            ->where($q->expr()->eq('g.group_id', ':gid'))
            ->andWhere($q->expr()->eq('c.version', ':version'))
            ->addOrderBy('c.identifier')
            ->setParameter('gid', $groupId, ParameterType::INTEGER)
            ->setParameter('version', $status, ParameterType::INTEGER);

        return $q->execute()->fetchAll();
    }
104140
private function getObjectStates(Options $options): array
    {
        $allObjectStates = [];

        $groups = $this->objectStateService->loadObjectStateGroups();
        $configuredGroups = $options['states'];

        foreach ($groups as $group) {
            $configuredGroups += [$group->identifier => true];
            if ($configuredGroups[$group->identifier] === false) {
                continue;
            }

            $objectStates = $this->objectStateService->loadObjectStates($group);

            foreach ($objectStates as $objectState) {
                if (
                    is_array($configuredGroups[$group->identifier]) &&
                    !in_array($objectState->identifier, $configuredGroups[$group->identifier], true)
                ) {
                    continue;
                }

                $groupName = $group->getName() ?? $group->identifier;
                $stateName = $objectState->getName() ?? $objectState->identifier;

                $allObjectStates[$groupName][$stateName] = $group->identifier . '|' . $objectState->identifier;
            }
        }

        return $allObjectStates;
    }