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
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
addMalwareDetectedProtocolEntry(IEntityContext ec, Benutzer user, String scannedItem, MalwareScanReport report)
Adds a system protocol entry when malware was detected in a file or some data.void
addMalwareDetectedProtocolEntry(IEntityContext ec, Benutzer 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, Benutzer 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
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
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
addStateChangeProtocolEntry(IEntityContext ec, Mandant client, Benutzer 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)
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)
Generates a protocol entry for indicating that a new Form version has been createdvoid
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
-
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
-
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.
-
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
-
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.
-
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
-
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.
-
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
-
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, 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, useUserMgmtUtils.ANONYMOUS
when that is not desired.formRecord
- Form record for which the trigger was fired.task
- Task with the trigger that was fired.
-
addMalwareDetectedProtocolEntry
public void addMalwareDetectedProtocolEntry(IEntityContext ec, Benutzer 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, Benutzer 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, Benutzer 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, Benutzer 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.
-
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
-
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(Benutzer user, FormVersion formversion)
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
-
-