예제 #1
0
  public void unrelateAcrossR25From(Model_c target, boolean notifyChanges) {
    if (target == null) return;

    if (IsMovingInModel == null) return; // already unrelated

    if (target != IsMovingInModel) {
      Exception e = new Exception();
      e.fillInStackTrace();
      CanvasPlugin.logError("Tried to unrelate from non-related instance across R25", e);
      return;
    }

    if (target != null) {
      target.clearBackPointerR25To(this);
    }

    if (IsMovingInModel != null) {

      m_diagramid = IsMovingInModel.getDiagramid();
      if (IdAssigner.NULL_UUID.equals(m_diagramid)) {
        m_diagramid = IsMovingInModel.getDiagramidCachedValue();
      }
      IsMovingInModel = null;
      target.removeRef();
      if (notifyChanges) {
        RelationshipChangeModelDelta change =
            new RelationshipChangeModelDelta(
                Modeleventnotification_c.DELTA_ELEMENT_UNRELATED, this, target, "25", "");
        Ooaofgraphics.getDefaultInstance().fireModelElementRelationChanged(change);
      }
    }
  }
예제 #2
0
  public boolean delete() {
    boolean result = super.delete();
    boolean delete_error = false;
    String errorMsg =
        "The following relationships were not torn down by the Element In Move.dispose call: ";
    GraphicalElement_c testR25Inst = GraphicalElement_c.getOneGD_GEOnR25(this, false);

    if (testR25Inst != null) {
      delete_error = true;
      errorMsg = errorMsg + "25 ";
    }

    Model_c testR25InstOth = Model_c.getOneGD_MDOnR25(this, false);

    if (testR25InstOth != null) {
      delete_error = true;
      errorMsg = errorMsg + "25 ";
    }
    if (delete_error == true) {

      if (CanvasPlugin.getDefault().isDebugging()) {
        Ooaofgraphics.log.println(ILogger.DELETE, "Element In Move", errorMsg);
      } else {
        Exception e = new Exception();
        e.fillInStackTrace();
        CanvasPlugin.logError(errorMsg, e);
      }
    }
    return result;
  }
예제 #3
0
  public static ElementInMove_c[] getManyGD_EIMsOnR25(
      Model_c target, ClassQueryInterface_c test, boolean loadComponent) {
    if (target == null) return new ElementInMove_c[0];

    ModelRoot modelRoot = target.getModelRoot();
    Vector matches = new Vector();
    synchronized (target.backPointer_IsMovingElementInMoveIsMoving_R25) {
      for (int i = 0; i < target.backPointer_IsMovingElementInMoveIsMoving_R25.size(); ++i) {
        ElementInMove_c source =
            (ElementInMove_c) target.backPointer_IsMovingElementInMoveIsMoving_R25.get(i);
        if (source != null && (test == null || test.evaluate(source))) {

          matches.add(source);
        }
      }
    }

    if (matches.size() > 0) {
      ElementInMove_c[] ret_set = new ElementInMove_c[matches.size()];
      matches.copyInto(ret_set);
      return ret_set;
    } else {
      return new ElementInMove_c[0];
    }
  }
예제 #4
0
  public void batchRelate(
      ModelRoot modelRoot, boolean relateProxies, boolean notifyChanges, boolean searchAllRoots) {
    InstanceList instances = null;
    ModelRoot baseRoot = modelRoot;

    // R25
    Model_c relInst22327 =
        (Model_c) baseRoot.getInstanceList(Model_c.class).get(new Object[] {m_diagramid});
    // if there was no local element, check for any global elements
    // failing that proceed to check other model roots
    if (relInst22327 == null) {
      relInst22327 =
          (Model_c)
              Ooaofooa.getDefaultInstance()
                  .getInstanceList(Model_c.class)
                  .get(new Object[] {m_diagramid});
    }
    // synchronized
    if (relInst22327 != null) {
      if (relateProxies || !isProxy() || (inSameComponent(this, relInst22327) && !isProxy())) {
        relInst22327.relateAcrossR25To(this, notifyChanges);
      }
    }

    GraphicalElement_c relInst22328 =
        (GraphicalElement_c)
            baseRoot.getInstanceList(GraphicalElement_c.class).get(new Object[] {m_elementid});
    // if there was no local element, check for any global elements
    // failing that proceed to check other model roots
    if (relInst22328 == null) {
      relInst22328 =
          (GraphicalElement_c)
              Ooaofooa.getDefaultInstance()
                  .getInstanceList(GraphicalElement_c.class)
                  .get(new Object[] {m_elementid});
    }
    // synchronized
    if (relInst22328 != null) {
      if (relateProxies || !isProxy() || (inSameComponent(this, relInst22328) && !isProxy())) {
        relInst22328.relateAcrossR25To(this, notifyChanges);
      }
    }
  }
