Page Properties |
---|
Status | status | colour | Yellow |
title | PROGRESS |
---|
Priority | 2 |
---|
Note | Product Version | 2.4 |
---|
Report Note | presentable |
---|
Assignee | Antje, Nils |
---|
RessourcesResources & Remarks Concept article linking to the respecive tutorials Modification History Name | Date | Product Version | Action |
---|
Antje | 08 FEB 2021 | 2.4 | New page properties macro. | Antje | 05 MAR 2021 | 2020 Winter | New interceptor type added. |
|
Excerpt |
---|
Intervening a running process at a certain position and redirecting the process flow in order to include project-specific processing steps. |
...
Section |
---|
|
Column |
---|
Table of Contents Table of Contents |
---|
exclude | (Table of Contents|Read on|System Hooks|Another Concept Article|Another interesting Preprocessing Metadata using Webhooks|Interceptor Example Tutorial) |
---|
|
|
|
Introduction
The interceptors allow for project-specific extensions of the yuuvis® Momentum standard process flows. The running process flow can be intervened in redirected by a condition set on the processed object , that has to be specified in the interceptor definition. Whenever the process flow satisfies meets the condition, the project-specific process extension is included for the currently processed object at this position of the process flow. Thus, the alternative process can entirely replace the standard one from this position completely on or resume the standard process at a specified position.
...
The condition for the intervention of the process flow is defined in the interceptor configuration file \system\interceptorConfiguration.json
.
Parameters
The following parameters can/have to be defined in are available for the interceptor configuration:
Parameter | Type | Required | Description |
---|
type | String | yes | The type of the interceptor. It defines the position in the process flow where the interceptor can step in. |
predicate | String | yes | The condition that triggers the intervention redirection of the process flow in order to include the project-specific process extension. The string can provide the condition either in Spring Expression Language (SpEL) or Javascript. Thus, the string always has to start always with a prefix spel: for SpEL or js: for Javascript. |
url | String | yes | HTTP address of an external endpoint defining the project-specific process extension. Dynamic components (properties of the processed object) can be included in braces curly brackets. |
useDirectory useDiscovery | Boolean | booleanno | Decides whether to resolve the url string at the Discovery-Service or not. If not specified, a default value is set. |
Interceptor Types
There are different types of interceptors available , that interrupt the process flow at different positions.
Intercepor TypeInterceptor type | Evaluation |
---|
Target Predicatepredicate | Interceptor input data | Description |
---|
getContent | API |
dms DMS object in JSON format derived from given objectId | objectId | Manipulation of the binary content of the return statement by a project-specific service |
search |
structure Structure of the specific class SearchInterceptorObject | Search query object | Manipulation of the search query parameter and the search result. |
updateDmsObject |
first dms DMS object in the list in JSON format |
, that is passed to the corresponding update endpoint | Updated metadata and metadata of current version | Manipulation of the update properties that will be applied to a |
dms Configuration Examples
The interceptor configuration is part of the . It is a JSON list of all interceptors, each of them specified by its type
, predicate
, url
and useDirectory
parameters. If there are two or more interceptors of the same type, all of them will be executed in random order.
The following two code examples show the configuration of a getContent interceptor. In the first case, the predicate contains the condition in JavaScript. In contrast, the second code example makes use of SpEL.
Code Block |
---|
language | js |
---|
title | getContent interceptor with Javascript condition |
---|
linenumbers | true |
---|
|
{
"interceptors" : [
{ "type" : "getContent",
"predicate" : "js:function process(dmsApiObject){return dmsApiObject[\"contentStreams\"][0][\"range\"]!=null && dmsApiObject[\"contentStreams\"][0][\"range\"].startsWith(\"page:\")}",
"url" : "http://localhost:10666/api/dms/objects/{enaio:objectId}",
"useDiscovery" : false
}
]
} |
Code Block |
---|
language | yml |
---|
title | getContent interceptor with SpEL condition |
---|
linenumbers | true |
---|
|
{
"interceptors" : [
{ "type" : "getContent",
"predicate" : "spel:contentStreams[0]['range'] != null ? contentStreams[0]['range'] matches '(?i)^page:.*' : false",
"url" : "http://localhost:10666/api/dms/objects/{enaio:objectId}",
"useDiscovery" : false
}
]
} |
...
dms.request.objects.upsert.database-before | All objects of the objects list in the data part of the multipart body after enrichment. | a multipart request body | The take-off point of the interceptor is after the REPOSITORY service. The initial request body is already normalized, validated and enriched with content stream properties. |
Interceptor Configuration Example
The following example configures an interceptor that will be trigger by every update of a content (action code 301
). At the take-off point after the REPOSITORY service, the enriched request body is passed to the external endpoint specified by url
.
To activate this configuration, the REPOSITORY service needs to be restarted.
Code Block |
---|
language | yml |
---|
title | search interceptor with SpEL conditionExample interceptorConfiguration.json. |
---|
linenumbers | true |
---|
|
{
"interceptors" : [
{
"type" : "searchdms.request.objects.upsert.database-before",
"predicate" : "spel:!grantedAuthorities.contains('ACCESS_FOREIGN_JOURNAL_OBJECTS')",
options['action']==301",
"url" : "http://localhost:10777exampleinterceptorcontentupdate/api/searchdms/objects/dslupsert",
"useDiscovery" : false
true
}
]
} |
Code Block |
---|
language | yml |
---|
title | Definition of the SearchInterceptionObject class |
---|
linenumbers | true |
---|
|
public class SearchInterceptionObject
{
private EnaioUserDetails enaioUserDetails;
private List<String> grantedAuthorities; // liste der dem aktuellen Nutzer zugeordneten Authority-Namen
}
public class EnaioUserDetails extends User
{
private String jwtAutorization;
private String id;
private String domain;
private String tenant;
private volatile long expiresAt;
...
} ]
}
|
Summary
This article gave an overview of the interceptor handling interceptors in yuuvis® Momentum. If you want to extend the functionality of your system, also system hooks also might be an interesting topic for you.
Info |
---|
|
Read on
Section |
---|
Column |
---|
| Insert excerpt |
---|
| Interceptor Example Tutorial |
---|
| Interceptor Example Tutorial |
---|
nopanel | true |
---|
| Keep on reading
|
Column |
---|
| Insert excerpt |
---|
| Preprocessing Metadata using Webhooks |
---|
| Preprocessing Metadata using Webhooks |
---|
nopanel | true |
---|
| Keep on reading |
|
|