Skip to content

Commit

Permalink
Merge remote-tracking branch 'origin/feature/CONNECTOR-30/caal-servic…
Browse files Browse the repository at this point in the history
…e' into feature/Oauth
  • Loading branch information
rjzondervan committed Oct 10, 2024
2 parents c96c7c0 + e06ea38 commit e759771
Show file tree
Hide file tree
Showing 80 changed files with 3,124 additions and 607 deletions.
11 changes: 11 additions & 0 deletions appinfo/routes.php
Original file line number Diff line number Diff line change
Expand Up @@ -6,12 +6,23 @@
'Mappings' => ['url' => 'api/mappings'],
'Jobs' => ['url' => 'api/jobs'],
'Synchronizations' => ['url' => 'api/synchronizations'],
'Endpoints' => ['url' => 'api/endpoints'],
'Consumers' => ['url' => 'api/consumers'],
],
'routes' => [
['name' => 'dashboard#page', 'url' => '/', 'verb' => 'GET'],
['name' => 'sources#test', 'url' => '/api/source-test/{id}', 'verb' => 'POST'],
['name' => 'sources#logs', 'url' => '/api/sources-logs/{id}', 'verb' => 'GET'],
['name' => 'jobs#run', 'url' => '/api/jobs-test/{id}', 'verb' => 'POST'],
['name' => 'jobs#logs', 'url' => '/api/jobs-logs/{id}', 'verb' => 'GET'],
['name' => 'endpoints#test', 'url' => '/api/endpoints-test/{id}', 'verb' => 'POST'],
['name' => 'endpoints#logs', 'url' => '/api/endpoints-logs/{id}', 'verb' => 'GET'],
['name' => 'synchronizations#contracts', 'url' => '/api/synchronizations-contracts/{id}', 'verb' => 'GET'],
['name' => 'synchronizations#logs', 'url' => '/api/synchronizations-logs/{id}', 'verb' => 'GET'],
// Running endpoints
['name' => 'endpoints#run', 'url' => '/api/v1/{endpoint}', 'verb' => 'GET'],
['name' => 'endpoints#run', 'url' => '/api/v1/{endpoint}', 'verb' => 'PUT'],
['name' => 'endpoints#run', 'url' => '/api/v1/{endpoint}', 'verb' => 'POST'],
['name' => 'endpoints#run', 'url' => '/api/v1/{endpoint}', 'verb' => 'DELETE'],
],
];
1 change: 1 addition & 0 deletions composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,7 @@
"elasticsearch/elasticsearch": "^v8.14.0",
"guzzlehttp/guzzle": "^7.0",
"symfony/uid": "^6.4",
"symfony/yaml": "^6.4",
"twig/twig": "^3.14",
"web-token/jwt-framework": "^3"
},
Expand Down
78 changes: 75 additions & 3 deletions composer.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

21 changes: 21 additions & 0 deletions css/main.css
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,29 @@
--OC-margin-30: 30px;
--OC-margin-40: 40px;
--OC-margin-50: 50px;
--OC-color-status-background-debug: #f2f2f2;
--OC-color-status-debug: #4a4a4a;
--OC-color-status-background-success: #d4edda;
--OC-color-status-success: #155724;
--OC-color-status-background-info: #cce5ff;
--OC-color-status-info: #004085;
--OC-color-status-background-notice: #d1ecf1;
--OC-color-status-notice: #0c5460;
--OC-color-status-background-warning: #fff3cd;
--OC-color-status-warning: #856404;
--OC-color-status-background-error: #ffc061;
--OC-color-status-error: #59401a;
--OC-color-status-background-critical: #f8d7da;
--OC-color-status-critical: #721c24;
--OC-color-status-background-alert: #ff959e;
--OC-color-status-alert: #480f14;
--OC-color-status-background-emergency: #000000;
--OC-color-status-emergency: #ffffff;
}




