
public class BusinessEventSender
{
private static boolean isDisabled;
public static boolean isDisabled(boolean _isDisabled = isDisabled)
{
isDisabled = _isDisabled;
return isDisabled;
}
public static void sendBusinessEvent(DirPartyRecId _RecId)
{
//logic
}
}
[ExtensionOf(tableStr(DirPartyLocation))]
final class DirPartyLocationTable_Extension
{
public void update()
{
ttsbegin;
DirPartyLocation dirPartyLocationOld = this.orig();
next update();
if(!BusinessEventSender::isDisabled())
{
BusinessEventSender::sendBusinessEvent(this.Party);
}
ttscommit;
}
}
[ExtensionOf(tableStr(ContactPerson))]
final class ContactPerson_Extension
{
public void insert(boolean _updateDateAndTime, Name _name)
{
ttsbegin;
next insert(_updateDateAndTime, _name);
BusinessEventSender::isDisabled(true);
BusinessEventSender::sendBusinessEvent(this.ContactForParty);
ttscommit;
}
public void delete()
{
ttsbegin;
if (this.conditionMet())
{
BusinessEventSender::sendBusinessEvent(this.ContactForParty);
}
next delete();
ttscommit;
}
}