Пример #1
0
 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;
 }
Пример #2
0
 public static void batchRelateAll(
     ModelRoot modelRoot, boolean notifyChanges, boolean searchAllRoots, boolean relateProxies) {
   InstanceList instances = modelRoot.getInstanceList(ElementInMove_c.class);
   synchronized (instances) {
     Iterator<NonRootModelElement> cursor = instances.iterator();
     while (cursor.hasNext()) {
       final ElementInMove_c inst = (ElementInMove_c) cursor.next();
       inst.batchRelate(modelRoot, relateProxies, notifyChanges, searchAllRoots);
     }
   }
 }
Пример #3
0
  public static ElementInMove_c resolveInstance(
      ModelRoot modelRoot,
      java.util.UUID p_m_elementid,
      java.util.UUID p_m_diagramid,
      float p_m_startingx,
      float p_m_startingy) {
    InstanceList instances = modelRoot.getInstanceList(ElementInMove_c.class);
    ElementInMove_c source = null;
    synchronized (instances) {
      Object[] key = {p_m_elementid, p_m_diagramid};
      source = (ElementInMove_c) instances.get(key);
      if (source != null && !modelRoot.isCompareRoot()) {
        source.convertFromProxy();
        source.batchUnrelate();
        // pre-process the uuid so that we re-use null uuid instance rather then creating a new one.
        source.m_elementid = IdAssigner.preprocessUUID(p_m_elementid);
        // pre-process the uuid so that we re-use null uuid instance rather then creating a new one.
        source.m_diagramid = IdAssigner.preprocessUUID(p_m_diagramid);
        source.m_startingx = p_m_startingx;
        source.m_startingy = p_m_startingy;

        return source;
      }
    }
    // there is no instance matching the id
    ElementInMove_c new_inst =
        new ElementInMove_c(modelRoot, p_m_elementid, p_m_diagramid, p_m_startingx, p_m_startingy);
    return new_inst;
  }
Пример #4
0
 public static ElementInMove_c createProxy(
     ModelRoot modelRoot,
     java.util.UUID p_m_elementid,
     java.util.UUID p_m_diagramid,
     float p_m_startingx,
     float p_m_startingy,
     String p_contentPath,
     IPath p_localPath) {
   ModelRoot resolvedModelRoot = ModelRoot.findModelRoot(modelRoot, p_contentPath, p_localPath);
   // if a model root was not resolved it is most likely
   // due to a missing file of the proxy, defualt back to
   // the original model root
   if (resolvedModelRoot != null) modelRoot = resolvedModelRoot;
   InstanceList instances = modelRoot.getInstanceList(ElementInMove_c.class);
   ElementInMove_c new_inst = null;
   synchronized (instances) {
     Object[] key = {p_m_elementid, p_m_diagramid};
     new_inst = (ElementInMove_c) instances.get(key);
   }
   String contentPath = PersistenceUtil.resolveRelativePath(p_localPath, new Path(p_contentPath));
   if (modelRoot.isNewCompareRoot()) {
     // for comparisons we do not want to change
     // the content path
     contentPath = p_contentPath;
   }
   if (new_inst != null && !modelRoot.isCompareRoot()) {
     PersistableModelComponent pmc = new_inst.getPersistableComponent();
     if (pmc == null) {
       // dangling reference, redo this instance
       new_inst.batchUnrelate();
       // pre-process the uuid so that we re-use null uuid instance rather then creating a new one.
       new_inst.m_elementid = IdAssigner.preprocessUUID(p_m_elementid);
       // pre-process the uuid so that we re-use null uuid instance rather then creating a new one.
       new_inst.m_diagramid = IdAssigner.preprocessUUID(p_m_diagramid);
       new_inst.m_startingx = p_m_startingx;
       new_inst.m_startingy = p_m_startingy;
     }
   }
   if (new_inst == null) {
     // there is no instance matching the id, create a proxy
     // if the resource doesn't exist then this will be a dangling reference
     new_inst =
         new ElementInMove_c(
             modelRoot, p_m_elementid, p_m_diagramid, p_m_startingx, p_m_startingy);
     new_inst.m_contentPath = contentPath;
   }
   return new_inst;
 }
Пример #5
0
  // end declare accessors
  public static void checkClassConsistency(ModelRoot modelRoot) {
    Ooaofooa.log.println(
        ILogger.OPERATION,
        "Element In Move", //$NON-NLS-1$
        " Operation entered: Element In Move::checkClassConsistency"); //$NON-NLS-1$
    if (Boolean.valueOf(System.getenv("PTC_MCC_ENABLED")) == false) { // $NON-NLS-1$
      return;
    }
    ElementInMove_c[] objs = ElementInMove_c.ElementInMoveInstances(modelRoot, null, false);

    for (int i = 0; i < objs.length; i++) {
      objs[i].checkConsistency();
    }
  }
Пример #6
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;
  }