Package de.xima.fc.dao.utils
Class ProtokollUtils
- java.lang.Object
-
- de.xima.fc.dao.utils.ProtokollUtils
-
public class ProtokollUtils extends Object
Utility methods for creatingAProtocolEntry
s and saving them in the database. Takes care of ensuring that important pieces of information are set, such asAProtocolEntry.getBenutzer()
orAProtocolEntry.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 Summary
Fields Modifier and Type Field Description static ProtokollUtils
INST
The singleton instance of this utility class.
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Deprecated Methods Modifier and Type Method Description 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.void
addClientProtocolEntry(Mandant client, ProtocolEntryClient entry, IEntityContext ec)
Fills in missing pieces of information of aProtocolEntryClient
, and saves that entry in the database.void
addClientUUIDToDelete(String clientUUID)
Marks a client for which no protocol entries should be created.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.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.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.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.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.void
addMandantNameToDelete(String mandantName)
Deprecated.void
addMandantPeBase(Mandant mandant, ProtocolEntryClient entry, IEntityContext ec)
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.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.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.void
addProcessProtocolEntry(Mandant client, ProcessProtocolParams params, ProtocolEntryProcessing entry, IEntityContext ec)
Fills in missing pieces of information of aProtocolEntryProcessing
, and saves that entry in the database.void
addProcessProtocolEntry(Vorgang formRecord, ProtocolEntryProcessing entry, IEntityContext ec)
Fills in missing pieces of information of aProtocolEntryProcessing
, and saves that entry in the database.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.void
addProjectProtocolEntry(Projekt project, ProtocolEntryClient entry, IEntityContext ec)
Fills in missing pieces of information of aProtocolEntryClient
for a certain form, and saves that entry in the database.void
addProjektPeBase(Projekt projekt, ProtocolEntryClient entry, IEntityContext ec)
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.void
addStateChangeProtocolEntry(IEntityContext ec, Mandant client, Benutzer user, Vorgang formRecord, WorkflowState oldState, WorkflowState newState)
Deprecated.void
addStateChangeProtocolEntry(IEntityContext ec, Mandant client, IUser user, Vorgang formRecord, WorkflowState oldState, WorkflowState newState)
Adds a protocol entry for a state change, i.e.void
addSystemPeDokumentation(ProtocolEntrySystem entry, IEntityContext ec)
Deprecated.void
addSystemProtocolEntry(ProtocolEntrySystem entry, IEntityContext ec)
Fills in missing pieces of information of aProtocolEntrySystem
, and saves that entry in the database.void
addTriggerFiredProtocolEntry(IEntityContext ec, Mandant client, Benutzer user, Vorgang formRecord, WorkflowTask task)
Deprecated.void
addTriggerFiredProtocolEntry(IEntityContext ec, Mandant client, IUser user, Vorgang formRecord, WorkflowTask task)
Adds the protocol entry for when a workflow trigger was fired.void
addVorgangPeBase(Vorgang vorgang, ProtocolEntryProcessing entry, IEntityContext ec)
static ProtocolEntryClient
getNewFormVersionPe(Benutzer user, FormVersion formversion)
Deprecated.static ProtocolEntryClient
getNewFormVersionPe(IUser user, FormVersion formversion)
Generates a protocol entry for indicating that a new Form version has been createdList<ProtocolEntryProcessing>
getProcessLogEntries(Vorgang formRecord, IEntityContext ec)
void
removeClientUUIDToDelete(String clientUUID)
Unmarks a client and allows protocol entries for the client to be created again.void
removeMandantNameToDelete(String mandantName)
Deprecated.<T extends AProtocolEntry>
TtogglePreserveFlag(T entry, IEntityContext ec)
Negates theAProtocolEntry.isPreserve()
flag of the given entry and saves the modifications to the database.
-
-
-
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 afteraddClientUUIDToDelete(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
- TheMandant.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 aProtocolEntryClient
, 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 asAProtocolEntry.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 theAProtocolEntry.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 projectuser
- 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 projectuser
- 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 projectchangedFrontendServers
- a list of frontend servers which got removed or added to the projectuser
- User who initiated the update.ec
- An entity context for interacting with the databaseisDelete
- 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 changeduser
- User who initiated the update.ec
- An entity context for interacting with the databaseisDelete
- 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 addedproject
- the projectuser
- 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 aProtocolEntryClient
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 asAProtocolEntry.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 aProtocolEntryProcessing
, 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 asAProtocolEntry.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, useUserMgmtUtils.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. WhenMalwareScanReport.isSafe()
istrue
, 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. WhenMalwareScanReport.isSafe()
istrue
, 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. WhenMalwareScanReport.isSafe()
istrue
, 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 theVorgang.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, useUserMgmtUtils.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 aProtocolEntryProcessing
, 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 asAProtocolEntry.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 aProtocolEntrySystem
, and saves that entry in the database.- Parameters:
entry
- The protocol entry to save. Specific data such asAProtocolEntry.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 versionformversion
-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 versionformversion
-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 eineProjekt
-Instanz ist. Die Methode ruft internAProtocolEntry.setProjektName(String)
auf, und setzt den Wert auf den Namen des Projekts. DerMandant
für die Abhängigkeit wird implizit gesetzt- Parameters:
projekt
- -Projekt
-Instanz, dessen Projektname innerhalb des Protokolleintrags verwendet wirdentry
- - Der Protokolleintrag der angelegt werden sollec
- -EntityContext
der genutzt wird um Abfragen zu tätigen und den Protokolleintrag zu persistieren
-
addMandantNameToDelete
@Deprecated public void addMandantNameToDelete(String mandantName)
Deprecated.- Parameters:
mandantName
- the name of the client
-
removeMandantNameToDelete
@Deprecated public void removeMandantNameToDelete(String mandantName)
Deprecated.- 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 demAProtocolEntry
-Objekt erfolgt innerhalb dieser Methode.- Parameters:
mandant
- -Mandant
-Instanz, für welchen der Eintrag angelegt werden sollentry
- - Der Protokolleintrag der angelegt werden sollec
- -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 eineVorgang
-Instanz ist. Die Methode ruft internProtocolEntryProcessing.setVorgangId(String)
auf, und setzt den Wert auf die Prozess-Id desVorgang
s. DerMandant
für die Abhängigkeit wird implizit gesetzt- Parameters:
vorgang
- -Vorgang
-Instanz, dessen Prozess-Id innerhalb des Protokolleintrags verwendet wirdentry
- - Der Protokolleintrag der angelegt werden sollec
- -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)
Deprecated.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, useUserMgmtUtils.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)
Deprecated.Adds a protocol entry for a state change, i.e. when theVorgang.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, useUserMgmtUtils.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)
Deprecated.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 demAProtocolEntry
-Objekt erfolgt innerhalb dieser Methode.- Parameters:
entry
- the protocol entry to writeec
- the enity context to user for writing the protocol entry
-
getProcessLogEntries
public List<ProtocolEntryProcessing> getProcessLogEntries(Vorgang formRecord, IEntityContext ec)
-
-