Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

allow initialize the recipe multiple times #3696

Merged
merged 4 commits into from
Nov 21, 2023
Merged
Changes from 2 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -74,9 +74,8 @@ public void addPrecondition(Recipe recipe) {
}

@JsonIgnore
private Validated<Object> validation = Validated.test("initialization",
"initialize(..) must be called on DeclarativeRecipe prior to use.",
this, r -> uninitializedRecipes.isEmpty());
private Validated<Object> validation = Validated.invalid("initialization", this,
"initialize(..) must be called on DeclarativeRecipe prior to use.");

@Override
public Duration getEstimatedEffortPerOccurrence() {
Expand All @@ -90,6 +89,8 @@ public void initialize(Collection<Recipe> availableRecipes, Map<String, List<Con
}

private void initialize(List<Recipe> uninitialized, List<Recipe> initialized, Collection<Recipe> availableRecipes, Map<String, List<Contributor>> recipeToContributors) {
initialized.clear();
validation = Validated.none();
for (int i = 0; i < uninitialized.size(); i++) {
Recipe recipe = uninitialized.get(i);
if (recipe instanceof LazyLoadedRecipe) {
Expand Down Expand Up @@ -118,7 +119,6 @@ private void initialize(List<Recipe> uninitialized, List<Recipe> initialized, Co
initialized.add(recipe);
}
}
uninitialized.clear();
joanvr marked this conversation as resolved.
Show resolved Hide resolved
}

@Value
Expand Down
Loading