Skip to content

Commit

Permalink
First working draft
Browse files Browse the repository at this point in the history
Still ignoring some criteria
  • Loading branch information
rubenvdlinde committed Dec 12, 2022
1 parent 21712a6 commit ffc4397
Show file tree
Hide file tree
Showing 2 changed files with 24 additions and 6 deletions.
8 changes: 7 additions & 1 deletion Service/CatalogiService.php
Original file line number Diff line number Diff line change
Expand Up @@ -77,7 +77,12 @@ public function readCatalogi(ObjectEntity $catalogus):void{{
var_dump('hello darkness my old friend');

// Lets grap ALL the objects for an external source
$objects = $this->callService->call($this->entityManager->find('App:Gateway', $catalogus->getValue('source')), 'api/search', 'GET', ['query'=>['_limit'=>10000]])->getResponce()['results'];
$objects = $this->callService->call(
$this->entityManager->find('App:Gateway', $catalogus->getValue('source')),
'/search',
'GET',
['query'=>['_limit'=>10000]]
)->getResponce()['results'];

// Now we can check if any objects where removed
if(!$source = $this->entityManager->getRepository('App:Gateway')->findBy(['location' =>$catalogus->getValue('location')])){
Expand All @@ -86,6 +91,7 @@ public function readCatalogi(ObjectEntity $catalogus):void{{
$source->setDescription($catalogus->getValue('description'));
$source->setLocation($catalogus->getValue('location'));
}

$synchonizedObjects = [];
// Handle new objects
foreach($objects as $object){
Expand Down
22 changes: 17 additions & 5 deletions Service/InstallationService.php
Original file line number Diff line number Diff line change
Expand Up @@ -160,6 +160,10 @@ public function checkDataConsistency(){
$searchEnpoint = new Endpoint();
$searchEnpoint->setName('Search');
$searchEnpoint->setDescription('Generic Search Endpoint');
$searchEnpoint->setPathRegex('^search');
$searchEnpoint->setMethod('GET');
$searchEnpoint->setMethods(['GET']);
$searchEnpoint->setOperationType('collection');
$this->entityManager->persist($searchEnpoint);
}

Expand Down Expand Up @@ -233,26 +237,34 @@ public function checkDataConsistency(){
(isset($this->io)?$this->io->writeln(['Creating Opencatalogi Source']):'');
$opencatalogi = new Source();
$opencatalogi->setName('OpenCatalogi.nl');
// $opencatalogi->setDescription('The open catalogi federated netwerk');
$opencatalogi->setDescription('The open catalogi federated netwerk');
$opencatalogi->setLocation('https://opencatalogi.nl/api');
$opencatalogi->setAuth('none');
$this->entityManager->persist($opencatalogi);
$opencatalogi = $this->entityManager->persist($opencatalogi);
$dashboardCard = new DashboardCard($opencatalogi);
$this->entityManager->persist($dashboardCard);

$this->entityManager->flush();

/*
$opencatalogiCatalog = new ObjectEntity($catalogiEntity);
$opencatalogiCatalog->setValue('source', $opencatalogi->getId()->toString());
$opencatalogiCatalog->setValue('source', (string) $opencatalogi->getId());
$opencatalogiCatalog->setValue('name', $opencatalogi->getName());
// $opencatalogiCatalog->setValue('description', $opencatalogi->getDescription());
$opencatalogiCatalog->setValue('description', $opencatalogi->getDescription());
$opencatalogiCatalog->setValue('location', $opencatalogi->getLocation());
$this->entityManager->persist($opencatalogiCatalog);
*/
}
else {

}

// Now we kan do a first federation
$this->catalogiService->setStyle($this->io);
$this->catalogiService->readCatalogi($opencatalogiCatalog);
//$this->catalogiService->readCatalogi($opencatalogiCatalog);

/*@todo register this catalogi to the federation*/
// This requers a post to a pre set webhook


$this->entityManager->flush();
Expand Down

0 comments on commit ffc4397

Please sign in to comment.