Ejemplo n.º 1
0
  public void unrelateAcrossR301From(Graphelement_c target, boolean notifyChanges) {
    if (target == null) return;

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

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

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

    if (IsSupertypeGraphelement != null) {

      m_elementid = IsSupertypeGraphelement.getElementid();
      if (IdAssigner.NULL_UUID.equals(m_elementid)) {
        m_elementid = IsSupertypeGraphelement.getElementidCachedValue();
      }
      IsSupertypeGraphelement = null;
      target.removeRef();
      if (notifyChanges) {
        RelationshipChangeModelDelta change =
            new RelationshipChangeModelDelta(
                Modeleventnotification_c.DELTA_ELEMENT_UNRELATED, this, target, "301", "");
        Ooaofgraphics.getDefaultInstance().fireModelElementRelationChanged(change);
      }
    }
  }
Ejemplo n.º 2
0
  public void batchRelate(
      ModelRoot modelRoot, boolean relateProxies, boolean notifyChanges, boolean searchAllRoots) {
    InstanceList instances = null;
    ModelRoot baseRoot = modelRoot;

    // R301
    Graphelement_c relInst21771 =
        (Graphelement_c)
            baseRoot.getInstanceList(Graphelement_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 (relInst21771 == null) {
      relInst21771 =
          (Graphelement_c)
              Ooaofooa.getDefaultInstance()
                  .getInstanceList(Graphelement_c.class)
                  .get(new Object[] {m_elementid});
    }
    // synchronized
    if (relInst21771 != null) {
      if (relateProxies || !isProxy() || (inSameComponent(this, relInst21771) && !isProxy())) {
        relInst21771.relateAcrossR301To(this, notifyChanges);
      }
    }
  }
Ejemplo n.º 3
0
  // declare transform functions
  public void Dispose() {
    Ooaofgraphics.log.println(
        ILogger.OPERATION, "GraphNode", " Operation entered: Graphnode::Dispose");
    final ModelRoot modelRoot = getModelRoot();
    Graphelement_c v_element = Graphelement_c.getOneDIM_GEOnR301(this);

    if (((v_element != null))) {

      if (v_element != null) {
        v_element.Dispose();
      } else {
        Throwable t = new Throwable();
        t.fillInStackTrace();
        CorePlugin.logError("Attempted to call an operation on a null instance.", t);
      }

    } else {

      Shape_c v_shape = Shape_c.getOneGD_SHPOnR19(this);

      if (((v_shape != null))) {

        this.unrelateAcrossR19From(v_shape);

        if (v_shape != null) {
          v_shape.Dispose();
        } else {
          Throwable t = new Throwable();
          t.fillInStackTrace();
          CorePlugin.logError("Attempted to call an operation on a null instance.", t);
        }
      }

      FloatingText_c v_ctxt = FloatingText_c.getOneGD_CTXTOnR19(this);

      if (((v_ctxt != null))) {

        this.unrelateAcrossR19From(v_ctxt);

        if (v_ctxt != null) {
          v_ctxt.Dispose();
        } else {
          Throwable t = new Throwable();
          t.fillInStackTrace();
          CorePlugin.logError("Attempted to call an operation on a null instance.", t);
        }
      }

      if (delete()) {
        Ooaofgraphics.getDefaultInstance()
            .fireModelElementDeleted(
                new BaseModelDelta(Modeleventnotification_c.DELTA_DELETE, this));
      }
    }
  } // End dispose
Ejemplo n.º 4
0
  public boolean delete() {
    boolean result = super.delete();
    boolean delete_error = false;
    String errorMsg =
        "The following relationships were not torn down by the GraphNode.dispose call: ";
    Graphelement_c testR301Inst1 = Graphelement_c.getOneDIM_GEOnR301(this, false);

    if (testR301Inst1 != null) {
      delete_error = true;
      errorMsg = errorMsg + "301 ";
    }
    Shape_c testR19Inst1 = Shape_c.getOneGD_SHPOnR19(this, false);

    if (testR19Inst1 != null) {
      delete_error = true;
      errorMsg = errorMsg + "19 ";
    }
    FloatingText_c testR19Inst2 = FloatingText_c.getOneGD_CTXTOnR19(this, false);

    if (testR19Inst2 != null) {
      delete_error = true;
      errorMsg = errorMsg + "19 ";
    }
    if (delete_error == true) {

      if (CanvasPlugin.getDefault().isDebugging()) {
        Ooaofgraphics.log.println(ILogger.DELETE, "GraphNode", errorMsg);
      } else {
        Exception e = new Exception();
        e.fillInStackTrace();
        CanvasPlugin.logError(errorMsg, e);
      }
    }
    return result;
  }
Ejemplo n.º 5
0
  public void relateAcrossR301To(Graphelement_c target, boolean notifyChanges) {
    if (target == null) return;

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

    if (IsSupertypeGraphelement != target) {

      Object oldKey = getInstanceKey();

      if (IsSupertypeGraphelement != null) {

        IsSupertypeGraphelement.clearBackPointerR301To(this);

        if (Boolean.valueOf(System.getenv("PTC_MCC_ENABLED")) == true) { // $NON-NLS-1$
          Ooaofgraphics.log.println(
              ILogger.CONSISTENCY,
              "Graphnode_c.relateAcrossR301To(Graphelement_c target)",
              "Relate performed across R301 from GraphNode to GraphElement without unrelate of prior instance.");
        }
      }

      IsSupertypeGraphelement = target;
      if (IdAssigner.NULL_UUID.equals(target.getElementid())) {
        // do not update cached value
      } else {
        // update cached value
        m_elementid = target.getElementidCachedValue();
      }
      updateInstanceKey(oldKey, getInstanceKey());
      target.setBackPointerR301To(this);
      target.addRef();
      if (notifyChanges) {
        RelationshipChangeModelDelta change =
            new RelationshipChangeModelDelta(
                Modeleventnotification_c.DELTA_ELEMENT_RELATED, this, target, "301", "");
        Ooaofgraphics.getDefaultInstance().fireModelElementRelationChanged(change);
      }
    }
  }
Ejemplo n.º 6
0
  public boolean checkConsistency() {
    Ooaofooa.log.println(
        ILogger.OPERATION,
        "GraphNode", //$NON-NLS-1$
        " Operation entered: GraphNode::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 Graphnode_c_test21773_c implements ClassQueryInterface_c {
      Graphnode_c_test21773_c(java.util.UUID p21774) {
        m_p21774 = p21774;
      }

      private java.util.UUID m_p21774;

      public boolean evaluate(Object candidate) {
        Graphnode_c selected = (Graphnode_c) candidate;
        boolean retval = false;
        retval = (selected.getElementid().equals(m_p21774));
        return retval;
      }
    }

    Graphnode_c[] objs21772 =
        Graphnode_c.GraphnodeInstances(modelRoot, new Graphnode_c_test21773_c(getElementid()));

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

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

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

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

    // GraphNode is a subtype in association: rel.Numb = 301
    // The supertype class is: GraphElement
    class Graphelement_c_test21778_c implements ClassQueryInterface_c {
      Graphelement_c_test21778_c(java.util.UUID p21779) {
        m_p21779 = p21779;
      }

      private java.util.UUID m_p21779;

      public boolean evaluate(Object candidate) {
        Graphelement_c selected = (Graphelement_c) candidate;
        boolean retval = false;
        retval = (selected.getElementid().equals(m_p21779));
        return retval;
      }
    }

    Graphelement_c[] objs21777 =
        Graphelement_c.GraphelementInstances(
            modelRoot, new Graphelement_c_test21778_c(getElementid()));

    if (((objs21777.length) != 1)) {

      if (CanvasPlugin.getDefault().isDebugging()) {
        Ooaofgraphics.log.println(
            ILogger.CONSISTENCY,
            "GraphNode", //$NON-NLS-1$
            "Consistency: Object: GraphNode: Association: 301: Cardinality of a supertype is not equal to 1. " //$NON-NLS-1$
                + "Actual Value: "
                + Integer.toString(objs21777.length)); // $NON-NLS-1$
      } else {
        Exception e = new Exception();
        CanvasPlugin.logError(
            "Consistency: Object: GraphNode: Association: 301: Cardinality of a supertype is not equal to 1. " //$NON-NLS-1$
                + "Actual Value: " //$NON-NLS-1$
                + Integer.toString(objs21777.length),
            e);
      }
      retval = false;
    }

    // Supertype: rel.Numb = 19
    int objs21780 = 0;
    // Subtype Object: Shape
    class Shape_c_test21781_c implements ClassQueryInterface_c {
      Shape_c_test21781_c(java.util.UUID p21782) {
        m_p21782 = p21782;
      }

      private java.util.UUID m_p21782;

      public boolean evaluate(Object candidate) {
        Shape_c selected = (Shape_c) candidate;
        boolean retval = false;
        retval = (selected.getElementid().equals(m_p21782));
        return retval;
      }
    }

    Shape_c[] objs21783 =
        Shape_c.ShapeInstances(modelRoot, new Shape_c_test21781_c(getElementid()));

    objs21780 = objs21780 + objs21783.length;
    // Subtype Object: Floating Text
    class FloatingText_c_test21784_c implements ClassQueryInterface_c {
      FloatingText_c_test21784_c(java.util.UUID p21785) {
        m_p21785 = p21785;
      }

      private java.util.UUID m_p21785;

      public boolean evaluate(Object candidate) {
        FloatingText_c selected = (FloatingText_c) candidate;
        boolean retval = false;
        retval = (selected.getElementid().equals(m_p21785));
        return retval;
      }
    }

    FloatingText_c[] objs21786 =
        FloatingText_c.FloatingTextInstances(
            modelRoot, new FloatingText_c_test21784_c(getElementid()));

    objs21780 = objs21780 + objs21786.length;
    if (objs21780 != 1) {

      if (CanvasPlugin.getDefault().isDebugging()) {
        Ooaofgraphics.log.println(
            ILogger.CONSISTENCY,
            "GraphNode", //$NON-NLS-1$
            "Consistency: Object: GraphNode: Association: 19: Cardinality of subtype is not equal to 1. " //$NON-NLS-1$
                + "Actual Value: "
                + Integer.toString(objs21780)); // $NON-NLS-1$
      } else {
        Exception e = new Exception();
        CanvasPlugin.logError(
            "Consistency: Object: GraphNode: Association: 19: Cardinality of subtype is not equal to 1. " //$NON-NLS-1$
                + "Actual Value: " //$NON-NLS-1$
                + Integer.toString(objs21780),
            e);
      }
      retval = false;
    }

    return retval;
  }
Ejemplo n.º 7
0
 public java.util.UUID getElementid() {
   if (IsSupertypeGraphelement != null) {
     return IsSupertypeGraphelement.getElementid();
   }
   return IdAssigner.NULL_UUID;
 }
Ejemplo n.º 8
0
 public long getElementidLongBased() {
   if (IsSupertypeGraphelement != null) {
     return IsSupertypeGraphelement.getElementidLongBased();
   }
   return 0;
 }
Ejemplo n.º 9
0
 public static Graphnode_c getOneDIM_NDOnR301(Graphelement_c target, ClassQueryInterface_c test) {
   if (target != null) {
     return getOneDIM_NDOnR301(target.getModelRoot(), target, test);
   }
   return null;
 }
Ejemplo n.º 10
0
 public static Graphnode_c getOneDIM_NDOnR301(Graphelement_c target, boolean loadComponent) {
   return getOneDIM_NDOnR301(target.getModelRoot(), target, null, loadComponent);
 }
Ejemplo n.º 11
0
 public boolean evaluate(Object candidate) {
   Graphelement_c selected = (Graphelement_c) candidate;
   boolean retval = false;
   retval = (selected.getElementid().equals(m_p21779));
   return retval;
 }