This Question is Answered

2 "helpful" answers available (2 pts)
5 Replies Last post: Jan 10, 2012 1:11 AM by Alex Yeisley  
Alex Yeisley Newbie 23 posts since
Dec 10, 2011
Currently Being Moderated

Jan 5, 2012 2:28 AM

Build Type Name from Build_Type_Id

I realised today that I accidently posted this in the General Disscusions instead of the Plugin Development.  So I am moving it to here.

 

== Original Post ==

 

I was wondering, is it possible to get the Name of a Build Type with just the Build_Type_Id?

 

To elaborate on what I am trying to do:

I am writting a custom plugin for internal use that has additional information in the Database.  This information is tied to Build Configurations (aka Build Types).  I am suspending a build until I get this additional information, and I wanted to have a new table on the queue page which will direct users to another page to fill out the information.  All of this is working.  The issue I am running into is that the Name of a Build Configuration (and it's related Project) are not stored in the Database from what I can tell, so I cannot just write queries to tie it all together.  I know that I would be able to get the Name from an object of type SBuildType or BuildType, but these are typically only available when an action takes place (such as a change to the VCS being detected).  Is there a master collection of BuildTypes that I could pass in the Build_Type_Id to and get back the BuildType object that matches similiar to the Notifiers (even if I need to iterate over the list to find what I want)?  And if there is, would this collection be available directly in a JSP file, or would I need to do the work in the Controller and pass the result to the JSP as a parameter?

 

Thanks,

~Alex

Yegor Yarko JetBrains 1,458 posts since
May 5, 2004
Currently Being Moderated
Jan 5, 2012 1:28 PM in response to: Alex Yeisley
Re: Build Type Name from Build_Type_Id

Alex,

 

You can use:

ProjectManager.findBuildTypeById (get ProjectManager via Spring)

You can also get all build configurations via ProjectManager.getAllBuildTypes


Seems, you can prepare list of BuildTypes in the controller and pass it to JSP for usage.

 

As a side note, please note that the tables you created in the database are not covered by TeamCity backup functionality, so you might need to establish manual backup.

 

BTW, Can you please describe the original use case that you are solvimg? Might TW-7652 be related?

Yegor Yarko JetBrains 1,458 posts since
May 5, 2004
Currently Being Moderated
Jan 10, 2012 12:46 AM in response to: Alex Yeisley
Re: Build Type Name from Build_Type_Id

Alex,

 

Thank you for describing your case and summarizing the solution to the original question.

 

A small note: I'd consider making canStart methid as fast as possible, rusing some cached data. Database lokkup and other potentially long operations can probably be done in background and supply data for the canStart to use.

Otherwise queue processing can become slow and there can be builds that have nothing to do with the logic, but still waiting in the queue until all previous queued builds get their data...

More Like This

  • Retrieving data ...