/* Pages */
.pageHeader {
margin-block-start: var(--app-navigation-padding);
Expand Down
12 changes: 6 additions & 6 deletions docker-compose.yml
Original file line number Diff line number Diff line change
Expand Up @@ -18,12 +18,12 @@ services:
- MYSQL_DATABASE=nextcloud
- MYSQL_USER=nextcloud

init-ubuntu:
image: ubuntu
command: sh /home/ubuntu/docker/init-ubuntu.sh
volumes:
- ./docker:/home/ubuntu/docker
- .:/home/ubuntu/app
# init-ubuntu:
# image: ubuntu
# command: sh /home/ubuntu/docker/init-ubuntu.sh
# volumes:
# - ./docker:/home/ubuntu/docker
# - .:/home/ubuntu/app

nextcloud:
user: root
Expand Down
16 changes: 16 additions & 0 deletions docs/assets/app.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
13 changes: 13 additions & 0 deletions docs/cloudevents.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
# Cloudevents

We facilitate subscriptions on a pub/sub model. This is based on [CloudEvents](https://cloudevents.io/) but also supports the [NL GOV profile for CloudEvents](https://www.logius.nl/domeinen/gegevensuitwisseling/nl-gov-profile-cloudevents). More documentation can be found [here](https://gitdocumentatie.logius.nl/publicatie/notificatieservices/CloudEvents-NL/).

## Subsribers

## Publishers

## Endpoints

## Mappings

## Events
Binary file added docs/connections/image-1.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added docs/connections/image-2.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added docs/connections/image.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
35 changes: 35 additions & 0 deletions docs/connections/xxllncToPublication.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
# Xxllnc To Publication

This document describes the connection between the Xxllnce (zaaksysteem) seqarch api and the Publication Register (and publication object).

## Overview

The Xxllnc (zaaksysteem) is a system used by the Dutch government to manage and publish administrative decisions. The seqarch api is a RESTful api that provides access to the data in the Xxllnc system.

The Publication Register is a system used to manage and publish administrative decisions. The publication object is the core object in the Publication Register.

## Preperation

Make sure you have the following information:

- The base url of the seqarch api
- An installtion of Open Register
- An configuration of the Publication Register on Open Register
- An insatllation of Open Connector

## Setting up the connection

Create a new source (connection), set the type to API and location to the base url of the xxlnc search api. Since the search api is public to start with no addiotnal configuration is nessesarry.

![alt text](image.png)


Open the source and click on 'Test' in the action menu. This wil open the test dialog. Presss test and you will see the data that is available.

![alt text](image-1.png) ![alt text](image-2.png)

I everything checks out we can write down the source id and are now ready to setup a mapping.

## Setting up the mapping

Mappings are used to map the data from object A tot object B or visa versa. In the case of the xxlnc search api we need to create a mapping between the search api and the publication register publication object. And the attachement object.
3 changes: 3 additions & 0 deletions docs/consumer.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
# Consumer

A consumer is a service or application that consumes events, has acces to endpoints and mappings and is able to trigger actions based on the events etc etc. It is the main actor in the openconnector platform. And determins authentication and authorisations on all aspects of the platform.
18 changes: 9 additions & 9 deletions lib/Action/EventAction.php
Original file line number Diff line number Diff line change
Expand Up @@ -7,27 +7,27 @@

/**
* This class is used to run the action tasks for the OpenConnector app. It hooks into the cron job list and runs the classes that are set as the job class in the job.
*
*
* @package OCA\OpenConnector\Cron
*/
class EventAction
{
class EventAction
{
private CallService $callService;
private SourceMapper $sourceMapper;
public function __construct(
CallService $callService,
SourceMapper $sourceMapper,
public function __construct(
CallService $callService,
SourceMapper $sourceMapper,
) {
$this->callService = $callService;
}

//@todo: make this a bit more generic :')
public function run($argument)
public function run(array $argument = []): array
{
// @todo: implement this

// Lets report back about what we have just done
return;
// Let's report back about what we have just done
return [];
}

}
56 changes: 38 additions & 18 deletions lib/Action/PingAction.php
Original file line number Diff line number Diff line change
Expand Up @@ -7,36 +7,56 @@

/**
* This class is used to run the action tasks for the OpenConnector app. It hooks into the cron job list and runs the classes that are set as the job class in the job.
*
*
* @package OCA\OpenConnector\Cron
*/
class PingAction
{
class PingAction
{
private CallService $callService;
private SourceMapper $sourceMapper;
public function __construct(
CallService $callService,
SourceMapper $sourceMapper,

public function __construct(
CallService $callService,
SourceMapper $sourceMapper,
) {
$this->callService = $callService;
$this->sourceMapper = $sourceMapper;
}

//@todo: make this a bit more generic :')
public function run($argument)
{
/**
* Executes a simple API-call (ping / GET) on a source by using the callService.
* The method logs actions performed during execution and returns a stack trace of the operations.
*
* @todo Make this method more generic to support additional actions.
* @todo Add logging or better handling for cases when 'sourceId' is not provided.
*
* @param array $arguments An array of arguments including optional 'sourceId' to define the source for the call.
*
* @return array An array containing the execution stack trace of the actions performed.
*/
public function run(array $arguments = []): array
{
$response = [];
$response['stackTrace'][] = 'Running PingAction';

// For now we only have one action, so this is a bit overkill, but it's a good starting point
if (isset($arguments['sourceId']) && is_int($argument['sourceId'])) {
$source = $this->sourceMapper->find($argument['sourceId']);
$this->callService->call($source);
}
if (isset($arguments['sourceId']) && is_int((int) $arguments['sourceId'])) {
$response['stackTrace'][] = "Found sourceId {$arguments['sourceId']} in arguments";
$source = $this->sourceMapper->find((int) $arguments['sourceId']);
}
else {
// @todo log and / or not default to just using the first source
$response['stackTrace'][] = "No sourceId in arguments, default to sourceId = 1";
$source = $this->sourceMapper->find(1);
$this->callService->call($source);
}
}

$response['stackTrace'][] = "Calling callService...";
$callLog = $this->callService->call($source);

$response['stackTrace'][] = "Created callLog with id: ".$callLog->getId();

// Lets report back about what we have just done
return;
// Let's report back about what we have just done
return $response;
}

}
Loading

0 comments on commit e759771

Please sign in to comment.