예제 #5
0
  public void relateAcrossR25To(Model_c target, boolean notifyChanges) {
    if (target == null) return;

    if (target == IsMovingInModel) return; // already related

    if (IsMovingInModel != target) {

      Object oldKey = getInstanceKey();

      if (IsMovingInModel != null) {

        IsMovingInModel.clearBackPointerR25To(this);

        if (Boolean.valueOf(System.getenv("PTC_MCC_ENABLED")) == true) { // $NON-NLS-1$
          Ooaofgraphics.log.println(
              ILogger.CONSISTENCY,
              "ElementInMove_c.relateAcrossR25To(Model_c target)",
              "Relate performed across R25 from Element In Move to Model without unrelate of prior instance.");
        }
      }

      IsMovingInModel = target;
      if (IdAssigner.NULL_UUID.equals(target.getDiagramid())) {
        // do not update cached value
      } else {
        // update cached value
        m_diagramid = target.getDiagramidCachedValue();
      }
      updateInstanceKey(oldKey, getInstanceKey());
      target.setBackPointerR25To(this);
      target.addRef();
      if (notifyChanges) {
        RelationshipChangeModelDelta change =
            new RelationshipChangeModelDelta(
                Modeleventnotification_c.DELTA_ELEMENT_RELATED, this, target, "25", "");
        Ooaofgraphics.getDefaultInstance().fireModelElementRelationChanged(change);
      }
    }
  }
예제 #6
0
  // declare transform functions
  public void Dispose() {
    Ooaofgraphics.log.println(
        ILogger.OPERATION, "Element In Move", " Operation entered: ElementInMove::Dispose");
    final ModelRoot modelRoot = getModelRoot();
    GraphicalElement_c v_elem = GraphicalElement_c.getOneGD_GEOnR25(this);

    Model_c v_model = Model_c.getOneGD_MDOnR25(this);

    unrelateAcrossR25From(v_model);
    unrelateAcrossR25From(v_elem);

    if (delete()) {
      Ooaofgraphics.getDefaultInstance()
          .fireModelElementDeleted(new BaseModelDelta(Modeleventnotification_c.DELTA_DELETE, this));
    }
  } // End dispose
