Create
cancel
Showing results for 
Search instead for 
Did you mean: 
Sign up Log in
Deleted user
0 / 0 points
Next:
badges earned

Your Points Tracker
Challenges
Leaderboard
  • Global
  • Feed

Badge for your thoughts?

You're enrolled in our new beta rewards program. Join our group to get the inside scoop and share your feedback.

Join group
Recognition
Give the gift of kudos
You have 0 kudos available to give
Who do you want to recognize?
Why do you want to recognize them?
Kudos
Great job appreciating your peers!
Check back soon to give more kudos.

Past Kudos Given
No kudos given
You haven't given any kudos yet. Share the love above and you'll see it here.

It's not the same without you

Join the community to find out what other Atlassian users are discussing, debating and creating.

Atlassian Community Hero Image Collage

Bamboo Java Specs with Multiple Plans

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...

 

2 answers

2 accepted

1 vote
Answer accepted

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);
0 votes
Answer accepted

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 

Suggest an answer

Log in or Sign up to answer
TAGS
Community showcase
Published in Bamboo

Bamboo Data Center - Early Access Program

G’day Bamboo customers, The wait is almost over! We are in the final stages of work on the first release of Bamboo Data Center, our self-managed enterprise offering of Bamboo. This Data Center offe...

945 views 0 16
Read article

Community Events

Connect with like-minded Atlassian users at free events near you!

Find an event

Connect with like-minded Atlassian users at free events near you!

Unfortunately there are no Community Events near you at the moment.

Host an event

You're one step closer to meeting fellow Atlassian users at your local event. Learn more about Community Events

Events near you