public void batchRelate(
      ModelRoot modelRoot, boolean relateProxies, boolean notifyChanges, boolean searchAllRoots) {
    InstanceList instances = null;
    ModelRoot baseRoot = modelRoot;

    // R603
    Statement_c relInst40372 =
        (Statement_c)
            baseRoot.getInstanceList(Statement_c.class).get(new Object[] {m_statement_id});
    // if there was no local element, check for any global elements
    // failing that proceed to check other model roots
    if (relInst40372 == null) {
      relInst40372 =
          (Statement_c)
              Ooaofooa.getDefaultInstance()
                  .getInstanceList(Statement_c.class)
                  .get(new Object[] {m_statement_id});
    }
    if (relInst40372 == null && searchAllRoots && !baseRoot.isCompareRoot()) {
      Ooaofooa[] roots = Ooaofooa.getInstances();
      for (int i = 0; i < roots.length; i++) {
        if (roots[i].isCompareRoot()) {
          // never use elements from any compare root
          continue;
        }
        relInst40372 =
            (Statement_c)
                roots[i].getInstanceList(Statement_c.class).get(new Object[] {m_statement_id});
        if (relInst40372 != null) break;
      }
    }
    // synchronized
    if (relInst40372 != null) {
      if (relateProxies || !isProxy() || (inSameComponent(this, relInst40372) && !isProxy())) {
        relInst40372.relateAcrossR603To(this, notifyChanges);
      }
    }

    if (IsAnInvocationOfBridge == null) {
      // R674
      Bridge_c relInst40373 =
          (Bridge_c) baseRoot.getInstanceList(Bridge_c.class).get(new Object[] {m_brg_id});
      // if there was no local element, check for any global elements
      // failing that proceed to check other model roots
      if (relInst40373 == null) {
        relInst40373 =
            (Bridge_c)
                Ooaofooa.getDefaultInstance()
                    .getInstanceList(Bridge_c.class)
                    .get(new Object[] {m_brg_id});
      }
      if (relInst40373 == null && searchAllRoots && !baseRoot.isCompareRoot()) {
        Ooaofooa[] roots = Ooaofooa.getInstances();
        for (int i = 0; i < roots.length; i++) {
          if (roots[i].isCompareRoot()) {
            // never use elements from any compare root
            continue;
          }
          relInst40373 =
              (Bridge_c) roots[i].getInstanceList(Bridge_c.class).get(new Object[] {m_brg_id});
          if (relInst40373 != null) break;
        }
      }
      // synchronized
      if (relInst40373 != null) {
        if (relateProxies || !isProxy() || (inSameComponent(this, relInst40373) && !isProxy())) {
          relInst40373.relateAcrossR674To(this, notifyChanges);
        }
      }
    }
  }