Skip to content

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

Several parameters must be configured in the insight.properties of the insight-middleware.

document.meta.reference=docid
document.meta.filename=filename
document.meta.url=http://localhost:8080/insight-v3server/resources/data/insight-user-dummy/documents-upload/root

Please note that in this example docId and filename refer to attribute names in the target tree configuration handling the metadata storage. documents-upload in the url refers to the name of the treeConfiguration handling the metadata storage.

Example configuration

Example 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"
                }
            ]
        }
    ]
}

Example 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"
            }
        ]
    }
}

Example 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"
        }
    ]
}