protected virtual ServiceResult OnUnshelve(
ISystemContext context,
MethodState method,
IList<object> inputArguments,
IList<object> outputArguments)
{
ServiceResult error = null;
try
{
if (!this.EnabledState.Id.Value)
{
return error = StatusCodes.BadConditionDisabled;
}
if (!this.ShelvingState.IsCausePermitted(context, Methods.ShelvedStateMachineType_Unshelve, false))
{
return error = StatusCodes.BadConditionNotShelved;
}
if (OnShelve == null)
{
return error = StatusCodes.BadNotSupported;
}
error = OnShelve(context, this, false, false, 0);
// report a state change event.
if (ServiceResult.IsGood(error))
{
ReportStateChange(context, false);
}
}
finally
{
// raise the audit event.
if (this.AreEventsMonitored)
{
AuditConditionShelvingEventState e = new AuditConditionShelvingEventState(null);
TranslationInfo info = new TranslationInfo(
"AuditConditionUnshelve",
"en-US",
"The Unshelve method was called.");
e.Initialize(
context,
this,
EventSeverity.Low,
new LocalizedText(info),
ServiceResult.IsGood(error),
DateTime.UtcNow);
e.SourceName.Value = "Attribute/Call";
e.MethodId = new PropertyState<NodeId>(e);
e.MethodId.Value = method.NodeId;
ReportEvent(context, e);
}
}
return error;
}
#endregion