private IllegalStateException noEnabledForeignKeyException() { return new IllegalStateException( "FK " + fk.getId() + " does not have an enabled ForeignKeyColumn" ); }
/** * Locate the {@link ForeignKey} child with the specified id if it exists, * else return an empty {@code Optional}. * * @param id the {@link HasId#getId()} of the foreign key * @return the child found or an empty {@code Optional} */ default Optional<? extends ForeignKey> findForeignKey(String id) { return foreignKeys().filter(child -> child.getId().equals(id)).findAny(); }
/** * Returns {@code true} if the two specified documents represents the same * element in the database. Two documents are considered same if they have * the same name and type and their parents are considered same. * * @param first the first document * @param second the second document * @return {@code true} if same, else {@code false} */ public static boolean isSame(ForeignKey first, ForeignKey second) { if (first.getId().equals(second.getId())) { final Table firstParent = first.getParentOrThrow(); final Table secondParent = second.getParentOrThrow(); return isSame(firstParent, secondParent); } else { return false; } }
ImmutableForeignKey(ImmutableTable parent, Map<String, Object> data) { super(parent, data); final ForeignKey prototype = new ForeignKeyImpl(parent, data); this.id = prototype.getId(); this.name = prototype.getName(); this.enabled = prototype.isEnabled(); this.foreignKeyColumns = unmodifiableList(super.children(FOREIGN_KEY_COLUMNS, ImmutableForeignKeyColumn::new).collect(toList())); }
.filter(fk -> fksThatNeedNewNames.contains(fk.getId())) .forEach(fk -> { final Set<String> thisSet = fk.foreignKeyColumns()
private IllegalStateException noEnabledForeignKeyException() { return new IllegalStateException( "FK " + fk.getId() + " does not have an enabled ForeignKeyColumn" ); }
.filter(fk -> fksThatNeedNewNames.contains(fk.getId())) .forEach(fk -> { final Set<String> thisSet = fk.foreignKeyColumns()