@Test public void testExcluded3() { EnumPartition partition = new EnumPartition(COL_RAW, new String[]{"enum1", "enum2", "enum3"}); String constraint = partition.toSqlConstraint(QUOTE, dbProduct); assertEquals("( \"col\" <> 'enum1' AND \"col\" <> 'enum2' AND \"col\" <> 'enum3' )", constraint); }
@Override public String toSqlConstraint(String quoteString, DbProduct dbProduct) { if (quoteString == null) { throw new RuntimeException("Quote string cannot be null"); } StringBuilder sb = new StringBuilder(); String quotedColumn = quoteString + column + quoteString; if (excluded == null) { sb.append(quotedColumn).append(" = '").append(value).append("'"); } else { sb.append("( ") .append(Stream.of(excluded) .map(excludedValue -> quotedColumn + " <> '" + excludedValue + "'") .collect(Collectors.joining(" AND ")) ).append(" )"); } return sb.toString(); }
EnumPartition extends BasePartition implements JdbcFragmentMetadata { @Override public String toSqlConstraint(String quoteString, DbProduct dbProduct) { if (quoteString == null) { throw new RuntimeException("Quote string cannot be null"); } StringBuilder sb = new StringBuilder(); String quotedColumn = quoteString + column + quoteString; if (excluded == null) { sb.append(quotedColumn).append(" = '").append(value).append("'"); } else { sb.append("( ") .append(Stream.of(excluded) .map(excludedValue -> quotedColumn + " <> '" + excludedValue + "'") .collect(Collectors.joining(" AND ")) ).append(" )"); } return sb.toString(); } }
EnumPartition extends BasePartition implements JdbcFragmentMetadata { @Override public String toSqlConstraint(String quoteString, DbProduct dbProduct) { if (quoteString == null) { throw new RuntimeException("Quote string cannot be null"); } StringBuilder sb = new StringBuilder(); String quotedColumn = quoteString + column + quoteString; if (excluded == null) { sb.append(quotedColumn).append(" = '").append(value).append("'"); } else { sb.append("( ") .append(Stream.of(excluded) .map(excludedValue -> quotedColumn + " <> '" + excludedValue + "'") .collect(Collectors.joining(" AND ")) ).append(" )"); } return sb.toString(); } EnumPartition(String column, String value);  EnumPartition(String column, String[] excluded); }
EnumPartition extends BasePartition implements JdbcFragmentMetadata { @Override public String toSqlConstraint(String quoteString, DbProduct dbProduct) { if (quoteString == null) { throw new RuntimeException("Quote string cannot be null"); } StringBuilder sb = new StringBuilder(); String quotedColumn = quoteString + column + quoteString; if (excluded == null) { sb.append(quotedColumn).append(" = '").append(value).append("'"); } else { sb.append("( ") .append(Stream.of(excluded) .map(excludedValue -> quotedColumn + " <> '" + excludedValue + "'") .collect(Collectors.joining(" AND ")) ).append(" )"); } return sb.toString(); } EnumPartition(String column, String value);  EnumPartition(String column, String[] excluded); @Override String toSqlConstraint(String quoteString, DbProduct dbProduct); String getValue(); String[] getExcluded(); }
EnumPartition extends BasePartition implements JdbcFragmentMetadata { @Override public String toSqlConstraint(String quoteString, DbProduct dbProduct) { if (quoteString == null) { throw new RuntimeException("Quote string cannot be null"); } StringBuilder sb = new StringBuilder(); String quotedColumn = quoteString + column + quoteString; if (excluded == null) { sb.append(quotedColumn).append(" = '").append(value).append("'"); } else { sb.append("( ") .append(Stream.of(excluded) .map(excludedValue -> quotedColumn + " <> '" + excludedValue + "'") .collect(Collectors.joining(" AND ")) ).append(" )"); } return sb.toString(); } EnumPartition(String column, String value);  EnumPartition(String column, String[] excluded); @Override String toSqlConstraint(String quoteString, DbProduct dbProduct); String getValue(); String[] getExcluded();  }