MOB-687 - WCM Deployment - Select multiple test servers

git-svn-id: https://svn.alfresco.com/repos/alfresco-enterprise/alfresco/HEAD/root@14337 c4b6b30b-aa2e-2d43-bbcb-ca4b014f7261
This commit is contained in:
Mark Rogers
2009-05-15 15:35:58 +00:00
parent a20914fa8e
commit 8b53e5f3df
7 changed files with 79 additions and 81 deletions

View File

@@ -244,40 +244,63 @@ public class UIDeployWebsite extends UIInput
// been removed then show a list of available test servers to choose
// from.
NodeRef allocatedServer = DeploymentUtil.findAllocatedTestServer(getStore());
if (allocatedServer != null)
List<NodeRef> allocatedServers = DeploymentUtil.findAllocatedTestServers(getStore());
if (!allocatedServers.isEmpty())
{
// there is an allocated server
renderAllocatedTestServer(context, out, nodeService, allocatedServer);
// there is at least one allocated server
for(NodeRef allocatedServer : allocatedServers)
{
renderAllocatedTestServer(context, out, nodeService, allocatedServer);
}
}
else
{
// a test server needs to be selected - display the list of test servers
// a test server(s) needs to be selected - display the list of test servers
List<NodeRef> refs = DeploymentUtil.findTestServers(webProject, true);
// Resolve the unsorted list of NodeRef to a sorted list of DeploymentServerConfig.
List<DeploymentServerConfig> servers = toSortedDeploymentServerConfig(nodeService, refs);
if (servers.size() > 0)
{
boolean first = true;
String currentDisplayGroup = "";
ParentChildCheckboxHelper helper = new ParentChildCheckboxHelper(this.getClientId(context));
//boolean first = true;
//String currentDisplayGroup = "";
boolean selected = false;
for (DeploymentServerConfig server: servers)
{
// Write the display group title if it is a new title
String displayGroup = (String)server.getProperties().get(DeploymentServerConfig.PROP_GROUP);
if(!currentDisplayGroup.equalsIgnoreCase(displayGroup))
{
// yes title has changed - write out the new displayGroup
out.write("<p class='mainSubTitle'>");
out.write(displayGroup);
out.write("</p>");
currentDisplayGroup = displayGroup;
}
renderTestServer(context, out, nodeService, server.getServerRef(), first);
first = false;
{
// Get the display group
String displayGroup = (String)server.getProperties().get(DeploymentServerConfig.PROP_GROUP);
helper.setCurrentDisplayGroup(displayGroup);
if(helper.newGroup)
{
out.write("<p class='mainSubTitle'>");
out.write("<input type='checkbox' id='");
out.write(helper.groupParentId);
out.write("' value='");
out.write(displayGroup);
out.write("'");
out.write(" ");
out.write("onClick=\"select_all(\'");
out.write(helper.groupChildName);
out.write("\', this.checked);\" ");
out.write(" /> ");
out.write(displayGroup);
out.write("</p>");
}
if(helper.groupParentId.length() > 0)
{
// render the test server with a child checkbox
renderCheckableServer(context, out, nodeService, server.getServerRef(), selected, helper.groupChildName, helper.groupParentId);
}
else
{
// render the test server without a parent checkbox
renderCheckableServer(context, out, nodeService, server.getServerRef(), selected, this.getClientId(context));
}
}
}
else
@@ -341,12 +364,12 @@ public class UIDeployWebsite extends UIInput
if(helper.groupParentId.length() > 0)
{
// render the live server with a child checkbox
renderLiveServer(context, out, nodeService, server.getServerRef(), selected, helper.groupChildName, helper.groupParentId);
renderCheckableServer(context, out, nodeService, server.getServerRef(), selected, helper.groupChildName, helper.groupParentId);
}
else
{
// render the live server without a parent checkbox
renderLiveServer(context, out, nodeService, server.getServerRef(), selected, this.getClientId(context));
renderCheckableServer(context, out, nodeService, server.getServerRef(), selected, this.getClientId(context));
}
}
}
@@ -552,13 +575,13 @@ public class UIDeployWebsite extends UIInput
out.write("</script>\n");
}
private void renderLiveServer(FacesContext context, ResponseWriter out, NodeService nodeService,
private void renderCheckableServer(FacesContext context, ResponseWriter out, NodeService nodeService,
NodeRef server, boolean selected, String checkBoxName) throws IOException
{
renderLiveServer(context, out, nodeService, server, selected, checkBoxName, "");
renderCheckableServer(context, out, nodeService, server, selected, checkBoxName, "");
}
private void renderLiveServer(FacesContext context, ResponseWriter out, NodeService nodeService,
private void renderCheckableServer(FacesContext context, ResponseWriter out, NodeService nodeService,
NodeRef server, boolean selected, String checkBoxName, String parentId) throws IOException
{
String contextPath = context.getExternalContext().getRequestContextPath();
@@ -596,41 +619,18 @@ public class UIDeployWebsite extends UIInput
renderPanelMiddle(out, contextPath, nodeService, server, true);
if (selected == false)
{
out.write("<div class='deployPanelServerStatus'><img src='");
out.write(contextPath);
out.write("/images/icons/info_icon.gif' style='vertical-align: -5px;' />&nbsp;");
out.write(Application.getMessage(context, "deploy_server_not_selected"));
out.write("</div>");
}
// if (selected == false)
// {
// out.write("<div class='deployPanelServerStatus'><img src='");
// out.write(contextPath);
// out.write("/images/icons/info_icon.gif' style='vertical-align: -5px;' />&nbsp;");
// out.write(Application.getMessage(context, "deploy_server_not_selected"));
// out.write("</div>");
// }
renderPanelEnd(out, contextPath);
}
private void renderTestServer(FacesContext context, ResponseWriter out, NodeService nodeService,
NodeRef server, boolean selected) throws IOException
{
String contextPath = context.getExternalContext().getRequestContextPath();
renderPanelStart(out, contextPath);
out.write("<div class='deployPanelControl'>");
out.write("<input type='radio' name='");
out.write(this.getClientId(context));
out.write("' value='");
out.write(server.toString());
out.write("'");
if (selected)
{
out.write(" checked='checked'");
}
out.write(" /></div>");
renderPanelMiddle(out, contextPath, nodeService, server, true);
renderPanelEnd(out, contextPath);
}
private void renderAllocatedTestServer(FacesContext context, ResponseWriter out, NodeService nodeService,
NodeRef server) throws IOException
{

View File

@@ -416,8 +416,8 @@ public class UIUserSandboxes extends SelfRenderingComponent implements Serializa
logger.debug("Building sandbox view for user store: " + mainStore);
// determine if the sandbox has an allocated test server for deployment
NodeRef testServer = DeploymentUtil.findAllocatedTestServer(mainStore);
boolean hasAllocatedTestServer = (testServer != null);
List<NodeRef> testServers = DeploymentUtil.findAllocatedTestServers(mainStore);
boolean hasAllocatedTestServer = (!testServers.isEmpty());
// determine if there are any previous deployment attempts
List<NodeRef> deployAttempts = DeploymentUtil.findDeploymentAttempts(mainStore);