History

Recording operations.

Principle

A component’s history is made up of a set of facts. Each fact logs an action performed by a user on a component and stores the following information:

Name Automatic Description
id yes Unique identifier
creationDate yes Completion date
user yes Identifier of the user who performed the operation
requestId yes Identifier of the request at the origin of the action
technical yes Determines whether the fact is technical or business
action no Action performed
objectId no Object identifier in question
objectType no Object type in question

Technical facts

Technical facts are generated automatically by FlowerDocs Core when a historical operation is executed. For each component category, fact logging for a given action can be enabled or disabled.

Action Default Description
create yes Creation
read no Access
get_content no Content access
update yes Update
add_content no Adding content
delete_content no Deleting content
revert yes Restoring a version
delete yes Physical removal
Action Default Description
create yes Creation
read no Access
update yes Update
assign yes Assignment
add_content yes Add attachment(s)
delete_content yes Deleting attachments
answer yes Application of an answer
delete yes Physical removal
Action Default Description
create yes Creation
read no Access
update yes Update
add_content yes Adding component(s)
delete_content yes Deleting component(s)
delete yes Physical removal
Action Default Description
create yes Creation
read no Access
update yes Update
delete yes Physical removal

To modify historical actions, the core.properties file must be modified using the default configuration:

fact.registrations.document=create,update,delete,version,revert
fact.registrations.folder=create,update,add_content,delete_content,delete
fact.registrations.virtual.folder=create,update,delete
fact.registrations.task=create,update,delete,answer,assign,add_content,delete_content

Business facts

A business fact is generated programmatically to record a particular state or action for a component. This generation must be configured or developed specifically for the situations concerned thanks to:

  • APIs exposed for each component category
  • the [ContextUtil] object(https://documentation.flowerdocs.com/lts/en/documentation/config/core/appendices/context-util/)

The user responsible for generating a business fact must have the ADMIN role.

In the graphical user interface, a technical fact is linked to a business fact if they have the same request identifier (requestId). Technical facts generated before and linked to a business fact are displayed in detail.


POST {core}/rest/documents/{id}/facts HTTP/1.1
token: {token}
Content-Type: application/json
{
    "action": "custom",
    "description": "Generated by REST API.”,
    "updatedFields": [
        {
            "name": "tag",
            "value": "text
        }
    ]
}

//ScriptOperationHandler
var builder = com.flower.docs.common.fact.FactBuilder.objectId(component.getId()).type('DOCUMENT');
builder.action('custom').description('Generated by script operation handler.').field('tag', 'text');
util.createFact(builder.build());

Custom Facts

A custom fact is created outside the product’s native historical logs. It can be used by integrators to trace specific actions based on their needs. It can be:

  • A business fact : Traces a business action (e.g., creating a letter).
  • A technical fact : Traces a technical operation (e.g., integration with a CRM).

The distinction is made via a boolean, but the underlying Java object is the same. When creating custom facts via an OperationHandler, the user logged in the fact will, by default, be the administrator executing the OH. This is due to administrative privileges that ensure security and prevent unauthorized manipulation.


If you want to log the actual user who initiated the action, you can customize the description.

Example using FactBuilder:

var builder = FactBuilder.objectId(component.getId()).type('DOCUMENT');
var userDisplayName = util.getUserService().get(...).getDisplayName();
builder.action('CREATE').description(userDisplayName + ' created the document.');
util.createFact(builder.build());

History configuration

FlowerDocs provides a document class FactFieldsConfiguration that lets you simply define the tags to be historised on generated facts.

This document allows you to define:

  • the object type: DOCUMENT, TASK, VIRTUAL_FOLDER, FOLDER
  • component class identifiers
  • tag identifiers


This configuration document is accessible from the FlowerDocs administration interface: Configuration > Historical facts.