コード例 #1
0
  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);
      }
    }
  }