Document-Handler-Insight¶
The handler writes the file to the insightDB-database and does a HTTP-POST call to a metadata REST-interface. All the configured backendParams are sent to the metadata interface. In addition, two additional parameters are sent:
- The document-id of the written file -> document.meta.reference=docid
- The file name of the written file -> document.meta.filename=filename
These parameters must be configured in the insight.properties of the insight-middleware. Also the url to the metadata interface must be configured:
- document.meta.url=http://localhost:8080/insight-v3server/resources/data/insight-user-dummy/documents-upload/root
Full example:
insight.properties -> configure handler:
document.meta.reference=docid
document.meta.filename=filename
document.meta.url=http://localhost:8080/insight-v3server/resources/data/insight-user-dummy/documents-upload/root
documents config -> to upload photos
"root": {
...
"documents": [
{
"handler": "insight",
"name": "Außenbild Anlage",
"label": "Außenbild Anlage",
"type": "Foto",
"backendParams": {
"parentTable": "ACTIVITY",
"parentId": "${id}",
"type": "PHOTO"
},
"attributes": [
{
"name": "desc",
"label": "Description:",
"type": "String"
}
]
}
],
tree config -> to store metadata
{
"$schema": "./schema/schema.json",
"name": "documents-upload",
"title": "Documents-Upload",
"icon": "icon-paperclip",
"root": {
"name": "root",
"title": "Attachment",
"label": "${desc}",
"icon": "icon-paperclip",
"attributes": [
{
"name": "id",
"label": "id"
},
{
"name": "docid",
"label": "docid"
},
{
"name": "type",
"label": "type"
},
{
"name": "desc",
"label": "Bezeichnung"
},
{
"name": "parentId",
"label": "parentId"
},
{
"name": "parentTable",
"label": "parentTable"
},
{
"name": "filename",
"label": "Dateiname"
}
]
}
}
tree config -> to show documents
"children": {
"name": "documents",
"title": "Foto",
"bucket": "Photos",
"bucketIcon": "icon-camera2",
"icon": "icon-camera2",
"label": "${name}",
"attributes": [
{
"name": "desc",
"label": "Description"
},
{
"name": "docid",
"label": "Doc-Id"
},
{
"name": "filename",
"label": "File name"
}
],
"fileLink": {
"url": "insight/document/insight/${identifier}",
"fileName": "${filename}"
},
"menus": [
{
"label": "Show",
"icon": "icon-eye",
"action": "fileView"
}
]
}