Exemplo n.º 1
0
  private void checkStructure(final SystemEnvironment sysEnv, final Long checkId)
      throws SDMSException {
    if (checkSet.contains(checkId)) return;
    checkSet.add(checkId);

    final SDMSInterval checkIval = SDMSIntervalTable.getObject(sysEnv, checkId);
    final Long embeddedIntervalId = checkIval.getEmbeddedIntervalId(sysEnv);

    if (embeddedIntervalId != null) {
      if (embeddedIntervalId.equals(ivalId))
        throw new CommonErrorException(
            new SDMSMessage(sysEnv, "04209121544", "cyclic references not allowed"));

      checkStructure(sysEnv, embeddedIntervalId);
    }

    final Vector ihList = SDMSIntervalHierarchyTable.idx_parentId.getVector(sysEnv, checkId);
    final Iterator ihIt = ihList.iterator();
    while (ihIt.hasNext()) {
      final SDMSIntervalHierarchy ih = (SDMSIntervalHierarchy) ihIt.next();
      final Long childId = ih.getChildId(sysEnv);

      if (childId.equals(ivalId))
        throw new CommonErrorException(
            new SDMSMessage(sysEnv, "04209121547", "cyclic references not allowed"));

      checkStructure(sysEnv, childId);
    }
  }