public function buildDomainPolicyObject(SPIPolicy $spiPolicy)
    {
        $policyLimitations = array();
        if ($spiPolicy->module !== '*' && $spiPolicy->function !== '*' && $spiPolicy->limitations !== '*') {
            foreach ($spiPolicy->limitations as $identifier => $values) {
                $policyLimitations[] = $this->limitationService->getLimitationType($identifier)->buildValue($values);
            }
        }

        $policy = new Policy(
            array(
                'id' => $spiPolicy->id,
                'roleId' => $spiPolicy->roleId,
                'module' => $spiPolicy->module,
                'function' => $spiPolicy->function,
                'limitations' => $policyLimitations,
            )
        );

        // Original ID is set on SPI policy, which means that it's a draft.
        if ($spiPolicy->originalId) {
            $policy = new PolicyDraft(['innerPolicy' => $policy, 'originalId' => $spiPolicy->originalId]);
        }

        return $policy;
    }