You're on your way to the next level! Join the Kudos program to earn points and save your progress.
Level 1: Seed
25 / 150 points
Next: Root
1 badge earned
Challenges come and go, but your rewards stay with you. Do more to earn more!
What goes around comes around! Share the love by gifting kudos to your peers.
Keep earning points to reach the top of the leaderboard. It resets every quarter so you always have a chance!
Join now to unlock these features and more
The Atlassian Community can help you and your team get more value out of Atlassian products and practices.
We are starting to use Java specs and want to define all the projects and plans in a single repo, but not sure of the best way to setup many plans.
If we have 50 plans to define, are we going to have to create a single line for each plan like below? Is there an easier way to accomplish this?
Plan plan1 = new PlanSpec().createPlan1();
Plan plan2 = new PlanSpec().createPlan2();
Plan plan3 = new PlanSpec().createPlan3();
Plan plan4 = new PlanSpec().createPlan4();
Plan plan5 = new PlanSpec().createPlan5();
etc...
bambooServer.publish(plan1);
bambooServer.publish(plan2);
bambooServer.publish(plan3);
bambooServer.publish(plan4);
bambooServer.publish(plan5);
etc...
Try this approach
List<Plan> plans = new ArrayList<Plan>();
PlanSpec spec = new PlanSpec();
plans.add(spec.createPlan1());
plans.add(spec.createPlan2());
plans.add(spec.createPlan3());
plans.add(spec.createPlan4());
plans.add(spec.createPlan5());
plans.forEach(bambooServer::publish);
Hello @Ryan Dykstra
Yes, this is one of the ways you could do it.
As this is Java, you could also do something like:
// This is pseudo-code, it will not work. It's just an insight
Plan createPlan(integer number) {
return new PlanSpec().createPlan();
}
// Later
for(Plan p : plans) {
bambooServer.publish(p);
}
Did it help?
Victor
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.