コード例 #1
0
  private boolean hasUselessSurrogateKey(final Table table) {

    if (!(table instanceof View) && table.getPrimaryKey() != null) {
      boolean hasUselessSurrogateKey = true;
      for (final Column column : table.getColumns()) {
        if (column.isPartOfPrimaryKey()) {
          continue;
        }
        if (!column.isPartOfForeignKey()) {
          hasUselessSurrogateKey = false;
          break;
        }
      }
      return hasUselessSurrogateKey;
    }

    return false;
  }
コード例 #2
0
ファイル: DbAnalyse.java プロジェクト: breakpoint-au/Hedron
  private Element createColumnElement(final Document dom, final Column column) {
    final Element eColumn = dom.createElement("column");

    final String columnName = getPhysicalName(column.getName());
    eColumn.setAttribute("name", getLogicalName(columnName));
    eColumn.setAttribute("physicalname", columnName);

    setColumnTypeAttributes(eColumn, column, "table");

    String requirement = null;
    if (column.isPartOfPrimaryKey()) {
      requirement = "primarykey";
    } else {
      requirement = column.isNullable() ? "optional" : "mandatory";
    }
    eColumn.setAttribute("requirement", requirement);

    return eColumn;
  }
コード例 #3
0
  public static Connectivity getConnectivity(final Column fkColumn) {
    if (fkColumn == null) {
      return Connectivity.unknown;
    }

    boolean isColumnReference;
    try {
      fkColumn.getColumnDataType();
      isColumnReference = false;
    } catch (final Exception e) {
      isColumnReference = true;
    }
    if (isColumnReference) {
      return Connectivity.unknown;
    }

    if (fkColumn.isPartOfPrimaryKey() || fkColumn.isPartOfUniqueIndex()) {
      return Connectivity.zero_one;
    } else {
      return Connectivity.zero_many;
    }
  }