com.sap.cds.repackaged.audit.client.impl.DataModificationMessageImpl Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of cds-feature-auditlog-v2 Show documentation
Show all versions of cds-feature-auditlog-v2 Show documentation
Handler to send auditlog messages to AuditLog Service V2
package com.sap.cds.repackaged.audit.client.impl;
import java.util.UUID;
import com.sap.cds.repackaged.audit.api.DataModificationAuditMessage;
import com.sap.cds.repackaged.audit.api.exception.AuditLogNotAvailableException;
import com.sap.cds.repackaged.audit.api.exception.AuditLogWriteException;
import com.sap.xs.audit.message.DataModification;
/**
* This class implements the main audit log message interfaces, and encapsulates the formating functionality of the
* audit log messages. This object is not thread safe thus in case of parallel threads its access need to be
* synchronized.
*
*/
@Deprecated
public class DataModificationMessageImpl extends TransactionalLogImpl implements DataModificationAuditMessage {
public DataModificationMessageImpl(AuditLogMessageFactoryImpl factory) {
super(factory);
this.endpoint = factory.getServiceUrl() + "data-modifications";
message = new DataModification();
message.setUuid(UUID.randomUUID().toString());
}
@Override
public void setObjectId(String objectId) {
ensureNotLogged();
message.setObjectId(objectId);;
}
@Override
public void addAttribute(String name, boolean isSuccessful) {
ensureNotLogged();
message.addAttribute(name, isSuccessful);
}
@Override
public void addAttribute(String name, String oldValue, String newValue) {
ensureNotLogged();
message.addAttribute(name, oldValue, newValue, null);
}
@Override
public void log() throws AuditLogNotAvailableException, AuditLogWriteException {
logSuccess();
}
}