AuditControlManager.java
/*
** Module : AuditControlManager.java
** Abstract : Provides AUDIT-CONTROL attributes and methods support
**
** Copyright (c) 2019-2025, Golden Code Development Corporation.
**
**
** -#- -I- --Date-- ----------------------------------------Description---------------------------------------
** 001 IAS 20190506 Created initial version.
** CA 20220610 Don't return null, instead return unknown values, otherwise the the client will abend if
** it calls these unimplemented APIs.
** 002 AS 20250130 Added missing implementation token support.
*/
/*
** This program is free software: you can redistribute it and/or modify
** it under the terms of the GNU Affero General Public License as
** published by the Free Software Foundation, either version 3 of the
** License, or (at your option) any later version.
**
** This program is distributed in the hope that it will be useful,
** but WITHOUT ANY WARRANTY; without even the implied warranty of
** MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
** GNU Affero General Public License for more details.
**
** You may find a copy of the GNU Affero GPL version 3 at the following
** location: https://www.gnu.org/licenses/agpl-3.0.en.html
**
** Additional terms under GNU Affero GPL version 3 section 7:
**
** Under Section 7 of the GNU Affero GPL version 3, the following additional
** terms apply to the works covered under the License. These additional terms
** are non-permissive additional terms allowed under Section 7 of the GNU
** Affero GPL version 3 and may not be removed by you.
**
** 0. Attribution Requirement.
**
** You must preserve all legal notices or author attributions in the covered
** work or Appropriate Legal Notices displayed by works containing the covered
** work. You may not remove from the covered work any author or developer
** credit already included within the covered work.
**
** 1. No License To Use Trademarks.
**
** This license does not grant any license or rights to use the trademarks
** Golden Code, FWD, any Golden Code or FWD logo, or any other trademarks
** of Golden Code Development Corporation. You are not authorized to use the
** name Golden Code, FWD, or the names of any author or contributor, for
** publicity purposes without written authorization.
**
** 2. No Misrepresentation of Affiliation.
**
** You may not represent yourself as Golden Code Development Corporation or FWD.
**
** You may not represent yourself for publicity purposes as associated with
** Golden Code Development Corporation, FWD, or any author or contributor to
** the covered work, without written authorization.
**
** 3. No Misrepresentation of Source or Origin.
**
** You may not represent the covered work as solely your work. All modified
** versions of the covered work must be marked in a reasonable way to make it
** clear that the modified work is not originating from Golden Code Development
** Corporation or FWD. All modified versions must contain the notices of
** attribution required in this license.
*/
package com.goldencode.p2j.util;
import com.goldencode.proxy.*;
/**
* Provides static methods implementing support for the
* AUDIT-CONTROL system handle attributes and methods
* See {@link CommonAuditControl}
*
*/
public class AuditControlManager
{
/** A token used for non repetitive logging of missing setApplContext implementation.
* It is to be removed from the class attributes after the feature is implemented. */
private static volatile Object setApplContextToken = null;
/** A token used for non repetitive logging of missing getApplContextId implementation.
* It is to be removed from the class attributes after the feature is implemented. */
private static volatile Object getApplContextIdToken = null;
/** A token used for non repetitive logging of missing clearApplContext implementation.
* It is to be removed from the class attributes after the feature is implemented. */
private static volatile Object clearApplContextToken = null;
/**
* Get a the instance for the AUDIT-CONTROL system handle. Is obtained using a call to the
* {@link StaticProxy#obtain(Class, Class[])}, using the {@link CommonAuditControl} interface
* and its methods implemented by these classes: {@link AuditPolicyManager}.
*
* @return See above.
*/
public static handle asHandle()
{
// TODO: implement
return new handle();
}
/**
* Implementation of APPL-CONTEXT-ID attribute getter.
* Returns the universally unique identifier (UUID) for the application context in effect for
* the current session, as a Base64 character string.
*
* @return The universally unique identifier (UUID) for the application context.
*/
@LegacyAttribute(name = "APPL-CONTEXT-ID")
public static character getApplContextId()
{
getApplContextIdToken =
UnimplementedFeature.missing("AUDIT-CONTRO:APPL-CONTEXT-ID attribute is not implemented.",
getApplContextIdToken);
return new character();
}
/**
* Implementation of EVENT-GROUP-ID attribute getter.
* Returns the universally unique identifier (UUID) for the audit event group in effect for
* the current session, as a Base64 character string
*
* @return The universally unique identifier (UUID) for the audit event group in effect.
*/
@LegacyAttribute(name = "EVENT-GROUP-ID")
public static character getEventGroupId()
{
UnimplementedFeature.missing("AUDIT-CONTRO:EVENT-GROUP-ID attribute is not implemented.");
return new character();
}
/**
* Implementation of AUDIT-CONTROL:BEGIN-EVENT-GROUP method.
* Indicates (and records) the beginning of a group of related audit events in the current
* session.
*
* @param eventContext
* A character expression that specifies the context for the audit event.
*
* @return This method returns a Base64 character string that specifies the universally unique
* identifier (UUID) of the primary index for all audit event records generated by
* this method for this application context.
*/
@LegacyMethod(name = "BEGIN-EVENT-GROUP")
public static character beginEventGroup(character eventContext)
{
UnimplementedFeature.missing("AUDIT-CONTRO:BEGIN-EVENT-GROUP method is not implemented.");
return new character();
}
/**
* Implementation of AUDIT-CONTROL:BEGIN-EVENT-GROUP method.
* Indicates (and records) the beginning of a group of related audit events in the current
* session.
*
* @param eventContext
* A character expression that specifies the context for the audit event.
* @param eventDetail
* An optional character expression that specifies additional audit detail.
*
* @return This method returns a Base64 character string that specifies the universally unique
* identifier (UUID) of the primary index for all audit event records generated by
* this method for this application context.
*/
@LegacyMethod(name = "BEGIN-EVENT-GROUP")
public static character beginEventGroup(character eventContext, character eventDetail)
{
UnimplementedFeature.missing("AUDIT-CONTRO:BEGIN-EVENT-GROUP method is not implemented.");
return new character();
}
/**
* Implementation of AUDIT-CONTROL:BEGIN-EVENT-GROUP method.
* Indicates (and records) the beginning of a group of related audit events in the current
* session.
*
* @param eventContext
* A character expression that specifies the context for the audit event.
* @param eventDetail
* An optional character expression that specifies additional audit detail.
* @param auditCustomDetail
* An optional character expression that specifies additional user detail.
*
* @return This method returns a Base64 character string that specifies the universally unique
* identifier (UUID) of the primary index for all audit event records generated by
* this method for this application context.
*/
@LegacyMethod(name = "BEGIN-EVENT-GROUP")
public static character beginEventGroup(character eventContext, character eventDetail,
character auditCustomDetail)
{
UnimplementedFeature.missing("AUDIT-CONTRO:BEGIN-EVENT-GROUP method is not implemented.");
return new character();
}
/**
* Implementation of AUDIT-CONTROL:END-EVENT-GROUP method.
* Indicates the end of a group of related events in the current session.
*
* @return <code>true</code> if operation succeeded or
* <code>false</code> otherwise
*/
@LegacyMethod(name = "END-EVENT-GROUP")
public static logical endEventGroup()
{
UnimplementedFeature.missing("AUDIT-CONTRO:END-EVENT-GROUP method is not implemented.");
return new logical();
}
/**
* Implementation of AUDIT-CONTROL:SET-APPL-CONTEXT method.
* Sets (and records) the application context for the current session in each connected
* audit-enabled database whose current audit policy has this audit event enabled.
*
* @param eventContext
* A character expression that specifies the context for the audit event.
*
* @return This method returns a Base64 character string that specifies the universally unique
* identifier (UUID) of the primary index for all audit event records generated by
* this method for this application context.
*/
@LegacyMethod(name = "SET-APPL-CONTEXT")
public static character setApplContext(character eventContext)
{
setApplContextToken =
UnimplementedFeature.missing("AUDIT-CONTRO:SET-APPL-CONTEXT method is not implemented.",
setApplContextToken);
return new character();
}
/**
* Implementation of AUDIT-CONTROL:SET-APPL-CONTEXT method.
* Sets (and records) the application context for the current session in each connected
* audit-enabled database whose current audit policy has this audit event enabled.
*
* @param eventContext
* A character expression that specifies the context for the audit event.
* @param eventDetail
* An optional character expression that specifies additional audit detail.
*
* @return This method returns a Base64 character string that specifies the universally unique
* identifier (UUID) of the primary index for all audit event records generated by
* this method for this application context.
*/
@LegacyMethod(name = "SET-APPL-CONTEXT")
public static character setApplContext(character eventContext, character eventDetail)
{
return setApplContext(eventContext);
}
/**
* Implementation of AUDIT-CONTROL:SET-APPL-CONTEXT method.
* Sets (and records) the application context for the current session in each connected
* audit-enabled database whose current audit policy has this audit event enabled.
*
* @param eventContext
* A character expression that specifies the context for the audit event.
* @param eventDetail
* An optional character expression that specifies additional audit detail.
* @param auditCustomDetail
* An optional character expression that specifies additional user detail.
*
* @return This method returns a Base64 character string that specifies the universally unique
* identifier (UUID) of the primary index for all audit event records generated by
* this method for this application context.
*/
@LegacyMethod(name = "SET-APPL-CONTEXT")
public static character setApplContext(character eventContext, character eventDetail,
character auditCustomDetail)
{
return setApplContext(eventContext);
}
/**
* Implementation of AUDIT-CONTROL:CLEAR-APPL-CONTEXT method.
* Clears the application context for the current session.
*
* @return <code>true</code> if operation succeeded or
* <code>false</code> otherwise
*/
@LegacyMethod(name = "CLEAR-APPL-CONTEXT")
public static logical clearApplContext()
{
clearApplContextToken =
UnimplementedFeature.missing("AUDIT-CONTRO:CLEAR-APPL-CONTEXT method is not implemented.",
clearApplContextToken);
return new logical();
}
/**
* Implementation of AUDIT-CONTROL:LOG-AUDIT-EVENT method.
* Creates an audit record for the specified application-defined audit event in each connected
* audit-enabled database whose current audit policy has this audit event enabled.
*
* @param eventId
* An integer value that specifies an identifier for an application-defined
* audit event.
* @param eventContext
* A character expression that specifies the context for the audit event.
*
* @return A Base64 character string that specifies a universally unique identifier (UUID) as
* the primary index for the generated audit event record.
*/
@LegacyMethod(name = "LOG-AUDIT-EVENT")
public static character logAuditEvent(integer eventId, character eventContext)
{
UnimplementedFeature.missing("AUDIT-CONTRO:LOG-AUDIT-EVENT method is not implemented.");
return new character();
}
/**
* Implementation of AUDIT-CONTROL:LOG-AUDIT-EVENT method.
* Creates an audit record for the specified application-defined audit event in each connected
* audit-enabled database whose current audit policy has this audit event enabled.
*
* @param eventId
* An integer value that specifies an identifier for an application-defined
* audit event.
* @param eventContext
* A character expression that specifies the context for the audit event.
* @param eventDetail
* An optional character expression that specifies additional audit detail.
*
* @return A Base64 character string that specifies a universally unique identifier (UUID) as
* the primary index for the generated audit event record.
*/
@LegacyMethod(name = "LOG-AUDIT-EVENT")
public static character logAuditEvent(integer eventId, character eventContext, character eventDetail)
{
UnimplementedFeature.missing("AUDIT-CONTRO:LOG-AUDIT-EVENT method is not implemented.");
return new character();
}
/**
* Implementation of AUDIT-CONTROL:LOG-AUDIT-EVENT method.
* Creates an audit record for the specified application-defined audit event in each connected
* audit-enabled database whose current audit policy has this audit event enabled.
*
* @param eventId
* An integer value that specifies an identifier for an application-defined
* audit event.
* @param eventContext
* A character expression that specifies the context for the audit event.
* @param eventDetail
* An optional character expression that specifies additional audit detail.
* @param auditCustomDetail
* An optional character expression that specifies additional user detail.
*
* @return A Base64 character string that specifies a universally unique identifier (UUID) as
* the primary index for the generated audit event record.
*/
@LegacyMethod(name = "LOG-AUDIT-EVENT")
public static character logAuditEvent(integer eventId, character eventContext, character eventDetail,
character auditCustomDetail)
{
UnimplementedFeature.missing("AUDIT-CONTRO:LOG-AUDIT-EVENT method is not implemented.");
return new character();
}
}