Class ProtokollUtils

    • Field Detail

      • INST

        public static final ProtokollUtils INST
        The singleton instance of this utility class. It is mutable and not thread-safe.
    • Method Detail

      • removeClientUUIDToDelete

        public void removeClientUUIDToDelete​(String clientUUID)
        Unmarks a client and allows protocol entries for the client to be created again. Should be used after addClientUUIDToDelete(String), after the client was deleted.
        Parameters:
        clientUUID - The client for which protocol entries may be created again.
      • addClientUUIDToDelete

        public void addClientUUIDToDelete​(String clientUUID)
        Marks a client for which no protocol entries should be created. When a client is deleted, all entities belonging to that client are deleted as well. This would usually result in the creation of more protocol entries. But it is pointless to create these entries when the client is deleted anyway.
        Parameters:
        clientUUID - The Mandant.getUUIDObject() of the client for which no protocol entries are to be created.
      • addClientProtocolEntry

        public void addClientProtocolEntry​(Mandant client,
                                           ProtocolEntryClient entry,
                                           IEntityContext ec)
        Fills in missing pieces of information of a ProtocolEntryClient, and saves that entry in the database.
        Parameters:
        client - The client for which the protocol entry is created.
        entry - The protocol entry to save. Specific data such as AProtocolEntry.getBemerkung() should be set.
        ec - An entity context for interacting with the database.
      • togglePreserveFlag

        public <T extends AProtocolEntry> T togglePreserveFlag​(T entry,
                                                               IEntityContext ec)
        Negates the AProtocolEntry.isPreserve() flag of the given entry and saves the modifications to the database.
        Parameters:
        entry - Protocol entry to modify.
        ec - Current entity context for the database.
        Returns:
        The modified protocol entry.
      • addProjectProtocolEntry

        public void addProjectProtocolEntry​(Projekt project,
                                            ProtocolEntryClient entry,
                                            IEntityContext ec)
        Fills in missing pieces of information of a ProtocolEntryClient for a certain form, and saves that entry in the database.
        Parameters:
        project - The form for which to create a protocol entry.
        entry - The protocol entry to save. Specific data such as AProtocolEntry.getBemerkung() should be set.
        ec - An entity context for interacting with the database.
      • addProcessProtocolEntry

        public void addProcessProtocolEntry​(Vorgang formRecord,
                                            ProtocolEntryProcessing entry,
                                            IEntityContext ec)
        Fills in missing pieces of information of a ProtocolEntryProcessing, and saves that entry in the database.
        Parameters:
        formRecord - The form record for which the protocol entry is created.
        entry - The protocol entry to save. Specific data such as AProtocolEntry.getBemerkung() should be set.
        ec - An entity context for interacting with the database.
      • addTriggerFiredProtocolEntry

        public void addTriggerFiredProtocolEntry​(IEntityContext ec,
                                                 Mandant client,
                                                 IUser user,
                                                 Vorgang formRecord,
                                                 WorkflowTask task)
        Adds the protocol entry for when a workflow trigger was fired.
        Parameters:
        ec - Current entity context for accessing the database.
        client - Client to which the form record belongs.
        user - User who initiated the trigger. This will be logged, use UserMgmtUtils.ANONYMOUS when that is not desired.
        formRecord - Form record for which the trigger was fired.
        task - Task with the trigger that was fired.
      • addPluginUpdatedEntry

        public void addPluginUpdatedEntry​(IEntityContext ec,
                                          IPluginEntity<?,​?,​?> plugin,
                                          String name,
                                          String version,
                                          IUser user,
                                          Locale locale)
        Adds a protocol entry for when a client or system scoped plugin was updated with a new plugin JAR file.
        Parameters:
        ec - Entity context for accessing the database.
        plugin - Plugin that was updated.
        name - Name of the plugin, such as the file name or the name from PROMA.
        version - Version of the plugin, e.g. from the manifest.
        user - User who initiated the update.
        locale - Locale for localizing the protocol entry.
      • addPluginDeletedEntry

        public void addPluginDeletedEntry​(IEntityContext ec,
                                          IPluginEntity<?,​?,​?> plugin,
                                          String name,
                                          String version,
                                          IUser user,
                                          Locale locale)
        Adds a protocol entry for when a client or system scoped plugin was deleted.
        Parameters:
        ec - Entity context for accessing the database.
        plugin - Plugin that was deleted.
        name - Name of the plugin, such as the file name or the name from PROMA.
        version - Version of the plugin, e.g. from the manifest.
        user - User who initiated the update.
        locale - Locale for localizing the protocol entry.
      • addPluginCreatedEntry

        public void addPluginCreatedEntry​(IEntityContext ec,
                                          IPluginEntity<?,​?,​?> plugin,
                                          String name,
                                          String version,
                                          IUser user,
                                          Locale locale)
        Adds a protocol entry for when a client or system scoped plugin was newly created.
        Parameters:
        ec - Entity context for accessing the database.
        plugin - Plugin that was created.
        name - Name of the plugin, such as the file name or the name from PROMA.
        version - Version of the plugin, e.g. from the manifest.
        user - User who initiated the update.
        locale - Locale for localizing the protocol entry.
      • addMalwareDetectedProtocolEntry

        public void addMalwareDetectedProtocolEntry​(IEntityContext ec,
                                                    IUser user,
                                                    String scannedItem,
                                                    MalwareScanReport report)
        Adds a system protocol entry when malware was detected in a file or some data.
        Parameters:
        ec - An entity context for accessing the database.
        user - The current user who uploaded the file containing malware.
        scannedItem - A description of the scanned file that was found to contain malware, e.g. the name of an upload element or the name of an attachment.
        report - The malware scan report. When MalwareScanReport.isSafe() is true, no protocol entry
      • addMalwareDetectedProtocolEntry

        public void addMalwareDetectedProtocolEntry​(IEntityContext ec,
                                                    IUser user,
                                                    String scannedItem,
                                                    MalwareScanReport report,
                                                    Mandant client)
        Adds a client protocol entry when malware was detected in a file or some data.
        Parameters:
        ec - An entity context for accessing the database.
        user - The current user who uploaded the file containing malware.
        scannedItem - A description of the scanned file that was found to contain malware, e.g. the name of an upload element or the name of an attachment.
        report - The malware scan report. When MalwareScanReport.isSafe() is true, no protocol entry is added.
        client - The client scope containing the file or data with malware.
      • addMalwareDetectedProtocolEntry

        public void addMalwareDetectedProtocolEntry​(IEntityContext ec,
                                                    IUser user,
                                                    String scannedItem,
                                                    MalwareScanReport report,
                                                    Vorgang formRecord)
        Adds a processing protocol entry when malware was detected in a file or some data.
        Parameters:
        ec - An entity context for accessing the database.
        user - The current user who uploaded the file containing malware.
        scannedItem - A description of the scanned file that was found to contain malware, e.g. the name of an upload element or the name of an attachment.
        report - The malware scan report. When MalwareScanReport.isSafe() is true, no protocol entry is added.
        formRecord - The form record to which the file belongs.
      • addStateChangeProtocolEntry

        public void addStateChangeProtocolEntry​(IEntityContext ec,
                                                Mandant client,
                                                IUser user,
                                                Vorgang formRecord,
                                                WorkflowState oldState,
                                                WorkflowState newState)
        Adds a protocol entry for a state change, i.e. when the Vorgang.getCurrentStatus() is changed.
        Parameters:
        ec - Current entity context for accessing the database.
        client - Client to which the form record belongs.
        user - User who initiated the state changed. This will be logged, use UserMgmtUtils.ANONYMOUS when that is not desired.
        formRecord - Form record for which the state was changed.
        oldState - The old state of the form record.
        newState - The new state of the form record.
      • getNewFormVersionPe

        public static final ProtocolEntryClient getNewFormVersionPe​(IUser user,
                                                                    FormVersion formversion)
        Generates a protocol entry for indicating that a new Form version has been created
        Parameters:
        user - IUser that created the form version
        formversion - FormVersion that has been newly created
        Returns:
        ProtocolEntryClient that is not yet persisted
      • addMandantPeBase

        @Deprecated
        public void addMandantPeBase​(Mandant mandant,
                                     ProtocolEntryClient entry,
                                     IEntityContext ec)
        Diese Methode dient dazu, einen Protokolleintrag zu einem Mandanten hinzuzufügen. Diese Protokolleinträge dienen dazu alle Aktionen die innerhalb eines Mandanten geschehen zu protokollieren. Protokolleinträge, die Projekte oder Vorgänge betreffen werden hier nicht berücksichtigt. Die Bidirektionale Zuordnung des Protokolls zu dem AProtocolEntry-Objekt erfolgt innerhalb dieser Methode.
        Parameters:
        mandant - - Mandant-Instanz, für welchen der Eintrag angelegt werden soll
        entry - - Der Protokolleintrag der angelegt werden soll
        ec - - EntityContext der genutzt wird um Abfragen zu tätigen und den Protokolleintrag zu persistieren
      • addSystemPeDokumentation

        @Deprecated
        public void addSystemPeDokumentation​(ProtocolEntrySystem entry,
                                             IEntityContext ec)
        Diese Methode dient dazu, einen Protokolleintrag zu allen im System vorhanden Mandanten hinzuzufügen. Diese Protokolleinträge dienen dazu alle Aktionen die innerhalb eines Mandanten geschehen sind zu protokollieren. Protokolleinträge, die Projekte oder Vorgänge betreffen, werden hier nicht berücksichtigt. Die Bidirektionale Zuordnung des Protokolls zu dem AProtocolEntry-Objekt erfolgt innerhalb dieser Methode.
        Parameters:
        entry - the protocol entry to write
        ec - the enity context to user for writing the protocol entry