Wednesday, 29 May 2019

SysOperation-Framework: Initalize parameters of a data contract

If you include the SysOperationInitializable class in a data contract using the implements command, the method initialize() gets available and can be overwritten.
This method can be used to initialize variables within the data contract. However, this method is only called as long as no usage data is found or it is not activated.
[DataContractAttribute]
class TutorialSysOperationDataContract
    implements SysOperationInitializable
{
    date dialogDate;
}

[DataMemberAttribute]
public TransDate parmDialogDate(TransDate _dialogDate = dialogDate)
{
    dialogDate = _dialogDate;
    return dialogDate;
}

public void initialize()
{
    dialogDate = systemDateGet() - 365;
}

If you want the initalize() to always be called, you must extend the DataContract with the attribute SysOperationAlwaysInitializeAttribute.
[DataContractAttribute, SysOperationAlwaysInitializeAttribute]
class TutorialSysOperationDataContract
    implements SysOperationInitializable
{
    date dialogDate;
}

No comments:

Post a Comment