LogEvent.java
/*
** Module : LogEvent.java
** Abstract : Implementation of the OpenEdge.Logging.LogEvent builtin class.
**
** Copyright (c) 2025, Golden Code Development Corporation.
**
** -#- -I- --Date-- -------------------------------Description--------------------------------
** 001 ICP 20250313 First version.
*/
/*
** 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.oo.logging;
import com.goldencode.p2j.oo.lang.*;
import com.goldencode.p2j.util.*;
import static com.goldencode.p2j.report.ReportConstants.*;
import static com.goldencode.p2j.util.ArrayAssigner.*;
import static com.goldencode.p2j.util.BlockManager.*;
import static com.goldencode.p2j.util.InternalEntry.*;
/**
* Implementation of the OpenEdge.Logging.LogEvent builtin class.
*/
@LegacyResource(resource = "OpenEdge.Logging.LogEvent")
@LegacyResourceSupport(supportLvl = CVT_LVL_FULL | RT_LVL_STUB)
public class LogEvent
extends BaseObject
{
@LegacySignature(type = Type.PROPERTY, name = "Logger")
@LegacyResourceSupport(supportLvl = CVT_LVL_FULL | RT_LVL_STUB)
private object<? extends IlogWriter> logger = TypeFactory.object(IlogWriter.class);
@LegacySignature(type = Type.PROPERTY, name = "LoggerName")
@LegacyResourceSupport(supportLvl = CVT_LVL_FULL | RT_LVL_STUB)
private character loggerName = TypeFactory.character();
@LegacySignature(type = Type.PROPERTY, name = "LogLevel")
@LegacyResourceSupport(supportLvl = CVT_LVL_FULL | RT_LVL_STUB)
private object<? extends LogLevelEnum> logLevel = TypeFactory.object(LogLevelEnum.class);
@LegacySignature(type = Type.PROPERTY, name = "TimeStamp")
@LegacyResourceSupport(supportLvl = CVT_LVL_FULL | RT_LVL_STUB)
private datetimetz timeStamp = TypeFactory.datetimetz();
@LegacySignature(type = Type.PROPERTY, name = "Message")
@LegacyResourceSupport(supportLvl = CVT_LVL_FULL | RT_LVL_STUB)
private object<? extends LogMessage> message = TypeFactory.object(LogMessage.class);
@LegacySignature(type = Type.PROPERTY, name = "Error")
@LegacyResourceSupport(supportLvl = CVT_LVL_FULL | RT_LVL_STUB)
private object<? extends LegacyError> error = TypeFactory.object(LegacyError.class);
@LegacySignature(type = Type.PROPERTY, extent = -1, name = "CallStack")
@LegacyResourceSupport(supportLvl = CVT_LVL_FULL | RT_LVL_STUB)
private character[] callStack = TypeFactory.characterExtent();
@LegacySignature(type = Type.PROPERTY, name = "LoggedBy")
@LegacyResourceSupport(supportLvl = CVT_LVL_FULL | RT_LVL_STUB)
private handle loggedBy = TypeFactory.handle();
@LegacySignature(type = Type.PROPERTY, name = "LoggerShortName")
@LegacyResourceSupport(supportLvl = CVT_LVL_FULL | RT_LVL_STUB)
private character loggerShortName = TypeFactory.character();
@LegacySignature(type = Type.PROPERTY, name = "ShortNameFormat")
@LegacyResourceSupport(supportLvl = CVT_LVL_FULL | RT_LVL_STUB)
private character shortNameFormat = TypeFactory.character();
@LegacySignature(type = Type.CONSTRUCTOR, name = "LogEvent", parameters =
{
@LegacyParameter(name = "poLevel", type = "OBJECT", qualified = "openedge.logging.loglevelenum", mode = "INPUT"),
@LegacyParameter(name = "poMessage", type = "OBJECT", qualified = "openedge.logging.logmessage", mode = "INPUT"),
@LegacyParameter(name = "poError", type = "OBJECT", qualified = "progress.lang.error", mode = "INPUT"),
@LegacyParameter(name = "ptTimeStamp", type = "DATETIMETZ", mode = "INPUT")
})
@LegacyResourceSupport(supportLvl = CVT_LVL_FULL | RT_LVL_STUB)
public void __logging_logEvent_constructor__(final object<? extends LogLevelEnum> _poLevel, final object<? extends LogMessage> _poMessage, final object<? extends LegacyError> _poError, final datetimetz _ptTimeStamp)
{
object<? extends LogLevelEnum> poLevel = TypeFactory.initInput(_poLevel);
object<? extends LogMessage> poMessage = TypeFactory.initInput(_poMessage);
object<? extends LegacyError> poError = TypeFactory.initInput(_poError);
datetimetz ptTimeStamp = TypeFactory.initInput(_ptTimeStamp);
internalProcedure(LogEvent.class, this, "LogEvent", new Block((Body) () ->
{
__lang_BaseObject_constructor__();
}));
}
@LegacySignature(type = Type.CONSTRUCTOR, name = "LogEvent", parameters =
{
@LegacyParameter(name = "poLevel", type = "OBJECT", qualified = "openedge.logging.loglevelenum", mode = "INPUT"),
@LegacyParameter(name = "poMessage", type = "OBJECT", qualified = "openedge.logging.logmessage", mode = "INPUT"),
@LegacyParameter(name = "ptTimeStamp", type = "DATETIMETZ", mode = "INPUT")
})
@LegacyResourceSupport(supportLvl = CVT_LVL_FULL | RT_LVL_STUB)
public void __logging_logEvent_constructor__(final object<? extends LogLevelEnum> _poLevel, final object<? extends LogMessage> _poMessage, final datetimetz _ptTimeStamp)
{
object<? extends LogLevelEnum> poLevel = TypeFactory.initInput(_poLevel);
object<? extends LogMessage> poMessage = TypeFactory.initInput(_poMessage);
datetimetz ptTimeStamp = TypeFactory.initInput(_ptTimeStamp);
internalProcedure(LogEvent.class, this, "LogEvent", new Block((Body) () ->
{
__lang_BaseObject_constructor__();
}));
}
@LegacySignature(type = Type.CONSTRUCTOR, name = "LogEvent", parameters =
{
@LegacyParameter(name = "poLevel", type = "OBJECT", qualified = "openedge.logging.loglevelenum", mode = "INPUT"),
@LegacyParameter(name = "poMessage", type = "OBJECT", qualified = "openedge.logging.logmessage", mode = "INPUT"),
@LegacyParameter(name = "poError", type = "OBJECT", qualified = "progress.lang.error", mode = "INPUT")
})
@LegacyResourceSupport(supportLvl = CVT_LVL_FULL | RT_LVL_STUB)
public void __logging_logEvent_constructor__(final object<? extends LogLevelEnum> _poLevel, final object<? extends LogMessage> _poMessage, final object<? extends LegacyError> _poError)
{
object<? extends LogLevelEnum> poLevel = TypeFactory.initInput(_poLevel);
object<? extends LogMessage> poMessage = TypeFactory.initInput(_poMessage);
object<? extends LegacyError> poError = TypeFactory.initInput(_poError);
internalProcedure(LogEvent.class, this, "LogEvent", new Block((Body) () ->
{
__lang_BaseObject_constructor__();
}));
}
@LegacySignature(type = Type.CONSTRUCTOR, name = "LogEvent", parameters =
{
@LegacyParameter(name = "poLevel", type = "OBJECT", qualified = "openedge.logging.loglevelenum", mode = "INPUT"),
@LegacyParameter(name = "poMessage", type = "OBJECT", qualified = "openedge.logging.logmessage", mode = "INPUT")
})
@LegacyResourceSupport(supportLvl = CVT_LVL_FULL | RT_LVL_STUB)
public void __logging_logEvent_constructor__(final object<? extends LogLevelEnum> _poLevel, final object<? extends LogMessage> _poMessage)
{
object<? extends LogLevelEnum> poLevel = TypeFactory.initInput(_poLevel);
object<? extends LogMessage> poMessage = TypeFactory.initInput(_poMessage);
internalProcedure(LogEvent.class, this, "LogEvent", new Block((Body) () ->
{
__lang_BaseObject_constructor__();
}));
}
@LegacySignature(type = Type.GETTER, name = "Logger", returns = "OBJECT", qualified = "openedge.logging.ilogwriter")
@LegacyResourceSupport(supportLvl = CVT_LVL_FULL | RT_LVL_STUB)
public object<? extends IlogWriter> getLogger()
{
return function(LogEvent.class, this, "Logger", object.class, new Block((Body) () ->
{
storeReturnValue(logger);
}));
}
@LegacySignature(type = Type.SETTER, name = "Logger", parameters =
{
@LegacyParameter(name = "var", type = "OBJECT", qualified = "openedge.logging.ilogwriter", mode = "INPUT")
})
@LegacyResourceSupport(supportLvl = CVT_LVL_FULL | RT_LVL_STUB)
public void setLogger(final object<? extends IlogWriter> _var)
{
object<? extends IlogWriter> var = TypeFactory.initInput(_var);
internalProcedure(LogEvent.class, this, "Logger", new Block((Body) () ->
{
logger.assign(var);
}));
}
@LegacySignature(type = Type.GETTER, name = "LoggerName", returns = "CHARACTER")
@LegacyResourceSupport(supportLvl = CVT_LVL_FULL | RT_LVL_STUB)
public character getLoggerName()
{
return loggerName.duplicate();
}
@LegacySignature(type = Type.SETTER, name = "LoggerName", parameters =
{
@LegacyParameter(name = "var", type = "CHARACTER", mode = "INPUT")
})
@LegacyResourceSupport(supportLvl = CVT_LVL_FULL | RT_LVL_STUB)
public void setLoggerName(character var)
{
loggerName.assign(var);
}
@LegacySignature(type = Type.GETTER, name = "LogLevel", returns = "OBJECT", qualified = "openedge.logging.loglevelenum")
@LegacyResourceSupport(supportLvl = CVT_LVL_FULL | RT_LVL_STUB)
public object<? extends LogLevelEnum> getLogLevel()
{
return function(LogEvent.class, this, "LogLevel", object.class, new Block((Body) () ->
{
storeReturnValue(logLevel);
}));
}
@LegacySignature(type = Type.SETTER, name = "LogLevel", parameters =
{
@LegacyParameter(name = "var", type = "OBJECT", qualified = "openedge.logging.loglevelenum", mode = "INPUT")
})
@LegacyResourceSupport(supportLvl = CVT_LVL_FULL | RT_LVL_STUB)
private void setLogLevel(final object<? extends LogLevelEnum> _var)
{
object<? extends LogLevelEnum> var = TypeFactory.initInput(_var);
internalProcedure(LogEvent.class, this, "LogLevel", new Block((Body) () ->
{
logLevel.assign(var);
}));
}
@LegacySignature(type = Type.GETTER, name = "TimeStamp", returns = "DATETIMETZ")
@LegacyResourceSupport(supportLvl = CVT_LVL_FULL | RT_LVL_STUB)
public datetimetz getTimeStamp()
{
return timeStamp.duplicate();
}
@LegacySignature(type = Type.SETTER, name = "TimeStamp", parameters =
{
@LegacyParameter(name = "var", type = "DATETIMETZ", mode = "INPUT")
})
@LegacyResourceSupport(supportLvl = CVT_LVL_FULL | RT_LVL_STUB)
private void setTimeStamp(datetimetz var)
{
timeStamp.assign(var);
}
@LegacySignature(type = Type.GETTER, name = "Message", returns = "OBJECT", qualified = "openedge.logging.logmessage")
@LegacyResourceSupport(supportLvl = CVT_LVL_FULL | RT_LVL_STUB)
public object<? extends LogMessage> getMessage()
{
return function(LogEvent.class, this, "Message", object.class, new Block((Body) () ->
{
storeReturnValue(message);
}));
}
@LegacySignature(type = Type.SETTER, name = "Message", parameters =
{
@LegacyParameter(name = "var", type = "OBJECT", qualified = "openedge.logging.logmessage", mode = "INPUT")
})
@LegacyResourceSupport(supportLvl = CVT_LVL_FULL | RT_LVL_STUB)
private void setMessage(final object<? extends LogMessage> _var)
{
object<? extends LogMessage> var = TypeFactory.initInput(_var);
internalProcedure(LogEvent.class, this, "Message", new Block((Body) () ->
{
message.assign(var);
}));
}
@LegacySignature(type = Type.GETTER, name = "Error", returns = "OBJECT", qualified = "progress.lang.error")
@LegacyResourceSupport(supportLvl = CVT_LVL_FULL | RT_LVL_STUB)
public object<? extends LegacyError> getError()
{
return function(LogEvent.class, this, "Error", object.class, new Block((Body) () ->
{
storeReturnValue(error);
}));
}
@LegacySignature(type = Type.SETTER, name = "Error", parameters =
{
@LegacyParameter(name = "var", type = "OBJECT", qualified = "progress.lang.error", mode = "INPUT")
})
@LegacyResourceSupport(supportLvl = CVT_LVL_FULL | RT_LVL_STUB)
private void setError(final object<? extends LegacyError> _var)
{
object<? extends LegacyError> var = TypeFactory.initInput(_var);
internalProcedure(LogEvent.class, this, "Error", new Block((Body) () ->
{
error.assign(var);
}));
}
@LegacySignature(type = Type.GETTER, name = "CallStack", returns = "CHARACTER", parameters =
{
@LegacyParameter(name = "idx", type = "INT64", mode = "INPUT")
})
@LegacyResourceSupport(supportLvl = CVT_LVL_FULL | RT_LVL_STUB)
public character getCallStack(final int64 _idx)
{
int64 idx = TypeFactory.initInput(_idx);
return function(LogEvent.class, this, "CallStack", character.class, new Block((Body) () ->
{
storeReturnValue(subscript(callStack, idx));
}));
}
@LegacySignature(type = Type.SETTER, name = "CallStack", parameters =
{
@LegacyParameter(name = "var", type = "CHARACTER", mode = "INPUT"),
@LegacyParameter(name = "idx", type = "INT64", mode = "INPUT")
})
@LegacyResourceSupport(supportLvl = CVT_LVL_FULL | RT_LVL_STUB)
private void setCallStack(final character _var, final int64 _idx)
{
character var = TypeFactory.initInput(_var);
int64 idx = TypeFactory.initInput(_idx);
internalProcedure(LogEvent.class, this, "CallStack", new Block((Body) () ->
{
assignSingle(callStack, idx, var);
}));
}
@LegacySignature(type = Type.GETTER, name = "CallStack", extent = -1, returns = "CHARACTER")
@LegacyResourceSupport(supportLvl = CVT_LVL_FULL | RT_LVL_STUB)
public character[] bulkGetCallStack()
{
return extentFunction(LogEvent.class, this, "CallStack", character.class, new Block((Body) () ->
{
storeExtentReturnValue(callStack);
}));
}
@LegacySignature(type = Type.SETTER, name = "CallStack", parameters =
{
@LegacyParameter(name = "var", type = "CHARACTER", extent = -1, mode = "INPUT")
})
@LegacyResourceSupport(supportLvl = CVT_LVL_FULL | RT_LVL_STUB)
private void bulkSetCallStack(final character[] _var)
{
character[] var[] =
{
TypeFactory.initInput(_var)
};
internalProcedure(LogEvent.class, this, "CallStack", new Block((Body) () ->
{
callStack = (character[]) assignMulti(callStack, var[0]);
}));
}
@LegacySignature(type = Type.SETTER, name = "CallStack", parameters =
{
@LegacyParameter(name = "var", type = "CHARACTER", mode = "INPUT")
})
@LegacyResourceSupport(supportLvl = CVT_LVL_FULL | RT_LVL_STUB)
private void setAllCallStack(final character _var)
{
character var = TypeFactory.initInput(_var);
internalProcedure(LogEvent.class, this, "CallStack", new Block((Body) () ->
{
assignMulti(callStack, var);
}));
}
@LegacySignature(type = Type.LENGTH, name = "CallStack", returns = "INTEGER")
@LegacyResourceSupport(supportLvl = CVT_LVL_FULL | RT_LVL_STUB)
public integer lengthOfCallStack()
{
return function(LogEvent.class, this, "length-of-CallStack", integer.class, new Block((Body) () ->
{
storeReturnValue(ArrayAssigner.lengthOf(callStack));
}));
}
@LegacySignature(type = Type.RESIZE, name = "CallStack", parameters =
{
@LegacyParameter(name = "size", type = "INT64", mode = "INPUT")
})
@LegacyResourceSupport(supportLvl = CVT_LVL_FULL | RT_LVL_STUB)
public void resizeCallStack(final int64 _size)
{
int64 size = TypeFactory.initInput(_size);
internalProcedure(LogEvent.class, this, "resize-CallStack", new Block((Body) () ->
{
callStack = ArrayAssigner.resize(callStack, size);
}));
}
@LegacySignature(type = Type.GETTER, name = "LoggedBy", returns = "HANDLE")
@LegacyResourceSupport(supportLvl = CVT_LVL_FULL | RT_LVL_STUB)
public handle getLoggedBy()
{
return loggedBy.duplicate();
}
@LegacySignature(type = Type.SETTER, name = "LoggedBy", parameters =
{
@LegacyParameter(name = "var", type = "HANDLE", mode = "INPUT")
})
@LegacyResourceSupport(supportLvl = CVT_LVL_FULL | RT_LVL_STUB)
public void setLoggedBy(handle var)
{
loggedBy.assign(var);
}
@LegacySignature(type = Type.GETTER, name = "LoggerShortName", returns = "CHARACTER")
@LegacyResourceSupport(supportLvl = CVT_LVL_FULL | RT_LVL_STUB)
public character getLoggerShortName()
{
return loggerShortName.duplicate();
}
@LegacySignature(type = Type.SETTER, name = "LoggerShortName", parameters =
{
@LegacyParameter(name = "var", type = "CHARACTER", mode = "INPUT")
})
@LegacyResourceSupport(supportLvl = CVT_LVL_FULL | RT_LVL_STUB)
public void setLoggerShortName(character var)
{
loggerShortName.assign(var);
}
@LegacySignature(type = Type.GETTER, name = "ShortNameFormat", returns = "CHARACTER")
@LegacyResourceSupport(supportLvl = CVT_LVL_FULL | RT_LVL_STUB)
public character getShortNameFormat()
{
return shortNameFormat.duplicate();
}
@LegacySignature(type = Type.SETTER, name = "ShortNameFormat", parameters =
{
@LegacyParameter(name = "var", type = "CHARACTER", mode = "INPUT")
})
@LegacyResourceSupport(supportLvl = CVT_LVL_FULL | RT_LVL_STUB)
public void setShortNameFormat(character var)
{
shortNameFormat.assign(var);
}
}