Class ProtokollUtils

java.lang.Object
de.xima.fc.dao.utils.ProtokollUtils

public class ProtokollUtils extends Object
Utility methods for creating AProtocolEntrys and saving them in the database. Takes care of ensuring that important pieces of information are set, such as AProtocolEntry.getBenutzer() or AProtocolEntry.getErstellungsDatum(). Also handles the case when a client is about to be deleted, no more protocol entries should be created then.
Author:
XIMA MEDIA GmbH
  • Field Details

    • INST

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

    • 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.
    • addProjectActivationChangedProtocolEntry

      public void addProjectActivationChangedProtocolEntry(Projekt project, IUser user, IEntityContext ec, boolean isActiveNow, boolean wasPreviouslyActive)
      Creates a log entry indicating whether a project has been switched online or offline. A log entry is created only if there has been a change in the project's status, i.e., from offline to online.
      Parameters:
      project - the project
      user - User who initiated the update.
      ec - An entity context for interacting with the database.
      isActiveNow - the current status of the project. True indicates that the project is now online, while false indicates it is offline.
      wasPreviouslyActive - the previous status of the project before the current status change. True indicates the project was online, and false indicates it was offline.
    • addSaveInvalidWorkflowProtocolEntry

      public void addSaveInvalidWorkflowProtocolEntry(Projekt project, IUser user, IEntityContext ec)
      Creates a log entry indicating whether a project's workflow is invalid and has been saved anyway. This puts the project into maintenance mode.
      Parameters:
      project - the project
      user - User who initiated the update.
      ec - An entity context for interacting with the database.
    • addFSChangedFromProjectProtocolEntry

      public void addFSChangedFromProjectProtocolEntry(Projekt project, List<MandantFrontendServer> changedFrontendServers, IUser user, IEntityContext ec, boolean isDelete)
      Creates a log entry that shows when the assigned frontend servers of a project have changed.
      Parameters:
      project - the project
      changedFrontendServers - a list of frontend servers which got removed or added to the project
      user - User who initiated the update.
      ec - An entity context for interacting with the database
      isDelete - when the frontend servers got removed from the project
    • addChangeAllFormsForFSProtocolEntry

      public void addChangeAllFormsForFSProtocolEntry(MandantFrontendServer frontendServer, IUser user, IEntityContext ec, boolean isDelete)
      Creates a log entry that shows when the release of all forms for a frontend server has changed.
      Parameters:
      frontendServer - the frontend server which got changed
      user - User who initiated the update.
      ec - An entity context for interacting with the database
      isDelete - If the release of all forms has been removed
    • addFSAutomaticAddedToFormProtocolEntry

      public void addFSAutomaticAddedToFormProtocolEntry(MandantFrontendServer frontendServer, Projekt project, IUser user, IEntityContext ec)
      Creates a log entry that shows when a form has been automatically released for a frontend server.
      Parameters:
      frontendServer - which got automatically added
      project - the project
      user - User who initiated the update.
      ec - An entity context for interacting with the database
    • 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.
    • addProcessProtocolEntry

      public void addProcessProtocolEntry(Mandant client, ProcessProtocolParams params, ProtocolEntryProcessing entry, IEntityContext ec)
      Fills in missing pieces of information of a ProtocolEntryProcessing, and saves that entry in the database.
      Parameters:
      client - The client for which to create the protocol entry.
      params - Additional details for the protocol entry. Specific data such as AProtocolEntry.getBemerkung() should be set.
      entry - The protocol entry to save.
      ec - An entity context for interacting with the database.
    • addSystemProtocolEntry

      public void addSystemProtocolEntry(ProtocolEntrySystem entry, IEntityContext ec)
      Fills in missing pieces of information of a ProtocolEntrySystem, and saves that entry in the database.
      Parameters:
      entry - The protocol entry to save. Specific data such as AProtocolEntry.getBemerkung() should be set.
      ec - An entity context for interacting with the database.
    • 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
    • getNewFormVersionPe

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

      @Deprecated public void addProjektPeBase(Projekt projekt, ProtocolEntryClient entry, IEntityContext ec)
      Diese Methode dient dazu, einen Protokolleintrag zu einem Mandanten hinzuzufügen, wobei der Ausgangspunkt eine Projekt-Instanz ist. Die Methode ruft intern AProtocolEntry.setProjektName(String) auf, und setzt den Wert auf den Namen des Projekts. Der Mandant für die Abhängigkeit wird implizit gesetzt
      Parameters:
      projekt - - Projekt-Instanz, dessen Projektname innerhalb des Protokolleintrags verwendet wird
      entry - - Der Protokolleintrag der angelegt werden soll
      ec - - EntityContext der genutzt wird um Abfragen zu tätigen und den Protokolleintrag zu persistieren
    • addMandantNameToDelete

      @Deprecated public void addMandantNameToDelete(String mandantName)
      Parameters:
      mandantName - the name of the client
    • removeMandantNameToDelete

      @Deprecated public void removeMandantNameToDelete(String mandantName)
      Parameters:
      mandantName - the name of the client
    • 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
    • addVorgangPeBase

      @Deprecated public void addVorgangPeBase(Vorgang vorgang, ProtocolEntryProcessing entry, IEntityContext ec)
      Diese Methode dient dazu, einen Protokolleintrag zu einem Mandanten hinzuzufügen, wobei der Ausgangspunkt eine Vorgang-Instanz ist. Die Methode ruft intern ProtocolEntryProcessing.setVorgangId(String) auf, und setzt den Wert auf die Prozess-Id des Vorgangs. Der Mandant für die Abhängigkeit wird implizit gesetzt
      Parameters:
      vorgang - - Vorgang-Instanz, dessen Prozess-Id innerhalb des Protokolleintrags verwendet wird
      entry - - Der Protokolleintrag der angelegt werden soll
      ec - - EntityContext der genutzt wird um Abfragen zu tätigen und den Protokolleintrag zu persistieren
    • addTriggerFiredProtocolEntry

      @Deprecated public void addTriggerFiredProtocolEntry(IEntityContext ec, Mandant client, Benutzer 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.
    • addStateChangeProtocolEntry

      @Deprecated public void addStateChangeProtocolEntry(IEntityContext ec, Mandant client, Benutzer 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.
    • 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
    • getProcessLogEntries

      public List<ProtocolEntryProcessing> getProcessLogEntries(Vorgang formRecord, IEntityContext ec)