예제 #7
0
  public boolean checkConsistency() {
    Ooaofooa.log.println(
        ILogger.OPERATION,
        "Element In Move", //$NON-NLS-1$
        " Operation entered: Element In Move::checkConsistency"); //$NON-NLS-1$
    if (Boolean.valueOf(System.getenv("PTC_MCC_ENABLED")) == false) { // $NON-NLS-1$
      return true;
    }
    ModelRoot modelRoot = getModelRoot();
    boolean retval = true;
    class ElementInMove_c_test22330_c implements ClassQueryInterface_c {
      ElementInMove_c_test22330_c(java.util.UUID p22331, java.util.UUID p22332) {
        m_p22331 = p22331;
        m_p22332 = p22332;
      }

      private java.util.UUID m_p22331;
      private java.util.UUID m_p22332;

      public boolean evaluate(Object candidate) {
        ElementInMove_c selected = (ElementInMove_c) candidate;
        boolean retval = false;
        retval =
            (selected.getElementid().equals(m_p22331)) & (selected.getDiagramid().equals(m_p22332));
        return retval;
      }
    }

    ElementInMove_c[] objs22329 =
        ElementInMove_c.ElementInMoveInstances(
            modelRoot, new ElementInMove_c_test22330_c(getElementid(), getDiagramid()));

    if (((objs22329.length) == 0)) {

      if (CanvasPlugin.getDefault().isDebugging()) {
        Ooaofgraphics.log.println(
            ILogger.CONSISTENCY,
            "Element In Move", //$NON-NLS-1$
            "Consistency: Object: Element In Move: Cardinality of an identifier is zero. " //$NON-NLS-1$
                + "Actual Value: "
                + Integer.toString(objs22329.length)); // $NON-NLS-1$
      } else {
        Exception e = new Exception();
        CanvasPlugin.logError(
            "Consistency: Object: Element In Move: Cardinality of an identifier is zero. " //$NON-NLS-1$
                + "Actual Value: " //$NON-NLS-1$
                + Integer.toString(objs22329.length),
            e);
      }
      retval = false;
    }

    if (((objs22329.length) > 1)) {

      if (CanvasPlugin.getDefault().isDebugging()) {
        Ooaofgraphics.log.println(
            ILogger.CONSISTENCY,
            "Element In Move", //$NON-NLS-1$
            "Consistency: Object: Element In Move: Cardinality of an identifier is greater than 1. " //$NON-NLS-1$
                + "Actual Value: " //$NON-NLS-1$
                + Integer.toString(objs22329.length)
                + " elementId: "
                + "Not Printable"
                + " diagramId: "
                + "Not Printable"); //$NON-NLS-1$
      } else {
        Exception e = new Exception();
        CanvasPlugin.logError(
            "Consistency: Object: Element In Move: Cardinality of an identifier is greater than 1. " //$NON-NLS-1$
                + "Actual Value: " //$NON-NLS-1$
                + Integer.toString(objs22329.length)
                + " elementId: "
                + "Not Printable"
                + " diagramId: "
                + "Not Printable",
            e); //$NON-NLS-1$
      }
      retval = false;
    }

    // Element In Move is a link class in association: rel.Numb = 25
    // Other side
    // The other side class in the association is: Model
    class Model_c_test22336_c implements ClassQueryInterface_c {
      Model_c_test22336_c(java.util.UUID p22337) {
        m_p22337 = p22337;
      }

      private java.util.UUID m_p22337;

      public boolean evaluate(Object candidate) {
        Model_c selected = (Model_c) candidate;
        boolean retval = false;
        retval = (selected.getDiagramid().equals(m_p22337));
        return retval;
      }
    }

    Model_c[] objs22335 =
        Model_c.ModelInstances(modelRoot, new Model_c_test22336_c(getDiagramid()));

    if (((objs22335.length) > 1)) {

      if (CanvasPlugin.getDefault().isDebugging()) {
        Ooaofgraphics.log.println(
            ILogger.CONSISTENCY,
            "Element In Move", //$NON-NLS-1$
            "Consistency: Object: Element In Move: Association: 25: Cardinality of other side of link is greater than 1. " //$NON-NLS-1$
                + "Actual Value: "
                + Integer.toString(objs22335.length)); // $NON-NLS-1$
      } else {
        Exception e = new Exception();
        CanvasPlugin.logError(
            "Consistency: Object: Element In Move: Association: 25: Cardinality of other side of link is greater than 1. " //$NON-NLS-1$
                + "Actual Value: " //$NON-NLS-1$
                + Integer.toString(objs22335.length),
            e);
      }
      retval = false;
    }

    return retval;
  }
예제 #8
0
 public java.util.UUID getDiagramid() {
   if (IsMovingInModel != null) {
     return IsMovingInModel.getDiagramid();
   }
   return IdAssigner.NULL_UUID;
 }
예제 #9
0
 public long getDiagramidLongBased() {
   if (IsMovingInModel != null) {
     return IsMovingInModel.getDiagramidLongBased();
   }
   return 0;
 }
예제 #10
0
 public static ElementInMove_c getOneGD_EIMOnR25(Model_c target, ClassQueryInterface_c test) {
   if (target != null) {
     return getOneGD_EIMOnR25(target.getModelRoot(), target, test);
   }
   return null;
 }
예제 #11
0
 public static ElementInMove_c getOneGD_EIMOnR25(Model_c target, boolean loadComponent) {
   return getOneGD_EIMOnR25(target.getModelRoot(), target, null, loadComponent);
 }
예제 #12
0
 public boolean evaluate(Object candidate) {
   Model_c selected = (Model_c) candidate;
   boolean retval = false;
   retval = (selected.getDiagramid().equals(m_p22337));
   return retval;
 }