public virtual ServiceResult DeleteReference(
object sourceHandle,
NodeId referenceTypeId,
bool isInverse,
ExpandedNodeId targetId,
bool deleteBiDirectional)
{
lock (Lock)
{
// get the handle.
NodeHandle source = IsHandleInNamespace(sourceHandle);
if (source == null)
{
return StatusCodes.BadNodeIdUnknown;
}
// only support external references to nodes that are stored in memory.
if (!source.Validated || source.Node == null)
{
return StatusCodes.BadNotSupported;
}
// only support references to Source Areas.
source.Node.RemoveReference(referenceTypeId, isInverse, targetId);
if (deleteBiDirectional)
{
// check if the target is also managed by this node manager.
if (!targetId.IsAbsolute)
{
NodeHandle target = GetManagerHandle(m_systemContext, (NodeId)targetId, null);
if (target != null && target.Validated && target.Node != null)
{
target.Node.RemoveReference(referenceTypeId, !isInverse, source.NodeId);
}
}
}
return ServiceResult.Good;
}
}