Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
30 changes: 12 additions & 18 deletions lib/Service/People/CaseRoleProjection.php
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@

namespace OCA\Dossiq\Service\People;

use OCA\Dossiq\Service\Custody\DossierRegister;
use OCA\Dossiq\Service\SettingsService;
use OCA\Dossiq\Service\Support\SearchesObjects;
use Psr\Log\LoggerInterface;
Expand All @@ -38,16 +39,24 @@ class CaseRoleProjection {
*/
public const INITIATOR = 'initiator';

/**
* The register and the configured schemas, read and refused the one shared way.
*
* @var DossierRegister
*/
private readonly DossierRegister $dossierRegister;

/**
* @param SettingsService $settingsService OpenRegister access and the configured register and schemas.
* @param PersonLinkReader $people Reads a link's name and address.
* @param LoggerInterface $logger Says what a link could not become.
*/
public function __construct(
private readonly SettingsService $settingsService,
SettingsService $settingsService,
private readonly PersonLinkReader $people,
private readonly LoggerInterface $logger,
) {
$this->dossierRegister = new DossierRegister(settingsService: $settingsService);
}//end __construct()

/**
Expand Down Expand Up @@ -318,17 +327,7 @@ private function uuidOf(mixed $saved): string {
* @throws RuntimeException When OpenRegister or the register is not configured.
*/
private function requireRegister(): array {
$objectService = $this->settingsService->getObjectService();
if ($objectService === null) {
throw new RuntimeException('OpenRegister is not available');
}

$register = $this->settingsService->getConfigValue('register');
if ($register === '') {
throw new RuntimeException('Dossier register not configured');
}

return [$objectService, $register];
return $this->dossierRegister->context();
}//end requireRegister()

/**
Expand All @@ -341,11 +340,6 @@ private function requireRegister(): array {
* @throws RuntimeException When the key is not configured.
*/
private function schema(string $key): string {
$schema = $this->settingsService->getConfigValue($key);
if ($schema === '') {
throw new RuntimeException('Dossiq schema ' . $key . ' not configured');
}

return $schema;
return $this->dossierRegister->schema(key: $key);
}//end schema()
}//end class
30 changes: 12 additions & 18 deletions lib/Service/People/CaseSeats.php
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,7 @@

namespace OCA\Dossiq\Service\People;

