mirror of
https://github.com/Alfresco/alfresco-community-repo.git
synced 2025-08-07 17:49:17 +00:00
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:
@@ -1228,7 +1228,7 @@ delete_reports_info=To remove all deployment reports in the web project, click Y
|
||||
delete_reports_confirm=Are you sure you want to delete all deployment reports across all sandboxes in this webproject?
|
||||
release_server_title=Release Test Server
|
||||
release_server_info=To release the test server from this sandbox, click Yes.
|
||||
release_server_confirm=Are you sure you want to release the test server allocated to this sandbox?
|
||||
release_server_confirm=Are you sure you want to release the test server(s) allocated to this sandbox?
|
||||
website_showallsandboxes=Show All Sandboxes
|
||||
|
||||
# Website actions and dialog messages
|
||||
|
@@ -25,6 +25,7 @@
|
||||
package org.alfresco.web.bean.wcm;
|
||||
|
||||
import java.text.MessageFormat;
|
||||
import java.util.List;
|
||||
|
||||
import javax.faces.context.FacesContext;
|
||||
|
||||
@@ -96,8 +97,8 @@ public class DeleteSandboxDialog extends BaseDialogBean
|
||||
String mainStore = AVMUtil.buildUserMainStoreName(wpStoreId, username);
|
||||
|
||||
// if the sandbox is allocated to a test server release it
|
||||
NodeRef testServer = DeploymentUtil.findAllocatedTestServer(mainStore);
|
||||
if (testServer != null)
|
||||
List<NodeRef> testServers = DeploymentUtil.findAllocatedTestServers(mainStore);
|
||||
for(NodeRef testServer : testServers)
|
||||
{
|
||||
getNodeService().setProperty(testServer, WCMAppModel.PROP_DEPLOYSERVERALLOCATEDTO, null);
|
||||
|
||||
|
@@ -230,13 +230,15 @@ public final class DeploymentUtil
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns the test server allocated to the given store.
|
||||
* Returns the test servers allocated to the given store.
|
||||
*
|
||||
* @param store The store to get the test server for
|
||||
* @return The allocated server or null if there isn't one
|
||||
* @return The allocated server(s), an empty list if there isn't one
|
||||
*/
|
||||
public static NodeRef findAllocatedTestServer(String store)
|
||||
public static List<NodeRef> findAllocatedTestServers(String store)
|
||||
{
|
||||
List<NodeRef>serverList = new ArrayList<NodeRef>();
|
||||
|
||||
FacesContext fc = FacesContext.getCurrentInstance();
|
||||
SearchService searchService = Repository.getServiceRegistry(fc).getSearchService();
|
||||
|
||||
@@ -257,18 +259,12 @@ public final class DeploymentUtil
|
||||
results = searchService.query(Repository.getStoreRef(),
|
||||
SearchService.LANGUAGE_LUCENE, query.toString());
|
||||
|
||||
if (results.length() == 1)
|
||||
if (results.length() > 0)
|
||||
{
|
||||
testServer = results.getNodeRef(0);
|
||||
for(int i = 0; i < results.length(); i++)
|
||||
{
|
||||
serverList.add(results.getNodeRef(i));
|
||||
}
|
||||
else if (results.length() > 1)
|
||||
{
|
||||
// get the first one and warn that we found many!
|
||||
testServer = results.getNodeRef(0);
|
||||
|
||||
if (logger.isWarnEnabled())
|
||||
logger.warn("More than one allocated test server for store '" +
|
||||
store + "' was found, should only be one, first one found returned!");
|
||||
}
|
||||
}
|
||||
finally
|
||||
@@ -279,7 +275,7 @@ public final class DeploymentUtil
|
||||
}
|
||||
}
|
||||
|
||||
return testServer;
|
||||
return serverList;
|
||||
}
|
||||
|
||||
/**
|
||||
|
@@ -162,8 +162,8 @@ public class ManageReviewTaskDialog extends ManageTaskDialog
|
||||
|
||||
// if a test server has already been allocated inform the dialog
|
||||
// that an update is needed
|
||||
NodeRef testServer = DeploymentUtil.findAllocatedTestServer(this.store);
|
||||
if (testServer != null)
|
||||
List<NodeRef> testServers = DeploymentUtil.findAllocatedTestServers(this.store);
|
||||
if (!testServers.isEmpty())
|
||||
{
|
||||
params.put("updateTestServer", "true");
|
||||
}
|
||||
|
@@ -24,6 +24,7 @@
|
||||
*/
|
||||
package org.alfresco.web.bean.wcm;
|
||||
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
import javax.faces.context.FacesContext;
|
||||
@@ -70,8 +71,8 @@ public class ReleaseTestServerDialog extends BaseDialogBean
|
||||
protected String finishImpl(FacesContext context, String outcome)
|
||||
throws Exception
|
||||
{
|
||||
NodeRef testServer = DeploymentUtil.findAllocatedTestServer(this.store);
|
||||
if (testServer != null)
|
||||
List<NodeRef> testServers = DeploymentUtil.findAllocatedTestServers(this.store);
|
||||
for(NodeRef testServer : testServers)
|
||||
{
|
||||
getNodeService().setProperty(testServer,
|
||||
WCMAppModel.PROP_DEPLOYSERVERALLOCATEDTO, null);
|
||||
|
@@ -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 at least one allocated server
|
||||
for(NodeRef allocatedServer : allocatedServers)
|
||||
{
|
||||
// there is an allocated server
|
||||
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
|
||||
// Get the display group
|
||||
String displayGroup = (String)server.getProperties().get(DeploymentServerConfig.PROP_GROUP);
|
||||
if(!currentDisplayGroup.equalsIgnoreCase(displayGroup))
|
||||
|
||||
helper.setCurrentDisplayGroup(displayGroup);
|
||||
if(helper.newGroup)
|
||||
{
|
||||
// yes title has changed - write out the new displayGroup
|
||||
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>");
|
||||
currentDisplayGroup = displayGroup;
|
||||
}
|
||||
renderTestServer(context, out, nodeService, server.getServerRef(), first);
|
||||
first = false;
|
||||
|
||||
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;' /> ");
|
||||
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;' /> ");
|
||||
// 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
|
||||
{
|
||||
|
@@ -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);
|
||||
|
Reference in New Issue
Block a user