public void unrelateAcrossR8007From(Component_c target, boolean notifyChanges) { if (target == null) return; if (HeldByComponent == null) return; // already unrelated if (target != HeldByComponent) { Exception e = new Exception(); e.fillInStackTrace(); CorePlugin.logError("Tried to unrelate from non-related instance across R8007", e); return; } if (target != null) { target.clearBackPointerR8007To(this); } if (HeldByComponent != null) { m_id = HeldByComponent.getId(); if (IdAssigner.NULL_UUID.equals(m_id)) { m_id = HeldByComponent.getIdCachedValue(); } HeldByComponent = null; target.removeRef(); if (notifyChanges) { RelationshipChangeModelDelta change = new RelationshipChangeModelDelta( Modeleventnotification_c.DELTA_ELEMENT_UNRELATED, this, target, "8007", ""); Ooaofooa.getDefaultInstance().fireModelElementRelationChanged(change); } } }
public void relateAcrossR8007To(Component_c target, boolean notifyChanges) { if (target == null) return; if (target == HeldByComponent) return; // already related if (HeldByComponent != target) { Object oldKey = getInstanceKey(); if (HeldByComponent != null) { HeldByComponent.clearBackPointerR8007To(this); if (Boolean.valueOf(System.getenv("PTC_MCC_ENABLED")) == true) { // $NON-NLS-1$ Ooaofooa.log.println( ILogger.CONSISTENCY, "ComponentResultSet_c.relateAcrossR8007To(Component_c target)", "Relate performed across R8007 from Component Result Set to Component without unrelate of prior instance."); } } HeldByComponent = target; if (IdAssigner.NULL_UUID.equals(target.getId())) { // do not update cached value } else { // update cached value m_id = target.getIdCachedValue(); } updateInstanceKey(oldKey, getInstanceKey()); target.setBackPointerR8007To(this); target.addRef(); if (notifyChanges) { RelationshipChangeModelDelta change = new RelationshipChangeModelDelta( Modeleventnotification_c.DELTA_ELEMENT_RELATED, this, target, "8007", ""); Ooaofooa.getDefaultInstance().fireModelElementRelationChanged(change); } } }