public class BuildCell
extends DisplayCell
{
protected String getCellValue( TableModel tableModel, Column column )
{
ProjectSummary project = (ProjectSummary) tableModel.getCurrentRowBean();
String contextPath = tableModel.getContext().getContextPath();
int buildNumber = project.getBuildNumber();
String result = "<div align=\"center\">";
if ( project.isInBuildingQueue() )
{
result +=
"<img src=\"" + contextPath + "/images/inqueue.gif\" alt=\"In Queue\" title=\"In Queue\" border=\"0\">";
}
else if ( project.isInCheckoutQueue() )
{
result += "<img src=\"" + contextPath +
"/images/checkingout.gif\" alt=\"Checking Out sources\" title=\"Checking Out sources\" border=\"0\">";
}
else
{
if ( project.getState() == 1 || project.getState() == 10 || project.getState() == 2 ||
project.getState() == 3 || project.getState() == 4 )
{
if ( buildNumber > 0 )
{
HashMap<String, Object> params = new HashMap<String, Object>();
params.put( "projectId", project.getId() );
params.put( "projectName", project.getName() );
params.put( "buildId", project.getBuildInSuccessId() );
params.put( "projectGroupId", project.getProjectGroupId() );
PageContext pageContext = (PageContext) tableModel.getContext().getContextObject();
HttpServletRequest request = (HttpServletRequest) pageContext.getRequest();
HttpServletResponse response = (HttpServletResponse) pageContext.getResponse();
String url = UrlHelperFactory.getInstance().buildUrl( "/buildResult.action", request, response, params );
if ( isAuthorized( project ) )
{
// we are authzd so act normally
result += "<a href=\"" + url + "\">" + buildNumber + "</a>";
}
else
{
result += buildNumber;
}
}
else
{
result += " ";
}
}
else if ( project.getState() == 6 )
{
result += "<img src=\"" + contextPath +
"/images/building.gif\" alt=\"Building\" title=\"Building\" border=\"0\">";
}
else if ( project.getState() == 7 )
{
result += "<img src=\"" + contextPath +
"/images/checkingout.gif\" alt=\"Checking Out sources\" title=\"Checking Out sources\" border=\"0\">";
}
else if ( project.getState() == 8 )
{
result += "<img src=\"" + contextPath +
"/images/checkingout.gif\" alt=\"Updating sources\" title=\"Updating sources\" border=\"0\">";
}
else