mirror of
https://github.com/Alfresco/acs-community-packaging.git
synced 2026-09-16 18:13:21 +00:00
Merged V2.2 to HEAD
7386: JSF component to view, add, edit and remove deployment server configuration
Added new step to create/edit website wizard to collect and edit deployment server configuration
Enabled the copying of deployment server config when creating one web project from another
Added new icons to tell apart Alfresco Server vs. File System deployments
Updated UI to use 'friendly' server name when possible
git-svn-id: https://svn.alfresco.com/repos/alfresco-enterprise/alfresco/HEAD/root@8351 c4b6b30b-aa2e-2d43-bbcb-ca4b014f7261
This commit is contained in:
@@ -988,7 +988,6 @@ website_details=Web Project Details
|
||||
create_website_step1_title=Step One - Web Project Details
|
||||
create_website_step1_desc=Enter the information about the web project.
|
||||
website_dnsname=DNS name
|
||||
website_deployto=Deploy To
|
||||
validation_invalid_dns_name=Invalid website DNS name: only alpha-numeric and non-initial/final hyphen characters are allowed (max length < 64).
|
||||
website_webapp=Default Webapp
|
||||
website_createfrom=Create From Existing Web Project
|
||||
@@ -1018,22 +1017,25 @@ form_template_templates=Configure Templates
|
||||
form_template_templates_desc=Setup the Templates you want to use for the Web Form {0} in Web Project {1}.
|
||||
form_template_workflow=Configure Workflow
|
||||
form_template_workflow_desc=Configure the workflow defaults for this Web Project
|
||||
create_website_step3_title=Step Three - Configure Web Content Forms
|
||||
create_website_step3_desc=Select and configure web forms for generating site content.
|
||||
create_website_step3_title=Step Three - Configure Deployment Servers
|
||||
create_website_step3_desc=Configure deployment servers for the web project.
|
||||
website_deployment=Configure Deployment Servers
|
||||
create_website_step4_title=Step Four - Configure Web Content Forms
|
||||
create_website_step4_desc=Select and configure web forms for generating site content.
|
||||
website_select_form=Select Web Forms
|
||||
website_select_templates=Select Templates
|
||||
website_selected_templates=Selected Templates
|
||||
website_settings=Configure Workflow
|
||||
create_website_step4_title=Step Four - Configure Workflow
|
||||
create_website_step4_desc=Select and configure workflow for non-form generated assets.
|
||||
create_website_step5_title=Step Five - Configure Workflow
|
||||
create_website_step5_desc=Select and configure workflow for non-form generated assets.
|
||||
website_select_workflows=Select Workflows
|
||||
website_selected_workflows=Selected Workflows
|
||||
website_invite=Add Users
|
||||
create_website_step5_title=Step Five - Add Users
|
||||
create_website_step5_desc=Select users and their roles.
|
||||
create_website_step6_title=Step Six - Add Users
|
||||
create_website_step6_desc=Select users and their roles.
|
||||
website_notify=Email Users
|
||||
create_website_step6_title=Step Six - Email Users
|
||||
create_website_step6_desc=Notify the website users.
|
||||
create_website_step7_title=Step Seven - Email Users
|
||||
create_website_step7_desc=Notify the website users.
|
||||
create_website_finish_instruction=To close this wizard and create your web project space click Finish. To review or change your selections click Back.
|
||||
create_website_summary_users=Users and Roles
|
||||
edit_website_title=Edit Web Project Wizard
|
||||
@@ -1045,6 +1047,12 @@ workflow_not_configured=Workflow not configured
|
||||
error_filename_pattern=Error with workflow filename pattern: {0}
|
||||
workflow_not_set=no workflow
|
||||
rendering_engines_selected=Templates Selected
|
||||
edit_website_step2_title=Step Two - Configure Deployment Servers
|
||||
edit_website_step2_desc=Configure deployment servers for the web project.
|
||||
edit_website_step3_title=Step Three - Configure Web Content Forms
|
||||
edit_website_step3_desc=Select and configure web forms for generating site content.
|
||||
edit_website_step4_title=Step Four - Configure Workflow
|
||||
edit_website_step4_desc=Select and configure workflow for non-form generated assets.
|
||||
|
||||
# Invite web users wizard messages
|
||||
invite_website_users=Invite Web Project Users
|
||||
@@ -1211,6 +1219,23 @@ deploy_status_in_progress=IN PROGRESS
|
||||
deploy_status_live=LIVE
|
||||
deploy_status_failed=FAILED
|
||||
deploy_status_partial=PARTIAL FAILURE
|
||||
deploy_add_alf_receiver=Add Alfresco Server Receiver (ASR)
|
||||
deploy_add_file_receiver=Add File System Receiver (FSR)
|
||||
deploy_server_type_live=Live Server
|
||||
deploy_server_type_test=Test Server
|
||||
deploy_server_type=Type
|
||||
deploy_server_name=Name
|
||||
deploy_server_host=Host
|
||||
deploy_server_port=Port
|
||||
deploy_server_username=Username
|
||||
deploy_server_password=Password
|
||||
deploy_server_url=URL
|
||||
deploy_server_source_path=Source Path
|
||||
deploy_server_target_name=Target Name
|
||||
deploy_automatically=Auto Deploy
|
||||
edit_deploy_server=Edit Deployment Server Details
|
||||
delete_deploy_server=Delete Deployment Server
|
||||
no_deploy_servers=No deployment servers have been configured.
|
||||
reason=Reason
|
||||
snapshot=Snapshot
|
||||
content_launch=Content Launch
|
||||
|
||||
@@ -22,30 +22,36 @@
|
||||
description-id="create_website_step2_desc"
|
||||
instruction-id="default_instruction" />
|
||||
</step>
|
||||
<step name="forms" title-id="website_forms" description-id="create_website_step3_desc">
|
||||
<page path="/jsp/wcm/create-website-wizard/forms.jsp"
|
||||
<step name="deployment" title-id="website_deployment" description-id="create_website_step3_desc">
|
||||
<page path="/jsp/wcm/create-website-wizard/deployment.jsp"
|
||||
title-id="create_website_step3_title"
|
||||
description-id="create_website_step3_desc"
|
||||
instruction-id="default_instruction" />
|
||||
</step>
|
||||
<step name="settings" title-id="website_settings" description-id="create_website_step4_desc">
|
||||
<page path="/jsp/wcm/create-website-wizard/settings.jsp"
|
||||
<step name="forms" title-id="website_forms" description-id="create_website_step4_desc">
|
||||
<page path="/jsp/wcm/create-website-wizard/forms.jsp"
|
||||
title-id="create_website_step4_title"
|
||||
description-id="create_website_step4_desc"
|
||||
instruction-id="default_instruction" />
|
||||
</step>
|
||||
<step name="invite" title-id="website_invite" description-id="create_website_step5_desc">
|
||||
<page path="/jsp/wcm/create-website-wizard/invite.jsp"
|
||||
<step name="settings" title-id="website_settings" description-id="create_website_step5_desc">
|
||||
<page path="/jsp/wcm/create-website-wizard/settings.jsp"
|
||||
title-id="create_website_step5_title"
|
||||
description-id="create_website_step5_desc"
|
||||
instruction-id="default_instruction" />
|
||||
</step>
|
||||
<step name="notify" title-id="website_notify" description-id="create_website_step6_desc">
|
||||
<page path="/jsp/wcm/create-website-wizard/notify.jsp"
|
||||
<step name="invite" title-id="website_invite" description-id="create_website_step6_desc">
|
||||
<page path="/jsp/wcm/create-website-wizard/invite.jsp"
|
||||
title-id="create_website_step6_title"
|
||||
description-id="create_website_step6_desc"
|
||||
instruction-id="default_instruction" />
|
||||
</step>
|
||||
<step name="notify" title-id="website_notify" description-id="create_website_step7_desc">
|
||||
<page path="/jsp/wcm/create-website-wizard/notify.jsp"
|
||||
title-id="create_website_step7_title"
|
||||
description-id="create_website_step7_desc"
|
||||
instruction-id="default_instruction" />
|
||||
</step>
|
||||
<step name="summary" title-id="summary" description-id="summary_step_description">
|
||||
<page path="/jsp/wcm/create-website-wizard/summary.jsp"
|
||||
title-id="summary"
|
||||
@@ -64,16 +70,22 @@
|
||||
description-id="create_website_step1_desc"
|
||||
instruction-id="default_instruction" />
|
||||
</step>
|
||||
<step name="forms" title-id="website_forms" description-id="create_website_step2_desc">
|
||||
<page path="/jsp/wcm/create-website-wizard/forms.jsp"
|
||||
title-id="create_website_step2_title"
|
||||
description-id="create_website_step2_desc"
|
||||
<step name="deployment" title-id="website_deployment" description-id="edit_website_step2_desc">
|
||||
<page path="/jsp/wcm/create-website-wizard/deployment.jsp"
|
||||
title-id="edit_website_step2_title"
|
||||
description-id="edit_website_step2_desc"
|
||||
instruction-id="default_instruction" />
|
||||
</step>
|
||||
<step name="settings" title-id="website_settings" description-id="create_website_step3_desc">
|
||||
<step name="forms" title-id="website_forms" description-id="edit_website_step3_desc">
|
||||
<page path="/jsp/wcm/create-website-wizard/forms.jsp"
|
||||
title-id="edit_website_step3_title"
|
||||
description-id="edit_website_step3_desc"
|
||||
instruction-id="default_instruction" />
|
||||
</step>
|
||||
<step name="settings" title-id="website_settings" description-id="edit_website_step4_desc">
|
||||
<page path="/jsp/wcm/create-website-wizard/settings.jsp"
|
||||
title-id="create_website_step3_title"
|
||||
description-id="create_website_step3_desc"
|
||||
title-id="edit_website_step4_title"
|
||||
description-id="edit_website_step4_desc"
|
||||
instruction-id="default_instruction" />
|
||||
</step>
|
||||
<step name="summary" title-id="summary" description-id="summary_step_description">
|
||||
|
||||
@@ -71,6 +71,7 @@ import org.alfresco.web.forms.FormNotFoundException;
|
||||
import org.alfresco.web.forms.FormsService;
|
||||
import org.alfresco.web.forms.RenderingEngineTemplate;
|
||||
import org.alfresco.web.ui.common.Utils;
|
||||
import org.alfresco.web.ui.common.component.UIActionLink;
|
||||
import org.alfresco.web.ui.common.component.UIListItem;
|
||||
import org.alfresco.web.ui.common.component.UISelectList;
|
||||
import org.alfresco.web.ui.wcm.WebResources;
|
||||
@@ -94,6 +95,7 @@ public class CreateWebsiteWizard extends BaseWizardBean
|
||||
// wizard step names (that are referenced)
|
||||
private static final String STEP_DETAILS = "details";
|
||||
private static final String STEP_FORMS = "forms";
|
||||
private static final String STEP_DEPLOYMENT = "deployment";
|
||||
|
||||
private static final String MATCH_DEFAULT = ".*";
|
||||
|
||||
@@ -143,19 +145,25 @@ public class CreateWebsiteWizard extends BaseWizardBean
|
||||
/** datamodel for table of selected workflows */
|
||||
transient private DataModel workflowsDataModel = null;
|
||||
|
||||
/** transient list of workflow UIListItem objects */
|
||||
transient private List<UIListItem> workflowsList = null;
|
||||
|
||||
/** list of workflow wrapper objects */
|
||||
protected List<WorkflowWrapper> workflows = null;
|
||||
|
||||
/** Current workflow for dialog context */
|
||||
protected WorkflowConfiguration actionWorkflow = null;
|
||||
|
||||
/** Map and list of deployment servers */
|
||||
protected Map<String, DeploymentServerConfig> deployServersMap = null;
|
||||
protected List<DeploymentServerConfig> deployServersList = null;
|
||||
|
||||
/** Current state of deploy server editing */
|
||||
protected DeploymentServerConfig currentDeployServer = null;
|
||||
protected Map<String, Object> editedDeployServerProps = null;
|
||||
protected boolean inAddDeployServerMode = false;
|
||||
protected String addDeployServerType = WCMAppModel.CONSTRAINT_FILEDEPLOY;
|
||||
|
||||
/** Data for virtualization server notification */
|
||||
private SandboxInfo sandboxInfo;
|
||||
|
||||
|
||||
// ------------------------------------------------------------------------------
|
||||
// Wizard implementation
|
||||
|
||||
@@ -171,7 +179,7 @@ public class CreateWebsiteWizard extends BaseWizardBean
|
||||
this.title = null;
|
||||
this.description = null;
|
||||
this.isSource = false;
|
||||
clearFormsWorkflowsAndUsers();
|
||||
clearFormsWorkflowsDeploymentAndUsers();
|
||||
this.createFrom = CREATE_EMPTY;
|
||||
// requry existing web projects list every 10 seconds
|
||||
this.webProjectsList = new ExpiringValueCache<List<UIListItem>>(1000L*10L);
|
||||
@@ -180,13 +188,21 @@ public class CreateWebsiteWizard extends BaseWizardBean
|
||||
this.showAllSourceProjects = false;
|
||||
}
|
||||
|
||||
private void clearFormsWorkflowsAndUsers()
|
||||
private void clearFormsWorkflowsDeploymentAndUsers()
|
||||
{
|
||||
this.formsDataModel = null;
|
||||
this.forms = new ArrayList<FormWrapper>(8);
|
||||
this.workflowsDataModel = null;
|
||||
this.workflows = new ArrayList<WorkflowWrapper>(4);
|
||||
|
||||
// reset all deployment data
|
||||
this.deployServersMap = new HashMap<String, DeploymentServerConfig>(4, 1.0f);
|
||||
this.deployServersList = new ArrayList<DeploymentServerConfig>(4);
|
||||
this.currentDeployServer = null;
|
||||
this.editedDeployServerProps = new HashMap<String, Object>(12, 1.0f);
|
||||
this.inAddDeployServerMode = false;
|
||||
this.addDeployServerType = WCMAppModel.CONSTRAINT_FILEDEPLOY;
|
||||
|
||||
// init the dependant bean we are using for the invite users pages
|
||||
InviteWebsiteUsersWizard wiz = getInviteUsersWizard();
|
||||
wiz.init(null);
|
||||
@@ -266,7 +282,8 @@ public class CreateWebsiteWizard extends BaseWizardBean
|
||||
// set the property on the node to reference the root AVM store
|
||||
getNodeService().setProperty(nodeRef, WCMAppModel.PROP_AVMSTORE, avmStore);
|
||||
|
||||
// persist the forms, templates, workflows and workflow defaults to the model for this web project
|
||||
// persist the forms, templates, workflows, workflow defaults and deployment
|
||||
// config to the model for this web project
|
||||
saveWebProjectModel(nodeRef);
|
||||
|
||||
// navigate to the Websites folder so we can see the newly created folder
|
||||
@@ -311,7 +328,8 @@ public class CreateWebsiteWizard extends BaseWizardBean
|
||||
}
|
||||
|
||||
/**
|
||||
* Persist the forms, templates, workflows and workflow defaults to the model for this web project
|
||||
* Persist the forms, templates, workflows, workflow defaults and deployment config
|
||||
* to the model for this web project
|
||||
*
|
||||
* @param nodeRef NodeRef to the web project
|
||||
*/
|
||||
@@ -385,7 +403,7 @@ public class CreateWebsiteWizard extends BaseWizardBean
|
||||
}
|
||||
}
|
||||
|
||||
// finally walk each web project workflow definition and save defaults for each
|
||||
// walk each web project workflow definition and save defaults for each
|
||||
for (WorkflowWrapper workflow : this.workflows)
|
||||
{
|
||||
props.clear();
|
||||
@@ -410,11 +428,24 @@ public class CreateWebsiteWizard extends BaseWizardBean
|
||||
getNodeService().addAspect(workflowRef, WCMAppModel.ASPECT_FILENAMEPATTERN, props);
|
||||
}
|
||||
}
|
||||
|
||||
// finally walk through the deployment config and save
|
||||
for (DeploymentServerConfig server : this.deployServersList)
|
||||
{
|
||||
Map<QName, Serializable> repoProps = server.getRepoProps();
|
||||
|
||||
getNodeService().createNode(nodeRef, WCMAppModel.ASSOC_DEPLOYMENTSERVER,
|
||||
WCMAppModel.ASSOC_DEPLOYMENTSERVER, WCMAppModel.TYPE_DEPLOYMENTSERVER,
|
||||
repoProps);
|
||||
|
||||
if (logger.isDebugEnabled())
|
||||
logger.debug("Saved deploymentserver node using repo props: " + repoProps);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Restore the forms, templates and workflows from the model for a web project. Can also
|
||||
* optional restore the basic node propetries and user details.
|
||||
* Restore the forms, templates, workflows and deployment config from the model for a web project.
|
||||
* Can also optionally restore the basic node propetries and user details.
|
||||
*
|
||||
* @param nodeRef NodeRef to the web project to load model from
|
||||
* @param loadProperties Load the basic properties such as name, title, DNS.
|
||||
@@ -541,6 +572,22 @@ public class CreateWebsiteWizard extends BaseWizardBean
|
||||
this.workflows.add(wfWrapper);
|
||||
}
|
||||
}
|
||||
|
||||
// load the deployment server config objects
|
||||
List<ChildAssociationRef> serverRefs = getNodeService().getChildAssocs(
|
||||
nodeRef, WCMAppModel.ASSOC_DEPLOYMENTSERVER, RegexQNamePattern.MATCH_ALL);
|
||||
for (ChildAssociationRef sChildRef : serverRefs)
|
||||
{
|
||||
NodeRef serverRef = sChildRef.getChildRef();
|
||||
DeploymentServerConfig server = new DeploymentServerConfig(
|
||||
serverRef, getNodeService().getProperties(serverRef));
|
||||
|
||||
this.deployServersList.add(server);
|
||||
this.deployServersMap.put(server.getId(), server);
|
||||
|
||||
if (logger.isDebugEnabled())
|
||||
logger.debug("Loaded deploy server config: " + server);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -895,9 +942,9 @@ public class CreateWebsiteWizard extends BaseWizardBean
|
||||
public String next()
|
||||
{
|
||||
String stepName = Application.getWizardManager().getCurrentStepName();
|
||||
if (STEP_FORMS.equals(stepName))
|
||||
if (STEP_DEPLOYMENT.equals(stepName))
|
||||
{
|
||||
// if we have just entered the Forms page and the Create From page data has changed
|
||||
// if we have just entered the deployment page and the Create From page data has changed
|
||||
// then we need to pre-populate the Forms etc. from the template web project
|
||||
updateModelOnCreateFromChange();
|
||||
}
|
||||
@@ -915,13 +962,13 @@ public class CreateWebsiteWizard extends BaseWizardBean
|
||||
{
|
||||
if (this.sourceWebProject != null && this.sourceWebProject.length != 0)
|
||||
{
|
||||
clearFormsWorkflowsAndUsers();
|
||||
clearFormsWorkflowsDeploymentAndUsers();
|
||||
loadWebProjectModel(new NodeRef(this.sourceWebProject[0]), false, true);
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
clearFormsWorkflowsAndUsers();
|
||||
clearFormsWorkflowsDeploymentAndUsers();
|
||||
}
|
||||
|
||||
this.createFromValueChanged = false;
|
||||
@@ -989,6 +1036,155 @@ public class CreateWebsiteWizard extends BaseWizardBean
|
||||
return result;
|
||||
}
|
||||
|
||||
// ------------------------------------------------------------------------------
|
||||
// Deployment server configuration
|
||||
|
||||
/**
|
||||
* @return Determines whether a deployment server is being added
|
||||
*/
|
||||
public boolean isInAddDeployServerMode()
|
||||
{
|
||||
return this.inAddDeployServerMode;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return The type of server receiver to add, either 'alfresco' or 'file'
|
||||
*/
|
||||
public String getAddDeployServerType()
|
||||
{
|
||||
return this.addDeployServerType;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return The deploy server currently being added or edited
|
||||
*/
|
||||
public DeploymentServerConfig getCurrentDeployServer()
|
||||
{
|
||||
return this.currentDeployServer;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return The properties of the deploy server currently being added or edited
|
||||
*/
|
||||
public Map<String, Object> getEditedDeployServerProperties()
|
||||
{
|
||||
return this.editedDeployServerProps;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return Map of the deployment servers currently configured for the web project
|
||||
*/
|
||||
public List<DeploymentServerConfig> getDeployServers()
|
||||
{
|
||||
return this.deployServersList;
|
||||
}
|
||||
|
||||
/**
|
||||
* Sets up the wizard for adding a new Alfresco Server Receiver
|
||||
*
|
||||
* @return null outcome to stay on same page
|
||||
*/
|
||||
public String addAlfrescoServerReceiver()
|
||||
{
|
||||
this.addDeployServerType = WCMAppModel.CONSTRAINT_ALFDEPLOY;
|
||||
this.inAddDeployServerMode = true;
|
||||
|
||||
// create an empty server config
|
||||
this.currentDeployServer = new DeploymentServerConfig(this.addDeployServerType);
|
||||
this.editedDeployServerProps.clear();
|
||||
|
||||
// refresh the current page
|
||||
return null;
|
||||
}
|
||||
|
||||
/**
|
||||
* Sets up the wizard for adding a new File System Receiver
|
||||
*
|
||||
* @return null outcome to stay on same page
|
||||
*/
|
||||
public String addFileSystemReceiver()
|
||||
{
|
||||
this.addDeployServerType = WCMAppModel.CONSTRAINT_FILEDEPLOY;
|
||||
this.inAddDeployServerMode = true;
|
||||
|
||||
// create an empty server config
|
||||
this.currentDeployServer = new DeploymentServerConfig(this.addDeployServerType);
|
||||
this.editedDeployServerProps.clear();
|
||||
|
||||
// refresh the current page
|
||||
return null;
|
||||
}
|
||||
|
||||
public void editDeploymentServerConfig(ActionEvent event)
|
||||
{
|
||||
UIActionLink link = (UIActionLink)event.getComponent();
|
||||
Map<String, String> params = link.getParameterMap();
|
||||
String id = params.get("id");
|
||||
if (id != null && id.length() != 0)
|
||||
{
|
||||
this.inAddDeployServerMode = false;
|
||||
|
||||
// setup the config object to edit
|
||||
this.currentDeployServer = this.deployServersMap.get(id);
|
||||
this.editedDeployServerProps.clear();
|
||||
this.editedDeployServerProps.putAll(this.currentDeployServer.getProperties());
|
||||
|
||||
if (logger.isDebugEnabled())
|
||||
logger.debug("Set current deploy server to: " + this.currentDeployServer);
|
||||
}
|
||||
}
|
||||
|
||||
public void deleteDeploymentServerConfig(ActionEvent event)
|
||||
{
|
||||
UIActionLink link = (UIActionLink)event.getComponent();
|
||||
Map<String, String> params = link.getParameterMap();
|
||||
String id = params.get("id");
|
||||
if (id != null && id.length() != 0)
|
||||
{
|
||||
this.currentDeployServer = null;
|
||||
this.editedDeployServerProps.clear();
|
||||
this.inAddDeployServerMode = false;
|
||||
|
||||
// remove the config object from the list and map
|
||||
DeploymentServerConfig dsc = this.deployServersMap.get(id);
|
||||
if (dsc != null)
|
||||
{
|
||||
this.deployServersList.remove(dsc);
|
||||
this.deployServersMap.remove(dsc.getId());
|
||||
|
||||
if (logger.isDebugEnabled())
|
||||
logger.debug("Removed deploy server config with id: " + id);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public String addDeploymentServerConfig()
|
||||
{
|
||||
// add the new config to the list and map
|
||||
this.deployServersList.add(this.currentDeployServer);
|
||||
this.deployServersMap.put(this.currentDeployServer.getId(),
|
||||
this.currentDeployServer);
|
||||
|
||||
// save the changes
|
||||
return saveDeploymentServerConfig();
|
||||
}
|
||||
|
||||
public String saveDeploymentServerConfig()
|
||||
{
|
||||
// set the edited properties
|
||||
this.currentDeployServer.setProperties(this.editedDeployServerProps);
|
||||
|
||||
if (logger.isDebugEnabled())
|
||||
logger.debug("Updated deploy server config: " + this.currentDeployServer);
|
||||
|
||||
// reset state
|
||||
this.currentDeployServer = null;
|
||||
this.editedDeployServerProps.clear();
|
||||
this.inAddDeployServerMode = false;
|
||||
|
||||
// refresh the current page
|
||||
return null;
|
||||
}
|
||||
|
||||
// ------------------------------------------------------------------------------
|
||||
// Define Web Content Workflows page
|
||||
@@ -1181,7 +1377,7 @@ public class CreateWebsiteWizard extends BaseWizardBean
|
||||
item.setImage(WebResources.IMAGE_WORKFLOW_32);
|
||||
items.add(item);
|
||||
}
|
||||
this.workflowsList = items;
|
||||
|
||||
return items;
|
||||
}
|
||||
|
||||
|
||||
@@ -0,0 +1,248 @@
|
||||
/*
|
||||
* Copyright (C) 2005-2007 Alfresco Software Limited.
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU General Public License
|
||||
* as published by the Free Software Foundation; either version 2
|
||||
* of the License, or (at your option) any later version.
|
||||
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program; if not, write to the Free Software
|
||||
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
|
||||
|
||||
* As a special exception to the terms and conditions of version 2.0 of
|
||||
* the GPL, you may redistribute this Program in connection with Free/Libre
|
||||
* and Open Source Software ("FLOSS") applications as described in Alfresco's
|
||||
* FLOSS exception. You should have recieved a copy of the text describing
|
||||
* the FLOSS exception, and it is also available here:
|
||||
* http://www.alfresco.com/legal/licensing"
|
||||
*/
|
||||
package org.alfresco.web.bean.wcm;
|
||||
|
||||
import java.io.Serializable;
|
||||
import java.util.HashMap;
|
||||
import java.util.Map;
|
||||
|
||||
import org.alfresco.model.WCMAppModel;
|
||||
import org.alfresco.service.cmr.repository.NodeRef;
|
||||
import org.alfresco.service.namespace.QName;
|
||||
import org.alfresco.util.GUID;
|
||||
|
||||
/**
|
||||
* Object holding the configuration for a deployment server.
|
||||
*
|
||||
* @author Gavin Cornwell
|
||||
*/
|
||||
public final class DeploymentServerConfig implements Serializable
|
||||
{
|
||||
public static final String PROP_TYPE = "type";
|
||||
public static final String PROP_NAME = "name";
|
||||
public static final String PROP_HOST = "host";
|
||||
public static final String PROP_PORT = "port";
|
||||
public static final String PROP_USER = "username";
|
||||
public static final String PROP_PASSWORD = "password";
|
||||
public static final String PROP_URL = "url";
|
||||
public static final String PROP_SOURCE_PATH = "sourcePath";
|
||||
public static final String PROP_TARGET_NAME = "targetName";
|
||||
public static final String PROP_ALLOCATED_TO = "allocatedTo";
|
||||
public static final String PROP_ON_APPROVAL = "onApproval";
|
||||
|
||||
protected String id;
|
||||
protected NodeRef serverRef;
|
||||
protected String deployType;
|
||||
protected Map<String, Object> props;
|
||||
|
||||
private static final long serialVersionUID = -8894113751463815194L;
|
||||
|
||||
public DeploymentServerConfig(String deployType)
|
||||
{
|
||||
this.id = GUID.generate();
|
||||
this.deployType = deployType;
|
||||
this.props = new HashMap<String, Object>(12, 1.0f);
|
||||
}
|
||||
|
||||
public DeploymentServerConfig(NodeRef serverRef, Map<QName, Serializable> repoProps)
|
||||
{
|
||||
this.id = GUID.generate();
|
||||
this.serverRef = serverRef;
|
||||
this.deployType = (String)repoProps.get(WCMAppModel.PROP_DEPLOYTYPE);
|
||||
|
||||
populateFromRepoProps(repoProps);
|
||||
}
|
||||
|
||||
public String toString()
|
||||
{
|
||||
StringBuilder buffer = new StringBuilder(super.toString());
|
||||
buffer.append(" (id=").append(this.id);
|
||||
buffer.append(" serverRef=").append(this.serverRef);
|
||||
buffer.append(" deployType=").append(this.deployType);
|
||||
buffer.append(" props=").append(this.props).append(")");
|
||||
return buffer.toString();
|
||||
}
|
||||
|
||||
public String getId()
|
||||
{
|
||||
return this.id;
|
||||
}
|
||||
|
||||
public NodeRef getServerRef()
|
||||
{
|
||||
return this.serverRef;
|
||||
}
|
||||
|
||||
public String getDeployType()
|
||||
{
|
||||
return this.deployType;
|
||||
}
|
||||
|
||||
public Map<String, Object> getProperties()
|
||||
{
|
||||
return this.props;
|
||||
}
|
||||
|
||||
public void setProperties(Map<String, Object> props)
|
||||
{
|
||||
this.props = new HashMap<String, Object>(props.size());
|
||||
this.props.putAll(props);
|
||||
}
|
||||
|
||||
public Map<QName, Serializable> getRepoProps()
|
||||
{
|
||||
Map<QName, Serializable> repoProps = new HashMap<QName, Serializable>(8);
|
||||
|
||||
repoProps.put(WCMAppModel.PROP_DEPLOYTYPE, this.deployType);
|
||||
repoProps.put(WCMAppModel.PROP_DEPLOYSERVERTYPE, (Serializable)this.props.get(PROP_TYPE));
|
||||
|
||||
if (this.props.get(PROP_HOST) != null && ((String)this.props.get(PROP_HOST)).length() > 0)
|
||||
{
|
||||
repoProps.put(WCMAppModel.PROP_DEPLOYSERVERHOST, (Serializable)this.props.get(PROP_HOST));
|
||||
}
|
||||
|
||||
if (this.props.get(PROP_PORT) != null && ((String)this.props.get(PROP_PORT)).length() > 0)
|
||||
{
|
||||
repoProps.put(WCMAppModel.PROP_DEPLOYSERVERPORT, new Integer((String)this.props.get(PROP_PORT)));
|
||||
}
|
||||
|
||||
if (this.props.get(PROP_NAME) != null && ((String)this.props.get(PROP_NAME)).length() > 0)
|
||||
{
|
||||
repoProps.put(WCMAppModel.PROP_DEPLOYSERVERNAME, (Serializable)this.props.get(PROP_NAME));
|
||||
}
|
||||
|
||||
if (this.props.get(PROP_USER) != null && ((String)this.props.get(PROP_USER)).length() > 0)
|
||||
{
|
||||
repoProps.put(WCMAppModel.PROP_DEPLOYSERVERUSERNAME, (Serializable)this.props.get(PROP_USER));
|
||||
}
|
||||
|
||||
if (this.props.get(PROP_PASSWORD) != null && ((String)this.props.get(PROP_PASSWORD)).length() > 0)
|
||||
{
|
||||
repoProps.put(WCMAppModel.PROP_DEPLOYSERVERPASSWORD, (Serializable)this.props.get(PROP_PASSWORD));
|
||||
}
|
||||
|
||||
if (this.props.get(PROP_URL) != null && ((String)this.props.get(PROP_URL)).length() > 0)
|
||||
{
|
||||
repoProps.put(WCMAppModel.PROP_DEPLOYSERVERURL, (Serializable)this.props.get(PROP_URL));
|
||||
}
|
||||
|
||||
if (this.props.get(PROP_SOURCE_PATH) != null && ((String)this.props.get(PROP_SOURCE_PATH)).length() > 0)
|
||||
{
|
||||
repoProps.put(WCMAppModel.PROP_DEPLOYSOURCEPATH, (Serializable)this.props.get(PROP_SOURCE_PATH));
|
||||
}
|
||||
|
||||
if (this.props.get(PROP_ALLOCATED_TO) != null && ((String)this.props.get(PROP_ALLOCATED_TO)).length() > 0)
|
||||
{
|
||||
repoProps.put(WCMAppModel.PROP_DEPLOYSERVERALLOCATEDTO, (Serializable)this.props.get(PROP_ALLOCATED_TO));
|
||||
}
|
||||
|
||||
// only save the target if it's an FSR (File System Receiver)
|
||||
if (WCMAppModel.CONSTRAINT_FILEDEPLOY.equals(this.deployType))
|
||||
{
|
||||
if (this.props.get(PROP_TARGET_NAME) != null && ((String)this.props.get(PROP_TARGET_NAME)).length() > 0)
|
||||
{
|
||||
repoProps.put(WCMAppModel.PROP_DEPLOYSERVERTARGET, (Serializable)this.props.get(PROP_TARGET_NAME));
|
||||
}
|
||||
}
|
||||
|
||||
// only save the approval flag if the server type is a 'live' server
|
||||
if (WCMAppModel.CONSTRAINT_LIVESERVER.equals(this.props.get(PROP_TYPE)))
|
||||
{
|
||||
if (this.props.get(PROP_ON_APPROVAL) != null)
|
||||
{
|
||||
repoProps.put(WCMAppModel.PROP_DEPLOYONAPPROVAL, (Serializable)this.props.get(PROP_ON_APPROVAL));
|
||||
}
|
||||
}
|
||||
|
||||
return repoProps;
|
||||
}
|
||||
|
||||
protected void populateFromRepoProps(Map<QName, Serializable> repoProps)
|
||||
{
|
||||
this.props = new HashMap<String, Object>(repoProps.size());
|
||||
|
||||
this.props.put(PROP_TYPE, (String)repoProps.get(WCMAppModel.PROP_DEPLOYSERVERTYPE));
|
||||
this.props.put(PROP_HOST, (String)repoProps.get(WCMAppModel.PROP_DEPLOYSERVERHOST));
|
||||
|
||||
if (repoProps.get(WCMAppModel.PROP_DEPLOYSERVERNAME) != null)
|
||||
{
|
||||
this.props.put(PROP_NAME, (String)repoProps.get(WCMAppModel.PROP_DEPLOYSERVERNAME));
|
||||
}
|
||||
|
||||
if (repoProps.get(WCMAppModel.PROP_DEPLOYSERVERPORT) != null)
|
||||
{
|
||||
Integer port = (Integer)repoProps.get(WCMAppModel.PROP_DEPLOYSERVERPORT);
|
||||
this.props.put(PROP_PORT, port.toString());
|
||||
}
|
||||
|
||||
if (repoProps.get(WCMAppModel.PROP_DEPLOYSERVERUSERNAME) != null)
|
||||
{
|
||||
this.props.put(PROP_USER, (String)repoProps.get(WCMAppModel.PROP_DEPLOYSERVERUSERNAME));
|
||||
}
|
||||
|
||||
if (repoProps.get(WCMAppModel.PROP_DEPLOYSERVERPASSWORD) != null)
|
||||
{
|
||||
this.props.put(PROP_PASSWORD, (String)repoProps.get(WCMAppModel.PROP_DEPLOYSERVERPASSWORD));
|
||||
}
|
||||
|
||||
if (repoProps.get(WCMAppModel.PROP_DEPLOYSERVERURL) != null)
|
||||
{
|
||||
this.props.put(PROP_URL, (String)repoProps.get(WCMAppModel.PROP_DEPLOYSERVERURL));
|
||||
}
|
||||
|
||||
if (repoProps.get(WCMAppModel.PROP_DEPLOYSOURCEPATH) != null)
|
||||
{
|
||||
this.props.put(PROP_SOURCE_PATH, (String)repoProps.get(WCMAppModel.PROP_DEPLOYSOURCEPATH));
|
||||
}
|
||||
|
||||
if (repoProps.get(WCMAppModel.PROP_DEPLOYSERVERALLOCATEDTO) != null)
|
||||
{
|
||||
this.props.put(PROP_ALLOCATED_TO, (String)repoProps.get(WCMAppModel.PROP_DEPLOYSERVERALLOCATEDTO));
|
||||
}
|
||||
|
||||
if (WCMAppModel.CONSTRAINT_FILEDEPLOY.equals(this.deployType))
|
||||
{
|
||||
if (repoProps.get(WCMAppModel.PROP_DEPLOYSERVERTARGET) != null)
|
||||
{
|
||||
this.props.put(PROP_TARGET_NAME, (String)repoProps.get(WCMAppModel.PROP_DEPLOYSERVERTARGET));
|
||||
}
|
||||
}
|
||||
|
||||
if (WCMAppModel.CONSTRAINT_LIVESERVER.equals(this.props.get(PROP_TYPE)))
|
||||
{
|
||||
Boolean onApproval = null;
|
||||
if (repoProps.get(WCMAppModel.PROP_DEPLOYONAPPROVAL) != null)
|
||||
{
|
||||
onApproval = (Boolean)repoProps.get(WCMAppModel.PROP_DEPLOYONAPPROVAL);
|
||||
}
|
||||
else
|
||||
{
|
||||
onApproval = Boolean.FALSE;
|
||||
}
|
||||
|
||||
this.props.put(PROP_ON_APPROVAL, onApproval);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -88,8 +88,8 @@ public class EditWebsiteWizard extends CreateWebsiteWizard
|
||||
getNodeService().setProperty(nodeRef, ContentModel.PROP_DESCRIPTION, this.description);
|
||||
getNodeService().setProperty(nodeRef, WCMAppModel.PROP_ISSOURCE, this.isSource);
|
||||
|
||||
// clear the existing settings for forms, template and workflows - then the existing methods
|
||||
// can be used to apply the modified and previous settings from scratch
|
||||
// clear the existing settings for forms, template, workflows and deployment - then
|
||||
// the existing methods can be used to apply the modified and previous settings from scratch
|
||||
clearWebProjectModel(nodeRef);
|
||||
|
||||
// change/create the root webapp name for the website
|
||||
@@ -106,7 +106,8 @@ public class EditWebsiteWizard extends CreateWebsiteWizard
|
||||
|
||||
// TODO: allow change of dns name - via store rename functionality
|
||||
|
||||
// persist the forms, templates, workflows and workflow defaults to the model for this web project
|
||||
// persist the forms, templates, workflows, workflow defaults and deployment config
|
||||
// to the model for this web project
|
||||
saveWebProjectModel(nodeRef);
|
||||
|
||||
return AlfrescoNavigationHandler.CLOSE_WIZARD_OUTCOME;
|
||||
@@ -133,5 +134,12 @@ public class EditWebsiteWizard extends CreateWebsiteWizard
|
||||
{
|
||||
getNodeService().removeChild(nodeRef, ref.getChildRef());
|
||||
}
|
||||
|
||||
List<ChildAssociationRef> serverRefs = getNodeService().getChildAssocs(
|
||||
nodeRef, WCMAppModel.ASSOC_DEPLOYMENTSERVER, RegexQNamePattern.MATCH_ALL);
|
||||
for (ChildAssociationRef ref : serverRefs)
|
||||
{
|
||||
getNodeService().removeChild(nodeRef, ref.getChildRef());
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -436,6 +436,7 @@ public class UIDeployWebsite extends UIInput
|
||||
String contextPath = context.getExternalContext().getRequestContextPath();
|
||||
|
||||
Map<QName, Serializable> props = nodeService.getProperties(server);
|
||||
String deployType = (String)props.get(WCMAppModel.PROP_DEPLOYTYPE);
|
||||
String serverName = (String)props.get(WCMAppModel.PROP_DEPLOYSERVERNAME);
|
||||
if (serverName == null || serverName.length() == 0)
|
||||
{
|
||||
@@ -481,7 +482,9 @@ public class UIDeployWebsite extends UIInput
|
||||
out.write("<div class='deployPanelIcon'>");
|
||||
out.write("<img src='");
|
||||
out.write(contextPath);
|
||||
out.write("/images/icons/deploy_server_large.gif' /></div></td>");
|
||||
out.write("/images/icons/deploy_server_");
|
||||
out.write(deployType);
|
||||
out.write(".gif' /></div></td>");
|
||||
out.write("<td style='background-image: url(");
|
||||
out.write(contextPath);
|
||||
out.write("/images/parts/deploy_panel_bg.gif); background-repeat: repeat-x; width: 100%;'>");
|
||||
|
||||
@@ -28,6 +28,7 @@ import java.io.IOException;
|
||||
import java.io.Serializable;
|
||||
import java.util.Date;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
import javax.faces.context.FacesContext;
|
||||
import javax.faces.context.ResponseWriter;
|
||||
@@ -36,6 +37,7 @@ import javax.transaction.UserTransaction;
|
||||
|
||||
import org.alfresco.model.ContentModel;
|
||||
import org.alfresco.model.WCMAppModel;
|
||||
import org.alfresco.repo.avm.actions.AVMDeploySnapshotAction;
|
||||
import org.alfresco.repo.domain.PropertyValue;
|
||||
import org.alfresco.sandbox.SandboxConstants;
|
||||
import org.alfresco.service.cmr.avm.AVMService;
|
||||
@@ -44,6 +46,7 @@ import org.alfresco.service.cmr.repository.ContentReader;
|
||||
import org.alfresco.service.cmr.repository.ContentService;
|
||||
import org.alfresco.service.cmr.repository.NodeRef;
|
||||
import org.alfresco.service.cmr.repository.NodeService;
|
||||
import org.alfresco.service.namespace.QName;
|
||||
import org.alfresco.service.namespace.RegexQNamePattern;
|
||||
import org.alfresco.web.app.Application;
|
||||
import org.alfresco.web.bean.repository.Repository;
|
||||
@@ -237,29 +240,42 @@ public class UIDeploymentReports extends SelfRenderingComponent
|
||||
context.getExternalContext().getRequestContextPath(), "innerwhite", "white");
|
||||
|
||||
// extract the information we need to display
|
||||
String server = (String)nodeService.getProperty(deploymentReport, WCMAppModel.PROP_DEPLOYSERVER);
|
||||
String creator = (String)nodeService.getProperty(deploymentReport, ContentModel.PROP_CREATOR);
|
||||
Date startTime = (Date)nodeService.getProperty(deploymentReport, WCMAppModel.PROP_DEPLOYSTARTTIME);
|
||||
Map<QName, Serializable> serverProps = nodeService.getProperties(deploymentReport);
|
||||
String server = (String)serverProps.get(WCMAppModel.PROP_DEPLOYSERVER);
|
||||
String serverName = (String)serverProps.get(WCMAppModel.PROP_DEPLOYSERVERNAMEUSED);
|
||||
if (serverName == null || serverName.length() == 0)
|
||||
{
|
||||
serverName = server;
|
||||
}
|
||||
|
||||
String deployType = WCMAppModel.CONSTRAINT_ALFDEPLOY;
|
||||
if (server.startsWith(AVMDeploySnapshotAction.FILE_SERVER_PREFIX))
|
||||
{
|
||||
deployType = WCMAppModel.CONSTRAINT_FILEDEPLOY;
|
||||
}
|
||||
|
||||
String creator = (String)serverProps.get(ContentModel.PROP_CREATOR);
|
||||
Date startTime = (Date)serverProps.get(WCMAppModel.PROP_DEPLOYSTARTTIME);
|
||||
String started = null;
|
||||
if (startTime != null)
|
||||
{
|
||||
started = Utils.getDateTimeFormat(context).format(startTime);
|
||||
}
|
||||
|
||||
Date endTime = (Date)nodeService.getProperty(deploymentReport, WCMAppModel.PROP_DEPLOYENDTIME);
|
||||
Date endTime = (Date)serverProps.get(WCMAppModel.PROP_DEPLOYENDTIME);
|
||||
String finished = null;
|
||||
if (endTime != null)
|
||||
{
|
||||
finished = Utils.getDateTimeFormat(context).format(endTime);
|
||||
}
|
||||
|
||||
Boolean success = (Boolean)nodeService.getProperty(deploymentReport, WCMAppModel.PROP_DEPLOYSUCCESSFUL);
|
||||
Boolean success = (Boolean)serverProps.get(WCMAppModel.PROP_DEPLOYSUCCESSFUL);
|
||||
if (success == null)
|
||||
{
|
||||
success = Boolean.FALSE;
|
||||
}
|
||||
|
||||
String failReason = (String)nodeService.getProperty(deploymentReport, WCMAppModel.PROP_DEPLOYFAILEDREASON);
|
||||
String failReason = (String)serverProps.get(WCMAppModel.PROP_DEPLOYFAILEDREASON);
|
||||
String content = "";
|
||||
ContentReader reader = contentService.getReader(deploymentReport, ContentModel.PROP_CONTENT);
|
||||
if (reader != null)
|
||||
@@ -276,7 +292,7 @@ public class UIDeploymentReports extends SelfRenderingComponent
|
||||
}
|
||||
|
||||
int snapshot = -1;
|
||||
Serializable snapshotObj = nodeService.getProperty(deploymentReport, WCMAppModel.PROP_DEPLOYVERSION);
|
||||
Serializable snapshotObj = serverProps.get(WCMAppModel.PROP_DEPLOYVERSION);
|
||||
if (snapshotObj != null && snapshotObj instanceof Integer)
|
||||
{
|
||||
snapshot = (Integer)snapshotObj;
|
||||
@@ -285,9 +301,11 @@ public class UIDeploymentReports extends SelfRenderingComponent
|
||||
out.write("<table cellspacing='0' cellpadding='2' border='0' width='100%'>");
|
||||
out.write("<tr><td width='40' valign='top'><img src='");
|
||||
out.write(context.getExternalContext().getRequestContextPath());
|
||||
out.write("/images/icons/deploy_server_large.gif' /></td><td>");
|
||||
out.write("/images/icons/deploy_server_");
|
||||
out.write(deployType);
|
||||
out.write(".gif' /></td><td>");
|
||||
out.write("<div class='mainHeading'>");
|
||||
out.write(server);
|
||||
out.write(serverName);
|
||||
out.write("</div><div style='margin-top: 3px;'><img src='");
|
||||
out.write(context.getExternalContext().getRequestContextPath());
|
||||
out.write("/images/icons/deploy_");
|
||||
|
||||
@@ -0,0 +1,839 @@
|
||||
/*
|
||||
* Copyright (C) 2005-2007 Alfresco Software Limited.
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU General Public License
|
||||
* as published by the Free Software Foundation; either version 2
|
||||
* of the License, or (at your option) any later version.
|
||||
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program; if not, write to the Free Software
|
||||
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
|
||||
|
||||
* As a special exception to the terms and conditions of version 2.0 of
|
||||
* the GPL, you may redistribute this Program in connection with Free/Libre
|
||||
* and Open Source Software ("FLOSS") applications as described in Alfresco's
|
||||
* FLOSS exception. You should have recieved a copy of the text describing
|
||||
* the FLOSS exception, and it is also available here:
|
||||
* http://www.alfresco.com/legal/licensing
|
||||
*/
|
||||
package org.alfresco.web.ui.wcm.component;
|
||||
|
||||
import java.io.IOException;
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
import java.util.ResourceBundle;
|
||||
|
||||
import javax.faces.component.UICommand;
|
||||
import javax.faces.component.UIComponent;
|
||||
import javax.faces.component.UIInput;
|
||||
import javax.faces.component.UIParameter;
|
||||
import javax.faces.component.UISelectBoolean;
|
||||
import javax.faces.component.UISelectItems;
|
||||
import javax.faces.component.UISelectOne;
|
||||
import javax.faces.context.FacesContext;
|
||||
import javax.faces.context.ResponseWriter;
|
||||
import javax.faces.el.MethodBinding;
|
||||
import javax.faces.el.ValueBinding;
|
||||
import javax.faces.model.SelectItem;
|
||||
import javax.transaction.UserTransaction;
|
||||
|
||||
import org.alfresco.model.WCMAppModel;
|
||||
import org.alfresco.repo.avm.actions.AVMDeploySnapshotAction;
|
||||
import org.alfresco.web.app.Application;
|
||||
import org.alfresco.web.app.servlet.FacesHelper;
|
||||
import org.alfresco.web.bean.repository.Repository;
|
||||
import org.alfresco.web.bean.wcm.DeploymentServerConfig;
|
||||
import org.alfresco.web.ui.common.ComponentConstants;
|
||||
import org.alfresco.web.ui.common.Utils;
|
||||
import org.alfresco.web.ui.common.component.UIActionLink;
|
||||
import org.alfresco.web.ui.common.component.UIListItem;
|
||||
import org.alfresco.web.ui.repo.component.UIActions;
|
||||
|
||||
/**
|
||||
* JSF component that allows deployment servers to be added, edited and removed.
|
||||
*
|
||||
* @author gavinc
|
||||
*/
|
||||
public class UIDeploymentServers extends UIInput
|
||||
{
|
||||
private static final String MSG_ALF_SERVER = "deploy_add_alf_receiver";
|
||||
private static final String MSG_FILE_SYSTEM = "deploy_add_file_receiver";
|
||||
private static final String MSG_LIVE_SERVER = "deploy_server_type_live";
|
||||
private static final String MSG_TEST_SERVER = "deploy_server_type_test";
|
||||
private static final String MSG_TYPE = "deploy_server_type";
|
||||
private static final String MSG_NAME = "deploy_server_name";
|
||||
private static final String MSG_HOST = "deploy_server_host";
|
||||
private static final String MSG_PORT = "deploy_server_port";
|
||||
private static final String MSG_USER = "deploy_server_username";
|
||||
private static final String MSG_PWD = "deploy_server_password";
|
||||
private static final String MSG_URL = "deploy_server_url";
|
||||
private static final String MSG_SOURCE = "deploy_server_source_path";
|
||||
private static final String MSG_TARGET = "deploy_server_target_name";
|
||||
private static final String MSG_AUTO_DEPLOY = "deploy_automatically";
|
||||
private static final String MSG_EDIT = "edit_deploy_server";
|
||||
private static final String MSG_DELETE = "delete_deploy_server";
|
||||
private static final String MSG_NO_DEPLOY_SERVERS = "no_deploy_servers";
|
||||
|
||||
private List<DeploymentServerConfig> servers;
|
||||
private DeploymentServerConfig currentServer;
|
||||
private Boolean inAddMode;
|
||||
private String addType;
|
||||
|
||||
// ------------------------------------------------------------------------------
|
||||
// Component implementation
|
||||
|
||||
/**
|
||||
* Default constructor
|
||||
*/
|
||||
public UIDeploymentServers()
|
||||
{
|
||||
setRendererType(null);
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getFamily()
|
||||
{
|
||||
return "org.alfresco.faces.DeploymentServers";
|
||||
}
|
||||
|
||||
@SuppressWarnings("unchecked")
|
||||
@Override
|
||||
public void restoreState(FacesContext context, Object state)
|
||||
{
|
||||
Object values[] = (Object[])state;
|
||||
// standard component attributes are restored by the super class
|
||||
super.restoreState(context, values[0]);
|
||||
this.servers = (List<DeploymentServerConfig>)values[1];
|
||||
this.inAddMode = (Boolean)values[2];
|
||||
this.addType = (String)values[3];
|
||||
this.currentServer = (DeploymentServerConfig)values[4];
|
||||
}
|
||||
|
||||
@Override
|
||||
public Object saveState(FacesContext context)
|
||||
{
|
||||
Object values[] = new Object[5];
|
||||
// standard component attributes are saved by the super class
|
||||
values[0] = super.saveState(context);
|
||||
values[1] = this.servers;
|
||||
values[2] = this.inAddMode;
|
||||
values[3] = this.addType;
|
||||
values[4] = this.currentServer;
|
||||
return values;
|
||||
}
|
||||
|
||||
@SuppressWarnings("unchecked")
|
||||
@Override
|
||||
public void encodeBegin(FacesContext context) throws IOException
|
||||
{
|
||||
if (isRendered() == false)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
// clear previously generated children
|
||||
this.getChildren().clear();
|
||||
|
||||
ResponseWriter out = context.getResponseWriter();
|
||||
UserTransaction tx = null;
|
||||
try
|
||||
{
|
||||
tx = Repository.getUserTransaction(FacesContext.getCurrentInstance(), true);
|
||||
tx.begin();
|
||||
|
||||
String contextPath = context.getExternalContext().getRequestContextPath();
|
||||
out.write("<script type='text/javascript' src='");
|
||||
out.write(contextPath);
|
||||
out.write("/scripts/ajax/deployment.js'></script>\n");
|
||||
out.write("<div class='deployConfig'>");
|
||||
|
||||
List<DeploymentServerConfig> servers = getValue();
|
||||
DeploymentServerConfig currentServer = getCurrentServer();
|
||||
for (DeploymentServerConfig server: servers)
|
||||
{
|
||||
if (currentServer != null && currentServer.getId().equals(server.getId()))
|
||||
{
|
||||
renderServerForm(context, out, server, true);
|
||||
}
|
||||
else
|
||||
{
|
||||
renderServer(context, out, server);
|
||||
}
|
||||
}
|
||||
|
||||
if (getInAddMode())
|
||||
{
|
||||
renderServerForm(context, out, null, false);
|
||||
}
|
||||
else
|
||||
{
|
||||
if (servers.size() == 0)
|
||||
{
|
||||
out.write("<div class='deployNoServers'><img src='");
|
||||
out.write(contextPath);
|
||||
out.write("/images/icons/info_icon.gif' /> ");
|
||||
out.write(Application.getMessage(context, MSG_NO_DEPLOY_SERVERS));
|
||||
out.write("</div>");
|
||||
}
|
||||
}
|
||||
|
||||
out.write("</div>");
|
||||
|
||||
out.write("\n<script type='text/javascript'>");
|
||||
out.write("window.onload=Alfresco.deployServerTypeChanged();");
|
||||
out.write("</script>");
|
||||
|
||||
tx.commit();
|
||||
}
|
||||
catch (Throwable err)
|
||||
{
|
||||
try { if (tx != null) {tx.rollback();} } catch (Exception tex) {}
|
||||
throw new RuntimeException(err);
|
||||
}
|
||||
}
|
||||
|
||||
// ------------------------------------------------------------------------------
|
||||
// Strongly typed component property accessors
|
||||
|
||||
/**
|
||||
* @return List of deployment servers to show
|
||||
*/
|
||||
@SuppressWarnings("unchecked")
|
||||
public List<DeploymentServerConfig> getValue()
|
||||
{
|
||||
ValueBinding vb = getValueBinding("value");
|
||||
if (vb != null)
|
||||
{
|
||||
this.servers = (List<DeploymentServerConfig>)vb.getValue(getFacesContext());
|
||||
}
|
||||
|
||||
return this.servers;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param value The list of deployment servers to show
|
||||
*/
|
||||
public void setValue(List<DeploymentServerConfig> value)
|
||||
{
|
||||
this.servers = value;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param server The current deployment server being added or edited
|
||||
*/
|
||||
public void setCurrentServer(DeploymentServerConfig server)
|
||||
{
|
||||
this.currentServer = server;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return Deployment server currently being edited or added
|
||||
*/
|
||||
@SuppressWarnings("unchecked")
|
||||
public DeploymentServerConfig getCurrentServer()
|
||||
{
|
||||
ValueBinding vb = getValueBinding("currentServer");
|
||||
if (vb != null)
|
||||
{
|
||||
this.currentServer = (DeploymentServerConfig)vb.getValue(getFacesContext());
|
||||
}
|
||||
|
||||
return this.currentServer;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return true if the component should show a form to add a new server
|
||||
*/
|
||||
public boolean getInAddMode()
|
||||
{
|
||||
ValueBinding vb = getValueBinding("inAddMode");
|
||||
if (vb != null)
|
||||
{
|
||||
this.inAddMode = (Boolean)vb.getValue(getFacesContext());
|
||||
}
|
||||
|
||||
if (this.inAddMode == null)
|
||||
{
|
||||
this.inAddMode = Boolean.FALSE;
|
||||
}
|
||||
|
||||
return this.inAddMode.booleanValue();
|
||||
}
|
||||
|
||||
/**
|
||||
* @param inAddMode Determines whether a new server should be added
|
||||
*/
|
||||
public void setInAddMode(boolean inAddMode)
|
||||
{
|
||||
this.inAddMode = new Boolean(inAddMode);
|
||||
}
|
||||
|
||||
/**
|
||||
* @return The type of reciever server to add
|
||||
*/
|
||||
public String getAddType()
|
||||
{
|
||||
ValueBinding vb = getValueBinding("addType");
|
||||
if (vb != null)
|
||||
{
|
||||
this.addType = (String)vb.getValue(getFacesContext());
|
||||
}
|
||||
|
||||
if (this.addType == null)
|
||||
{
|
||||
this.addType = WCMAppModel.CONSTRAINT_FILEDEPLOY;
|
||||
}
|
||||
|
||||
return this.addType;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param value The type of server receiver to add
|
||||
*/
|
||||
public void setAddType(String value)
|
||||
{
|
||||
this.addType = value;
|
||||
}
|
||||
|
||||
// ------------------------------------------------------------------------------
|
||||
// Helpers
|
||||
|
||||
protected void renderAddControls(FacesContext context, ResponseWriter out)
|
||||
throws IOException
|
||||
{
|
||||
out.write("");
|
||||
|
||||
UICommand addAlfAction = aquireAddAlfReceiverAction(context);
|
||||
Utils.encodeRecursive(context, addAlfAction);
|
||||
|
||||
UICommand addFileAction = aquireAddFileReceiverAction(context);
|
||||
Utils.encodeRecursive(context, addFileAction);
|
||||
|
||||
out.write("</div>");
|
||||
}
|
||||
|
||||
protected void renderServer(FacesContext context, ResponseWriter out,
|
||||
DeploymentServerConfig server) throws IOException
|
||||
{
|
||||
String contextPath = context.getExternalContext().getRequestContextPath();
|
||||
ResourceBundle bundle = Application.getBundle(context);
|
||||
|
||||
String serverName = (String)server.getProperties().get(DeploymentServerConfig.PROP_NAME);
|
||||
if (serverName == null || serverName.length() == 0)
|
||||
{
|
||||
serverName = AVMDeploySnapshotAction.calculateServerUri(server.getRepoProps());
|
||||
}
|
||||
|
||||
out.write("<div class='deployConfigServer'>");
|
||||
out.write("<table><tr><td valign='top'><img class='deployConfigServerIcon' src='");
|
||||
out.write(contextPath);
|
||||
out.write("/images/icons/deploy_server_");
|
||||
out.write(server.getDeployType());
|
||||
out.write(".gif");
|
||||
out.write("' /></td><td><table class='deployConfigServerDetails'>");
|
||||
out.write("<tr><td colspan='4'><span class='deployPanelServerName'>");
|
||||
out.write(serverName);
|
||||
out.write("</span></td><td align='right'>");
|
||||
Utils.encodeRecursive(context, aquireEditServerAction(context, server.getId()));
|
||||
Utils.encodeRecursive(context, aquireDeleteServerAction(context, server.getId()));
|
||||
out.write("</td></tr><tr><td>");
|
||||
out.write(bundle.getString(MSG_HOST));
|
||||
out.write(":</td><td>");
|
||||
if (server.getProperties().get(DeploymentServerConfig.PROP_HOST) != null)
|
||||
{
|
||||
out.write((String)server.getProperties().get(DeploymentServerConfig.PROP_HOST));
|
||||
}
|
||||
|
||||
out.write("</td><td width='30'> </td><td>");
|
||||
out.write(bundle.getString(MSG_PORT));
|
||||
out.write(":</td><td>");
|
||||
if (server.getProperties().get(DeploymentServerConfig.PROP_PORT) != null)
|
||||
{
|
||||
out.write((String)server.getProperties().get(DeploymentServerConfig.PROP_PORT));
|
||||
}
|
||||
|
||||
out.write("</td></tr><tr><td>");
|
||||
out.write(bundle.getString(MSG_TYPE));
|
||||
out.write(":</td><td>");
|
||||
if (server.getProperties().get(DeploymentServerConfig.PROP_TYPE) != null)
|
||||
{
|
||||
String type = (String)server.getProperties().get(DeploymentServerConfig.PROP_TYPE);
|
||||
if (WCMAppModel.CONSTRAINT_LIVESERVER.equals(type))
|
||||
{
|
||||
out.write(Application.getMessage(context, MSG_LIVE_SERVER));
|
||||
}
|
||||
else if (WCMAppModel.CONSTRAINT_TESTSERVER.equals(type))
|
||||
{
|
||||
out.write(Application.getMessage(context, MSG_TEST_SERVER));
|
||||
}
|
||||
}
|
||||
out.write("</td><td width='30'> </td><td>");
|
||||
out.write(bundle.getString(MSG_URL));
|
||||
out.write(":</td><td>");
|
||||
if (server.getProperties().get(DeploymentServerConfig.PROP_URL) != null)
|
||||
{
|
||||
out.write((String)server.getProperties().get(DeploymentServerConfig.PROP_URL));
|
||||
}
|
||||
out.write("</td></tr><tr><td>");
|
||||
out.write(bundle.getString(MSG_USER));
|
||||
out.write(":</td><td>");
|
||||
if (server.getProperties().get(DeploymentServerConfig.PROP_USER) != null)
|
||||
{
|
||||
out.write((String)server.getProperties().get(DeploymentServerConfig.PROP_USER));
|
||||
}
|
||||
out.write("</td><td width='30'> </td><td>");
|
||||
out.write(bundle.getString(MSG_SOURCE));
|
||||
out.write(":</td><td>");
|
||||
if (server.getProperties().get(DeploymentServerConfig.PROP_SOURCE_PATH) != null)
|
||||
{
|
||||
out.write((String)server.getProperties().get(DeploymentServerConfig.PROP_SOURCE_PATH));
|
||||
}
|
||||
out.write("</td></tr>");
|
||||
|
||||
if (WCMAppModel.CONSTRAINT_FILEDEPLOY.equals(server.getDeployType()))
|
||||
{
|
||||
out.write("<tr><td>");
|
||||
out.write(bundle.getString(MSG_TARGET));
|
||||
out.write(":</td><td>");
|
||||
if (server.getProperties().get(DeploymentServerConfig.PROP_TARGET_NAME) != null)
|
||||
{
|
||||
out.write((String)server.getProperties().get(DeploymentServerConfig.PROP_TARGET_NAME));
|
||||
}
|
||||
out.write("</td></tr>");
|
||||
}
|
||||
|
||||
if (WCMAppModel.CONSTRAINT_LIVESERVER.equals(
|
||||
server.getProperties().get(DeploymentServerConfig.PROP_TYPE)))
|
||||
{
|
||||
out.write("<tr><td>");
|
||||
out.write(bundle.getString(MSG_AUTO_DEPLOY));
|
||||
out.write(":</td><td>");
|
||||
if (server.getProperties().get(DeploymentServerConfig.PROP_ON_APPROVAL) != null)
|
||||
{
|
||||
Object obj = server.getProperties().get(DeploymentServerConfig.PROP_ON_APPROVAL);
|
||||
if (obj instanceof Boolean && ((Boolean)obj).booleanValue())
|
||||
{
|
||||
out.write(bundle.getString("yes"));
|
||||
}
|
||||
else
|
||||
{
|
||||
out.write(bundle.getString("no"));
|
||||
}
|
||||
}
|
||||
out.write("</td></tr>");
|
||||
}
|
||||
|
||||
out.write("</table></td></tr></table></div>");
|
||||
}
|
||||
|
||||
@SuppressWarnings("unchecked")
|
||||
protected void renderServerForm(FacesContext context, ResponseWriter out,
|
||||
DeploymentServerConfig server, boolean edit) throws IOException
|
||||
{
|
||||
String contextPath = context.getExternalContext().getRequestContextPath();
|
||||
ResourceBundle bundle = Application.getBundle(context);
|
||||
|
||||
out.write("<div class='deployConfigServer'>");
|
||||
out.write("<table><tr><td valign='top'><img class='deployConfigServerIcon' src='");
|
||||
out.write(contextPath);
|
||||
out.write("/images/icons/deploy_server_");
|
||||
if (server != null)
|
||||
{
|
||||
out.write(server.getDeployType());
|
||||
}
|
||||
else
|
||||
{
|
||||
out.write(getAddType());
|
||||
}
|
||||
out.write(".gif' /></td>");
|
||||
out.write("<td><table class='deployConfigServerForm'>");
|
||||
|
||||
// create the server type drop down
|
||||
out.write("<tr><td align='right'>");
|
||||
out.write(bundle.getString(MSG_TYPE));
|
||||
out.write(":</td><td>");
|
||||
UIComponent type = context.getApplication().createComponent(
|
||||
UISelectOne.COMPONENT_TYPE);
|
||||
FacesHelper.setupComponentId(context, type, "deployServerType");
|
||||
type.getAttributes().put("styleClass", "inputField");
|
||||
type.getAttributes().put("onchange",
|
||||
"javascript:Alfresco.deployServerTypeChanged();");
|
||||
ValueBinding vbType = context.getApplication().createValueBinding(
|
||||
"#{WizardManager.bean.editedDeployServerProperties." +
|
||||
DeploymentServerConfig.PROP_TYPE + "}");
|
||||
type.setValueBinding("value", vbType);
|
||||
UISelectItems itemsComponent = (UISelectItems)context.getApplication().
|
||||
createComponent(UISelectItems.COMPONENT_TYPE);
|
||||
List<SelectItem> items = new ArrayList<SelectItem>(2);
|
||||
|
||||
items.add(new SelectItem(WCMAppModel.CONSTRAINT_LIVESERVER,
|
||||
Application.getMessage(context, MSG_LIVE_SERVER)));
|
||||
items.add(new SelectItem(WCMAppModel.CONSTRAINT_TESTSERVER,
|
||||
Application.getMessage(context, MSG_TEST_SERVER)));
|
||||
|
||||
itemsComponent.setValue(items);
|
||||
type.getChildren().add(itemsComponent);
|
||||
this.getChildren().add(type);
|
||||
Utils.encodeRecursive(context, type);
|
||||
out.write("</td></tr>");
|
||||
|
||||
// create the server name field
|
||||
out.write("<tr><td align='right'>");
|
||||
out.write(bundle.getString(MSG_NAME));
|
||||
out.write(":</td><td>");
|
||||
UIComponent name = context.getApplication().createComponent(
|
||||
UIInput.COMPONENT_TYPE);
|
||||
FacesHelper.setupComponentId(context, name, null);
|
||||
name.getAttributes().put("styleClass", "inputField");
|
||||
ValueBinding vbName = context.getApplication().createValueBinding(
|
||||
"#{WizardManager.bean.editedDeployServerProperties." +
|
||||
DeploymentServerConfig.PROP_NAME + "}");
|
||||
name.setValueBinding("value", vbName);
|
||||
this.getChildren().add(name);
|
||||
Utils.encodeRecursive(context, name);
|
||||
out.write("</td></tr>");
|
||||
|
||||
// create the server host field
|
||||
out.write("<tr><td align='right'>");
|
||||
out.write(bundle.getString(MSG_HOST));
|
||||
out.write(":</td><td>");
|
||||
UIComponent host = context.getApplication().createComponent(
|
||||
UIInput.COMPONENT_TYPE);
|
||||
FacesHelper.setupComponentId(context, host, null);
|
||||
host.getAttributes().put("styleClass", "inputField");
|
||||
ValueBinding vbHost = context.getApplication().createValueBinding(
|
||||
"#{WizardManager.bean.editedDeployServerProperties." +
|
||||
DeploymentServerConfig.PROP_HOST + "}");
|
||||
host.setValueBinding("value", vbHost);
|
||||
this.getChildren().add(host);
|
||||
Utils.encodeRecursive(context, host);
|
||||
out.write("</td></tr>");
|
||||
|
||||
// create the server port field
|
||||
out.write("<tr><td align='right'>");
|
||||
out.write(bundle.getString(MSG_PORT));
|
||||
out.write(":</td><td>");
|
||||
UIComponent port = context.getApplication().createComponent(
|
||||
UIInput.COMPONENT_TYPE);
|
||||
FacesHelper.setupComponentId(context, port, null);
|
||||
port.getAttributes().put("styleClass", "inputField");
|
||||
ValueBinding vbPort = context.getApplication().createValueBinding(
|
||||
"#{WizardManager.bean.editedDeployServerProperties." +
|
||||
DeploymentServerConfig.PROP_PORT + "}");
|
||||
port.setValueBinding("value", vbPort);
|
||||
this.getChildren().add(port);
|
||||
Utils.encodeRecursive(context, port);
|
||||
out.write("</td></tr>");
|
||||
|
||||
// create the server username field
|
||||
out.write("<tr><td align='right'>");
|
||||
out.write(bundle.getString(MSG_USER));
|
||||
out.write(":</td><td>");
|
||||
UIComponent username = context.getApplication().createComponent(
|
||||
UIInput.COMPONENT_TYPE);
|
||||
FacesHelper.setupComponentId(context, username, null);
|
||||
username.getAttributes().put("styleClass", "inputField");
|
||||
ValueBinding vbUser = context.getApplication().createValueBinding(
|
||||
"#{WizardManager.bean.editedDeployServerProperties." +
|
||||
DeploymentServerConfig.PROP_USER + "}");
|
||||
username.setValueBinding("value", vbUser);
|
||||
this.getChildren().add(username);
|
||||
Utils.encodeRecursive(context, username);
|
||||
out.write("</td></tr>");
|
||||
|
||||
// create the server password field
|
||||
out.write("<tr><td align='right'>");
|
||||
out.write(bundle.getString(MSG_PWD));
|
||||
out.write(":</td><td>");
|
||||
UIComponent pwd = context.getApplication().createComponent(
|
||||
UIInput.COMPONENT_TYPE);
|
||||
FacesHelper.setupComponentId(context, pwd, null);
|
||||
pwd.setRendererType("javax.faces.Secret");
|
||||
pwd.getAttributes().put("styleClass", "inputField");
|
||||
ValueBinding vbPwd = context.getApplication().createValueBinding(
|
||||
"#{WizardManager.bean.editedDeployServerProperties." +
|
||||
DeploymentServerConfig.PROP_PASSWORD + "}");
|
||||
pwd.setValueBinding("value", vbPwd);
|
||||
this.getChildren().add(pwd);
|
||||
Utils.encodeRecursive(context, pwd);
|
||||
out.write("</td></tr>");
|
||||
|
||||
// create the server url field
|
||||
out.write("<tr><td align='right'>");
|
||||
out.write(bundle.getString(MSG_URL));
|
||||
out.write(":</td><td>");
|
||||
UIComponent url = context.getApplication().createComponent(
|
||||
UIInput.COMPONENT_TYPE);
|
||||
FacesHelper.setupComponentId(context, url, null);
|
||||
url.getAttributes().put("styleClass", "inputField");
|
||||
ValueBinding vbUrl = context.getApplication().createValueBinding(
|
||||
"#{WizardManager.bean.editedDeployServerProperties." +
|
||||
DeploymentServerConfig.PROP_URL + "}");
|
||||
url.setValueBinding("value", vbUrl);
|
||||
this.getChildren().add(url);
|
||||
Utils.encodeRecursive(context, url);
|
||||
out.write("</td></tr>");
|
||||
|
||||
// create the source path field
|
||||
out.write("<tr><td align='right'>");
|
||||
out.write(bundle.getString(MSG_SOURCE));
|
||||
out.write(":</td><td>");
|
||||
UIComponent source = context.getApplication().createComponent(
|
||||
UIInput.COMPONENT_TYPE);
|
||||
FacesHelper.setupComponentId(context, source, null);
|
||||
source.getAttributes().put("styleClass", "inputField");
|
||||
ValueBinding vbSource = context.getApplication().createValueBinding(
|
||||
"#{WizardManager.bean.editedDeployServerProperties." +
|
||||
DeploymentServerConfig.PROP_SOURCE_PATH + "}");
|
||||
source.setValueBinding("value", vbSource);
|
||||
this.getChildren().add(source);
|
||||
Utils.encodeRecursive(context, source);
|
||||
out.write("</td></tr>");
|
||||
|
||||
if ((edit == false && WCMAppModel.CONSTRAINT_FILEDEPLOY.equals(getAddType())) ||
|
||||
(edit && WCMAppModel.CONSTRAINT_FILEDEPLOY.equals(server.getDeployType())))
|
||||
{
|
||||
// create the target field
|
||||
out.write("<tr><td align='right'>");
|
||||
out.write(bundle.getString(MSG_TARGET));
|
||||
out.write(":</td><td>");
|
||||
UIComponent target = context.getApplication().createComponent(
|
||||
UIInput.COMPONENT_TYPE);
|
||||
FacesHelper.setupComponentId(context, target, null);
|
||||
target.getAttributes().put("styleClass", "inputField");
|
||||
ValueBinding vbTarget = context.getApplication().createValueBinding(
|
||||
"#{WizardManager.bean.editedDeployServerProperties." +
|
||||
DeploymentServerConfig.PROP_TARGET_NAME + "}");
|
||||
target.setValueBinding("value", vbTarget);
|
||||
this.getChildren().add(target);
|
||||
Utils.encodeRecursive(context, target);
|
||||
out.write("</td></tr>");
|
||||
}
|
||||
|
||||
// create the auto deploy checkbox
|
||||
out.write("<tr><td align='right'><span id='autoDeployLabel'>");
|
||||
out.write(bundle.getString(MSG_AUTO_DEPLOY));
|
||||
out.write(":</td><td>");
|
||||
UIComponent auto = context.getApplication().createComponent(
|
||||
UISelectBoolean.COMPONENT_TYPE);
|
||||
FacesHelper.setupComponentId(context, auto, "autoDeployCheckbox");
|
||||
ValueBinding vbAuto = context.getApplication().createValueBinding(
|
||||
"#{WizardManager.bean.editedDeployServerProperties." +
|
||||
DeploymentServerConfig.PROP_ON_APPROVAL + "}");
|
||||
auto.setValueBinding("value", vbAuto);
|
||||
this.getChildren().add(auto);
|
||||
Utils.encodeRecursive(context, auto);
|
||||
out.write("</td></tr>");
|
||||
|
||||
if (edit)
|
||||
{
|
||||
// create the done button
|
||||
out.write("<tr><td colspan='2' align='right'>");
|
||||
UICommand saveButton = (UICommand)context.getApplication().createComponent(
|
||||
UICommand.COMPONENT_TYPE);
|
||||
FacesHelper.setupComponentId(context, saveButton, null);
|
||||
saveButton.setValue(bundle.getString("save"));
|
||||
MethodBinding binding = context.getApplication().createMethodBinding(
|
||||
"#{WizardManager.bean.saveDeploymentServerConfig}", new Class[] {});
|
||||
saveButton.setAction(binding);
|
||||
this.getChildren().add(saveButton);
|
||||
Utils.encodeRecursive(context, saveButton);
|
||||
out.write("</td></tr>");
|
||||
}
|
||||
else
|
||||
{
|
||||
// create the add button
|
||||
out.write("<tr><td colspan='2' align='right'>");
|
||||
UICommand addButton = (UICommand)context.getApplication().createComponent(
|
||||
UICommand.COMPONENT_TYPE);
|
||||
FacesHelper.setupComponentId(context, addButton, null);
|
||||
addButton.setValue(bundle.getString("add"));
|
||||
MethodBinding binding = context.getApplication().createMethodBinding(
|
||||
"#{WizardManager.bean.addDeploymentServerConfig}", new Class[] {});
|
||||
addButton.setAction(binding);
|
||||
this.getChildren().add(addButton);
|
||||
Utils.encodeRecursive(context, addButton);
|
||||
out.write("</td></tr>");
|
||||
}
|
||||
|
||||
// finish off tables and div
|
||||
out.write("</table></td></tr></table></div>");
|
||||
}
|
||||
|
||||
@SuppressWarnings("unchecked")
|
||||
protected UIActionLink aquireAddAlfReceiverAction(FacesContext context)
|
||||
{
|
||||
UIActionLink action = null;
|
||||
String actionId = "add_alf_receiver";
|
||||
|
||||
// try find the action as a child of this component
|
||||
for (UIComponent component : (List<UIComponent>)getChildren())
|
||||
{
|
||||
if (actionId.equals(component.getId()))
|
||||
{
|
||||
action = (UIActionLink)component;
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
if (action == null)
|
||||
{
|
||||
// create the action and add as a child component
|
||||
javax.faces.application.Application facesApp = context.getApplication();
|
||||
action = (UIActionLink)facesApp.createComponent(UIActions.COMPONENT_ACTIONLINK);
|
||||
action.setId(actionId);
|
||||
action.setValue(Application.getMessage(context, MSG_ALF_SERVER));
|
||||
action.setImage("/images/icons/plus.gif");
|
||||
MethodBinding binding = facesApp.createMethodBinding(
|
||||
"#{WizardManager.bean.addAlfrescoServerReceiver}", new Class[] {});
|
||||
action.setAction(binding);
|
||||
this.getChildren().add(action);
|
||||
}
|
||||
|
||||
return action;
|
||||
}
|
||||
|
||||
@SuppressWarnings("unchecked")
|
||||
protected UIActionLink aquireAddFileReceiverAction(FacesContext context)
|
||||
{
|
||||
UIActionLink action = null;
|
||||
String actionId = "add_file_receiver";
|
||||
|
||||
// try find the action as a child of this component
|
||||
for (UIComponent component : (List<UIComponent>)getChildren())
|
||||
{
|
||||
if (actionId.equals(component.getId()))
|
||||
{
|
||||
action = (UIActionLink)component;
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
if (action == null)
|
||||
{
|
||||
// create the action and add as a child component
|
||||
javax.faces.application.Application facesApp = context.getApplication();
|
||||
action = (UIActionLink)facesApp.createComponent(UIActions.COMPONENT_ACTIONLINK);
|
||||
action.setId(actionId);
|
||||
action.setValue(Application.getMessage(context, MSG_FILE_SYSTEM));
|
||||
action.setImage("/images/icons/plus.gif");
|
||||
MethodBinding binding = facesApp.createMethodBinding(
|
||||
"#{WizardManager.bean.addFileSystemReceiver}", new Class[] {});
|
||||
action.setAction(binding);
|
||||
this.getChildren().add(action);
|
||||
}
|
||||
|
||||
return action;
|
||||
}
|
||||
|
||||
@SuppressWarnings("unchecked")
|
||||
protected UIActionLink aquireEditServerAction(FacesContext context, String serverId)
|
||||
{
|
||||
UIActionLink action = null;
|
||||
String actionId = "edit_" + serverId;
|
||||
|
||||
// try find the action as a child of this component
|
||||
for (UIComponent component : (List<UIComponent>)getChildren())
|
||||
{
|
||||
if (actionId.equals(component.getId()))
|
||||
{
|
||||
action = (UIActionLink)component;
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
if (action == null)
|
||||
{
|
||||
// create the action and add as a child component
|
||||
javax.faces.application.Application facesApp = context.getApplication();
|
||||
action = (UIActionLink)facesApp.createComponent(UIActions.COMPONENT_ACTIONLINK);
|
||||
action.setId(actionId);
|
||||
action.setValue(Application.getMessage(context, MSG_EDIT));
|
||||
action.setImage("/images/icons/edit_icon.gif");
|
||||
action.setShowLink(false);
|
||||
action.setActionListener(facesApp.createMethodBinding(
|
||||
"#{WizardManager.bean.editDeploymentServerConfig}",
|
||||
UIActions.ACTION_CLASS_ARGS));
|
||||
|
||||
// add server id param
|
||||
UIParameter param = (UIParameter)facesApp.createComponent(ComponentConstants.JAVAX_FACES_PARAMETER);
|
||||
param.setId(actionId + "_1");
|
||||
param.setName("id");
|
||||
param.setValue(serverId);
|
||||
action.getChildren().add(param);
|
||||
|
||||
this.getChildren().add(action);
|
||||
}
|
||||
|
||||
return action;
|
||||
}
|
||||
|
||||
@SuppressWarnings("unchecked")
|
||||
protected UIActionLink aquireDeleteServerAction(FacesContext context, String serverId)
|
||||
{
|
||||
UIActionLink action = null;
|
||||
String actionId = "delete_" + serverId;
|
||||
|
||||
// try find the action as a child of this component
|
||||
for (UIComponent component : (List<UIComponent>)getChildren())
|
||||
{
|
||||
if (actionId.equals(component.getId()))
|
||||
{
|
||||
action = (UIActionLink)component;
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
if (action == null)
|
||||
{
|
||||
// create the action and add as a child component
|
||||
javax.faces.application.Application facesApp = context.getApplication();
|
||||
action = (UIActionLink)facesApp.createComponent(UIActions.COMPONENT_ACTIONLINK);
|
||||
action.setId(actionId);
|
||||
action.setValue(Application.getMessage(context, MSG_DELETE));
|
||||
action.setImage("/images/icons/delete.gif");
|
||||
action.setShowLink(false);
|
||||
action.setActionListener(facesApp.createMethodBinding(
|
||||
"#{WizardManager.bean.deleteDeploymentServerConfig}",
|
||||
UIActions.ACTION_CLASS_ARGS));
|
||||
|
||||
// add server id param
|
||||
UIParameter param = (UIParameter)facesApp.createComponent(ComponentConstants.JAVAX_FACES_PARAMETER);
|
||||
param.setId(actionId + "_1");
|
||||
param.setName("id");
|
||||
param.setValue(serverId);
|
||||
action.getChildren().add(param);
|
||||
|
||||
this.getChildren().add(action);
|
||||
}
|
||||
|
||||
return action;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return Options for the type of deployment server i.e. test or live
|
||||
*/
|
||||
public List<UIListItem> getDeployServerTypes()
|
||||
{
|
||||
List<UIListItem> items = new ArrayList<UIListItem>(2);
|
||||
|
||||
UIListItem live = new UIListItem();
|
||||
live.setValue(WCMAppModel.CONSTRAINT_LIVESERVER);
|
||||
live.setLabel(Application.getMessage(FacesContext.getCurrentInstance(), MSG_LIVE_SERVER));
|
||||
|
||||
UIListItem test = new UIListItem();
|
||||
test.setValue(WCMAppModel.CONSTRAINT_TESTSERVER);
|
||||
test.setLabel(Application.getMessage(FacesContext.getCurrentInstance(), MSG_TEST_SERVER));
|
||||
|
||||
items.add(live);
|
||||
items.add(test);
|
||||
|
||||
return items;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,115 @@
|
||||
/*
|
||||
* Copyright (C) 2005-2007 Alfresco Software Limited.
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU General Public License
|
||||
* as published by the Free Software Foundation; either version 2
|
||||
* of the License, or (at your option) any later version.
|
||||
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program; if not, write to the Free Software
|
||||
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
|
||||
|
||||
* As a special exception to the terms and conditions of version 2.0 of
|
||||
* the GPL, you may redistribute this Program in connection with Free/Libre
|
||||
* and Open Source Software ("FLOSS") applications as described in Alfresco's
|
||||
* FLOSS exception. You should have recieved a copy of the text describing
|
||||
* the FLOSS exception, and it is also available here:
|
||||
* http://www.alfresco.com/legal/licensing
|
||||
*/
|
||||
package org.alfresco.web.ui.wcm.tag;
|
||||
|
||||
import javax.faces.component.UIComponent;
|
||||
|
||||
import org.alfresco.web.ui.common.tag.BaseComponentTag;
|
||||
|
||||
/**
|
||||
* Tag class that allows the DeploymentServers component to be used on a JSP page.
|
||||
*
|
||||
* @author gavinc
|
||||
*/
|
||||
public class DeploymentServersTag extends BaseComponentTag
|
||||
{
|
||||
private String value;
|
||||
private String currentServer;
|
||||
private String inAddMode;
|
||||
private String addType;
|
||||
|
||||
/**
|
||||
* @see javax.faces.webapp.UIComponentTag#getComponentType()
|
||||
*/
|
||||
public String getComponentType()
|
||||
{
|
||||
return "org.alfresco.faces.DeploymentServers";
|
||||
}
|
||||
|
||||
/**
|
||||
* @see javax.faces.webapp.UIComponentTag#getRendererType()
|
||||
*/
|
||||
public String getRendererType()
|
||||
{
|
||||
return null;
|
||||
}
|
||||
|
||||
/**
|
||||
* @see javax.faces.webapp.UIComponentTag#setProperties(javax.faces.component.UIComponent)
|
||||
*/
|
||||
protected void setProperties(UIComponent component)
|
||||
{
|
||||
super.setProperties(component);
|
||||
|
||||
setStringProperty(component, "value", this.value);
|
||||
setStringProperty(component, "currentServer", this.currentServer);
|
||||
setStringProperty(component, "addType", this.addType);
|
||||
setBooleanProperty(component, "inAddMode", this.inAddMode);
|
||||
}
|
||||
|
||||
/**
|
||||
* @see org.alfresco.web.ui.common.tag.HtmlComponentTag#release()
|
||||
*/
|
||||
public void release()
|
||||
{
|
||||
super.release();
|
||||
this.value = null;
|
||||
this.currentServer = null;
|
||||
this.addType = null;
|
||||
this.inAddMode = null;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param value the value (the list of servers to show)
|
||||
*/
|
||||
public void setValue(String value)
|
||||
{
|
||||
this.value = value;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param currentServer The server being edited or added
|
||||
*/
|
||||
public void setCurrentServer(String currentServer)
|
||||
{
|
||||
this.currentServer = currentServer;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param inAddMode Flag to determine whether a new server should be added
|
||||
*/
|
||||
public void setInAddMode(String inAddMode)
|
||||
{
|
||||
this.inAddMode = inAddMode;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param addType The type of server receiver to add
|
||||
*/
|
||||
public void setAddType(String addType)
|
||||
{
|
||||
this.addType = addType;
|
||||
}
|
||||
}
|
||||
@@ -34,6 +34,11 @@
|
||||
<component-class>org.alfresco.web.ui.wcm.component.UIDeployWebsite</component-class>
|
||||
</component>
|
||||
|
||||
<component>
|
||||
<component-type>org.alfresco.faces.DeploymentServers</component-type>
|
||||
<component-class>org.alfresco.web.ui.wcm.component.UIDeploymentServers</component-class>
|
||||
</component>
|
||||
|
||||
<component>
|
||||
<component-type>org.alfresco.faces.PendingSubmissions</component-type>
|
||||
<component-class>org.alfresco.web.ui.wcm.component.UIPendingSubmissions</component-class>
|
||||
|
||||
@@ -210,6 +210,56 @@
|
||||
</attribute>
|
||||
</tag>
|
||||
|
||||
<tag>
|
||||
<name>deploymentServers</name>
|
||||
<tag-class>org.alfresco.web.ui.wcm.tag.DeploymentServersTag</tag-class>
|
||||
<body-content>JSP</body-content>
|
||||
<display-name>Deployment Servers</display-name>
|
||||
<description>
|
||||
Renders a list of deployment servers and allows new ones to be
|
||||
added and existing servers to be edited and removed
|
||||
</description>
|
||||
|
||||
<attribute>
|
||||
<name>id</name>
|
||||
<required>false</required>
|
||||
<rtexprvalue>true</rtexprvalue>
|
||||
<description>The component identifier for this component</description>
|
||||
</attribute>
|
||||
|
||||
<attribute>
|
||||
<name>value</name>
|
||||
<required>true</required>
|
||||
<rtexprvalue>true</rtexprvalue>
|
||||
<description>The list of deployment servers to show</description>
|
||||
</attribute>
|
||||
|
||||
<attribute>
|
||||
<name>rendered</name>
|
||||
<required>false</required>
|
||||
<rtexprvalue>true</rtexprvalue>
|
||||
</attribute>
|
||||
|
||||
<attribute>
|
||||
<name>currentServer</name>
|
||||
<required>false</required>
|
||||
<rtexprvalue>true</rtexprvalue>
|
||||
<description>The deployment server currently being added or edited</description>
|
||||
</attribute>
|
||||
|
||||
<attribute>
|
||||
<name>inAddMode</name>
|
||||
<required>false</required>
|
||||
<rtexprvalue>true</rtexprvalue>
|
||||
</attribute>
|
||||
|
||||
<attribute>
|
||||
<name>addType</name>
|
||||
<required>false</required>
|
||||
<rtexprvalue>true</rtexprvalue>
|
||||
</attribute>
|
||||
</tag>
|
||||
|
||||
<tag>
|
||||
<name>deployWebsite</name>
|
||||
<tag-class>org.alfresco.web.ui.wcm.tag.DeployWebsiteTag</tag-class>
|
||||
|
||||
@@ -701,6 +701,83 @@ a.sidebarButtonLink, a.sidebarButtonLink:link, a.sidebarButtonLink:visited
|
||||
font-weight: normal;
|
||||
font-size:12px;
|
||||
}
|
||||
|
||||
.deployAddServerConfig
|
||||
{
|
||||
margin: 4px;
|
||||
}
|
||||
|
||||
.deployAddServerConfig a
|
||||
{
|
||||
margin-right: 30px;
|
||||
}
|
||||
|
||||
.deployAddServerConfig img
|
||||
{
|
||||
border: none;
|
||||
vertical-align: -4px;
|
||||
margin-right: 2px;
|
||||
}
|
||||
|
||||
.deployConfig
|
||||
{
|
||||
padding: 4px;
|
||||
}
|
||||
|
||||
.deployNoServers
|
||||
{
|
||||
margin-top: 26px;
|
||||
margin-bottom: 10px;
|
||||
}
|
||||
|
||||
.deployNoServers img
|
||||
{
|
||||
vertical-align: -6px;
|
||||
}
|
||||
|
||||
.deployConfigServer
|
||||
{
|
||||
margin-top: 14px;
|
||||
border: 1px solid #555;
|
||||
background-color: #f9f9f9;
|
||||
-moz-border-radius: 8px;
|
||||
}
|
||||
|
||||
.deployConfigServerIcon
|
||||
{
|
||||
margin: 8px 0px 0px 8px;
|
||||
}
|
||||
|
||||
.deployConfigServer td
|
||||
{
|
||||
padding: 5px;
|
||||
}
|
||||
|
||||
.deployConfigServerDetails
|
||||
{
|
||||
padding-left: 10px;
|
||||
}
|
||||
|
||||
.deployConfigServerDetails td
|
||||
{
|
||||
padding: 2px;
|
||||
}
|
||||
|
||||
.deployConfigServerDetails img
|
||||
{
|
||||
border: none;
|
||||
margin-left: 3px;
|
||||
}
|
||||
|
||||
.deployConfigServerForm
|
||||
{
|
||||
padding-left: 15px;
|
||||
}
|
||||
|
||||
.deployConfigServerForm .inputField
|
||||
{
|
||||
width: 200px;
|
||||
}
|
||||
|
||||
.deployPanelCheckbox
|
||||
{
|
||||
|
||||
Binary file not shown.
|
After Width: | Height: | Size: 1.3 KiB |
Binary file not shown.
|
After Width: | Height: | Size: 1.4 KiB |
@@ -0,0 +1,47 @@
|
||||
<%--
|
||||
* Copyright (C) 2005-2007 Alfresco Software Limited.
|
||||
|
||||
* This program is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU General Public License
|
||||
* as published by the Free Software Foundation; either version 2
|
||||
* of the License, or (at your option) any later version.
|
||||
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program; if not, write to the Free Software
|
||||
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
|
||||
|
||||
* As a special exception to the terms and conditions of version 2.0 of
|
||||
* the GPL, you may redistribute this Program in connection with Free/Libre
|
||||
* and Open Source Software ("FLOSS") applications as described in Alfresco's
|
||||
* FLOSS exception. You should have recieved a copy of the text describing
|
||||
* the FLOSS exception, and it is also available here:
|
||||
* http://www.alfresco.com/legal/licensing"
|
||||
--%>
|
||||
<%@ taglib uri="http://java.sun.com/jsf/html" prefix="h" %>
|
||||
<%@ taglib uri="http://java.sun.com/jsf/core" prefix="f" %>
|
||||
<%@ taglib uri="/WEB-INF/alfresco.tld" prefix="a" %>
|
||||
<%@ taglib uri="/WEB-INF/repo.tld" prefix="r" %>
|
||||
<%@ taglib uri="/WEB-INF/wcm.tld" prefix="w" %>
|
||||
|
||||
<%@ page buffer="32kb" contentType="text/html;charset=UTF-8" %>
|
||||
<%@ page isELIgnored="false" %>
|
||||
|
||||
<h:panelGroup styleClass="deployAddServerConfig">
|
||||
<a:actionLink value="#{msg.deploy_add_alf_receiver}"
|
||||
action="#{WizardManager.bean.addAlfrescoServerReceiver}"
|
||||
image="/images/icons/plus.gif" />
|
||||
<a:actionLink value="#{msg.deploy_add_file_receiver}"
|
||||
action="#{WizardManager.bean.addFileSystemReceiver}"
|
||||
image="/images/icons/plus.gif" />
|
||||
</h:panelGroup>
|
||||
|
||||
|
||||
<w:deploymentServers value="#{WizardManager.bean.deployServers}"
|
||||
currentServer="#{WizardManager.bean.currentDeployServer}"
|
||||
inAddMode="#{WizardManager.bean.inAddDeployServerMode}"
|
||||
addType="#{WizardManager.bean.addDeployServerType}" />
|
||||
@@ -0,0 +1,36 @@
|
||||
Alfresco.deployServerTypeChanged = function()
|
||||
{
|
||||
var typeDropDown = document.getElementById('wizard:wizard-body:deployServerType');
|
||||
if (typeDropDown != null)
|
||||
{
|
||||
var selectedType = typeDropDown.options[typeDropDown.selectedIndex].value;
|
||||
|
||||
// show or hide the label
|
||||
var autoDeployLabel = document.getElementById('autoDeployLabel');
|
||||
if (autoDeployLabel != null)
|
||||
{
|
||||
if (selectedType == "test")
|
||||
{
|
||||
autoDeployLabel.style.display = "none";
|
||||
}
|
||||
else
|
||||
{
|
||||
autoDeployLabel.style.display = "block";
|
||||
}
|
||||
}
|
||||
|
||||
// show or hide the checkbox
|
||||
var autoDeployCheckbox = document.getElementById('wizard:wizard-body:autoDeployCheckbox');
|
||||
if (autoDeployCheckbox != null)
|
||||
{
|
||||
if (selectedType == "test")
|
||||
{
|
||||
autoDeployCheckbox.style.display = "none";
|
||||
}
|
||||
else
|
||||
{
|
||||
autoDeployCheckbox.style.display = "block";
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user