Mindoo Blog - Cutting edge technologies - About Java, Lotus Notes and iPhone

  • Domino JNA version 0.9.48: API to read/write Notes workspace, some formula magic and QueryResultsProcessor API

    Karsten Lehmann  1 June 2022 00:43:40
    Today we released version 0.9.48 of Domino JNA as OSGi plugin for XPages developers and on Maven Central.

    Here is a list of new features:
    • API to read and write the Notes workspace (read, create and modify pages and icons, change page order, move replicas on top etc.)
    • Formula execution now supports more than 64k of return data
    • API to apply security to formula execution (e.g. prevent Notes.ini changes)
    • API for QueryResultsProcessor (produces JSON and views)
    • Java 8 date/time support for NotesNote.replaceItemValue(...)
    • New utility class to format view data as markdown table
    • Added method to get agent design doc UNID
    • Added hierarchical recycling (parent/child auto recycle)

    Notes Workspace API

    The new Notes workspace API is pretty feature complete. It let's you read and modify the workspace content and contains functionality that I have long been waiting for in the Notes Client user interface like a method to change the order of tabs.

    Actually I built this for my own purpose because I needed a tool to remove icons that no longer exist.


    To play with the API and as a sample for a standalone application using Domino JNA, I created a small Maven project that you can find here:

    https://github.com/klehmann/domino-jna/tree/develop/workspace-demo

    The application creates a new workspace page:


    Image:Domino JNA version 0.9.48: API to read/write Notes workspace, some formula magic and QueryResultsProcessor API

    and a database icon with a red rectangle:


    Image:Domino JNA version 0.9.48: API to read/write Notes workspace, some formula magic and QueryResultsProcessor API

    We support both the classic 32x32 pixel icons and the new 64x64 true color ones. By passing a NotesDatabase object to NotesWorkspace.addIcon(...), the current DB icon gets extracted from the NSF design and copied into the workspace.


    Please make sure that the Notes Client is not running or in its early startup phase when you modify the workspace. Otherwise the changes will not be visible in the Notes UI and might later be overwritten.


    Formula magic


    Classic formula execution is limited to 64K of return data. We found a way to remove this limit (e.g. to use @DbColumn to read the whole column of a view) and you can even run formulas in a restricted environment, e.g. to prevent them from changing the Notes.ini or setting document items.

    Methods have been added to analyze a formula in order to see if it's time variant, just contains a field name or uses special functions like @DocSiblings or @DocDescendants.


    QueryResultsProcessor API


    The
    QueryResultsProcessor lets you build views across NSF boundaries, have them displayed in the Notes Client or exported in JSON format as string.

    In contrast to the implementation in the legacy Notes.jar and LotusScript API, we provide methods to get the JSON result back in a streaming way so that it can be parsed without storing the whole content in the Java heap.


    Comments

    1Fredrik  13.07.2022 11:22:50  Domino JNA version 0.9.48: API to read/write Notes workspace, some formula magic and QueryResultsProcessor API

    How can this formula magic be used ?

    Formula magic

    Classic formula execution is limited to 64K of return data

    2Karsten Lehmann  13.07.2022 14:17:15  Domino JNA version 0.9.48: API to read/write Notes workspace, some formula magic and QueryResultsProcessor API

    Here is a testcase:

    https://github.com/klehmann/domino-jna/blob/develop/domino-jna/src/test/java/com/mindoo/domino/jna/test/TestFormulaExecution.java