Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.


Page Properties


Status

Status
colourYellow
titlePROGRESS

Priority2
Note
AssigneeAntje

Ressources

Remarks

Concept article linking to the respecive tutorials

  • Antje: writing started

...

Parameters

The following parameters can/have to (question) be defined in are available for the interceptor configuration:

ParameterTypeRequiredDescription
typeStringyesThe type of the interceptor. It defines the position in the process flow where the interceptor can step in.
predicateStringyesThe condition that triggers the intervention 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 has to start always with a prefix spel: for SpEL or js: for Javascript.
urlStringyesHTTP address of the project-specific process extension. Dynamic components (properties of the processed object) can be included in braces.
useDiscoverybooleannoDecides 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 Type

Evaluation Target of the PredicateDescription
getContentAPI dms object in JSON formatManipulation of the binary content of the return statement by a project-specific service
searchstructure of the specific class SearchInterceptorObjectManipulation of the search query parameter and the search result.
updateDmsObjectfirst API dms object in the list in JSON format, that is passed to the corresponding update endpointManipulation of the update properties that will be applied to a dms object.

Configuration Examples

The interceptor configuration is part of the interceptorConfiguration.json file. 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
languagejs
titlegetContent interceptor with Javascript condition
linenumberstrue
{
  "interceptors" : [
    { "type" : "getContent",
      "predicate" : "js:function process(dmsApiObject){return dmsApiObject[\"contentStreams\"][0][\"range\"]!=null && dmsApiObject[\"contentStreams\"][0][\"range\"].startsWith(\"page:\")}",
      "url" : "http://<server>:<port>/api/dms/objects/{system:objectId}",
      "useDiscovery" : false     
    }
  ]
}
Code Block
languageyml
titlegetContent interceptor with SpEL condition
linenumberstrue
{
  "interceptors" : [
    { "type" : "getContent",
      "predicate" : "spel:contentStreams[0]['range'] != null ? contentStreams[0]['range'] matches '(?i)^page:.*' : false",
      "url" : "http://<server>:<port>/api/dms/objects/{system:objectId}",
      "useDiscovery" : false     
    }
  ]
}

A search interceptor can have a SpEL or a JavaScript statement in the predicate as well. In the example code below, only the SpEL variant is shown. In addition to the actual search interceptor configuration, the class SearchInterceptionObject has to be defined.

Code Block
languageyml
titlesearch interceptor with SpEL condition
linenumberstrue
{
  "interceptors" : [
    { "type" : "search",
      "predicate" : "spel:!grantedAuthorities.contains('ACCESS_FOREIGN_JOURNAL_OBJECTS')",
      "url" : "http://<server>:<port>/api/search/dsl",
      "useDiscovery" : false
    }
  ]
}

...

languageyml

...

.

...

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 might be an interesting topic for you.


Info
iconfalse

Read on

Section


Column
width25%

System Hooks

Insert excerpt
System Hooks
System Hooks
nopaneltrue
 Keep on reading


Column
width25%

Webhooks

Insert excerpt
Webhooks
Webhooks
nopaneltrue
 Keep on reading


Column
width25%

Preprocessing Metadata using Webhooks

Insert excerpt
Preprocessing Metadata using Webhooks
Preprocessing Metadata using Webhooks
nopaneltrue
 Keep on reading