use OCA\Dossiq\Service\Custody\DossierRegister;
use OCA\Dossiq\Service\SettingsService;
use OCA\Dossiq\Service\Support\SearchesObjects;
use Psr\Log\LoggerInterface;
Expand Down Expand Up @@ -93,6 +94,13 @@ class CaseSeats {
*/
public const PAGE_SIZE = 200;

/**
* The register and the configured schemas, read and refused the one shared way.
*
* @var DossierRegister
*/
private readonly DossierRegister $dossierRegister;

/**
* Constructor.
*
Expand All @@ -102,9 +110,10 @@ class CaseSeats {
* @spec openspec/changes/handing-a-case-over/specs/people-on-the-case/spec.md
*/
public function __construct(
private readonly SettingsService $settingsService,
SettingsService $settingsService,
private readonly LoggerInterface $logger,
) {
$this->dossierRegister = new DossierRegister(settingsService: $settingsService);
}//end __construct()

/**
Expand Down Expand Up @@ -358,17 +367,7 @@ private function rows(string $schemaKey, array $filters): array {
* @throws RuntimeException When OpenRegister is absent or unconfigured.
*/
private function context(): array {
$objectService = $this->settingsService->getObjectService();
if ($objectService === null) {
throw new RuntimeException('OpenRegister is not available');
}

$register = $this->settingsService->getConfigValue('register');
if ($register === '') {
throw new RuntimeException('Dossier register not configured');
}

return [$objectService, $register];
return $this->dossierRegister->context();
}//end context()

/**
Expand All @@ -381,12 +380,7 @@ private function context(): array {
* @throws RuntimeException When the key is unset.
*/
private function schema(string $key): string {
$schema = $this->settingsService->getConfigValue($key);
if ($schema === '') {
throw new RuntimeException('Dossiq schema ' . $key . ' not configured');
}

return $schema;
return $this->dossierRegister->schema(key: $key);
}//end schema()

/**
Expand Down
30 changes: 12 additions & 18 deletions lib/Service/People/LeaverHandoverService.php
Original file line number Diff line number Diff line change
Expand Up @@ -59,6 +59,7 @@
use DateTimeImmutable;
use InvalidArgumentException;
use OCA\Dossiq\Service\CaseReassignmentService;
use OCA\Dossiq\Service\Custody\DossierRegister;
use OCA\Dossiq\Service\SettingsService;
use OCA\Dossiq\Service\Support\SearchesObjects;
use OCA\Dossiq\Service\Support\TranslatedText;
Expand All @@ -82,6 +83,13 @@ class LeaverHandoverService {
*/
public const PAGE_SIZE = 200;

/**
* The register and the configured schemas, read and refused the one shared way.
*
* @var DossierRegister
*/
private readonly DossierRegister $dossierRegister;

/**
* Constructor.
*
Expand All @@ -96,10 +104,11 @@ class LeaverHandoverService {
public function __construct(
private readonly CaseReassignmentService $reassignment,
private readonly CaseSeats $seats,
private readonly SettingsService $settings,
SettingsService $settings,
private readonly LoggerInterface $logger,
private readonly TranslatedText $text = new TranslatedText(),
) {
$this->dossierRegister = new DossierRegister(settingsService: $settings);
}//end __construct()

/**
Expand Down Expand Up @@ -416,17 +425,7 @@ public function draftsOf(string $uid): array {
* @throws RuntimeException When OpenRegister is absent or unconfigured.
*/
private function context(): array {
$objectService = $this->settings->getObjectService();
if ($objectService === null) {
throw new RuntimeException('OpenRegister is not available');
}

$register = $this->settings->getConfigValue('register');
if ($register === '') {
throw new RuntimeException('Dossier register not configured');
}

return [$objectService, $register];
return $this->dossierRegister->context();
}//end context()

/**
Expand All @@ -439,11 +438,6 @@ private function context(): array {
* @throws RuntimeException When the key is unset.
*/
private function schema(string $key): string {
$schema = $this->settings->getConfigValue($key);
if ($schema === '') {
throw new RuntimeException('Dossiq schema ' . $key . ' not configured');
}

return $schema;
return $this->dossierRegister->schema(key: $key);
}//end schema()
}//end class
30 changes: 12 additions & 18 deletions lib/Service/Transfer/InternalHandover.php
Original file line number Diff line number Diff line change
Expand Up @@ -52,6 +52,7 @@

use DateTimeImmutable;
use OCA\Dossiq\Exception\RefusedException;
use OCA\Dossiq\Service\Custody\DossierRegister;
use OCA\Dossiq\Service\Routing\RoutingNote;
use OCA\Dossiq\Service\SettingsService;
use OCA\Dossiq\Service\Support\SearchesObjects;
Expand Down Expand Up @@ -103,6 +104,13 @@ class InternalHandover {
*/
public const PAGE_SIZE = 200;

/**
* The register and the configured schemas, read and refused the one shared way.
*
* @var DossierRegister
*/
private readonly DossierRegister $dossierRegister;

/**
* Constructor.
*
Expand All @@ -115,12 +123,13 @@ class InternalHandover {
* @spec openspec/changes/handing-a-case-over/specs/case-management/spec.md
*/
public function __construct(
private readonly SettingsService $settingsService,
SettingsService $settingsService,
private readonly TeamDirectory $teams,
private readonly CaseSeatReconciler $seats,
private readonly DoorzendingNotifier $doorzending,
private readonly LoggerInterface $logger,
) {
$this->dossierRegister = new DossierRegister(settingsService: $settingsService);
}//end __construct()

/**
Expand Down Expand Up @@ -571,17 +580,7 @@ private function writeCase(array $case, array $changes): void {
* @throws RuntimeException When OpenRegister is absent or unconfigured.
*/
private function context(): array {
$objectService = $this->settingsService->getObjectService();
if ($objectService === null) {
throw new RuntimeException('OpenRegister is not available');
}

$register = $this->settingsService->getConfigValue('register');
if ($register === '') {
throw new RuntimeException('Dossier register not configured');
}

return [$objectService, $register];
return $this->dossierRegister->context();
}//end context()

/**
Expand All @@ -594,11 +593,6 @@ private function context(): array {
* @throws RuntimeException When the key is unset.
*/
private function schema(string $key): string {
$schema = $this->settingsService->getConfigValue($key);
if ($schema === '') {
throw new RuntimeException('Dossiq schema ' . $key . ' not configured');
}

return $schema;
return $this->dossierRegister->schema(key: $key);
}//end schema()
}//end class
Loading