Merged V2.1 to HEAD

6338: Some WCM-435.
   6344: Fix for AWC-1452 (dialog close navigation issue)
   6345: Fix for AR-1611 and other related CIFS and NFS fixes
   6346: Minor javadoc fix for ReplicatingContentStore
   6347: Handle exceptions arising from UserTransaction.begin().
   6348: Many WCM fixes in one
            Conflicts resolved on faces-config-beans.xml


git-svn-id: https://svn.alfresco.com/repos/alfresco-enterprise/alfresco/HEAD/root@6722 c4b6b30b-aa2e-2d43-bbcb-ca4b014f7261
This commit is contained in:
Derek Hulley
2007-09-10 13:21:08 +00:00
parent 48fa124735
commit 0fb2ae13f9
38 changed files with 1290 additions and 895 deletions

View File

@@ -696,6 +696,7 @@ import_error_info=If this option is selected the import will be performed in the
edit_file_title=Edit file edit_file_title=Edit file
edit_file_prompt=To edit the file ''{0}'', click the link below and if asked select Save. edit_file_prompt=To edit the file ''{0}'', click the link below and if asked select Save.
edit_download_complete=When the download is complete, click Close. edit_download_complete=When the download is complete, click Close.
edit_using_web_form=To edit this file using a Web Form, click here.
checkout_file_title=Check out file checkout_file_title=Check out file
checkout_you_may_want=You may want to check out this file to lock it and prevent other users from editing it. checkout_you_may_want=You may want to check out this file to lock it and prevent other users from editing it.
checkout_hint1=Hint: When you check out a file a copy is made for you to work with. checkout_hint1=Hint: When you check out a file a copy is made for you to work with.
@@ -985,11 +986,11 @@ website_workflow=Workflow
website_workflow_info=Use the following workflow website_workflow_info=Use the following workflow
website_forms=Configure Web Forms website_forms=Configure Web Forms
form_template_details=Web Form Details form_template_details=Web Form Details
form_template_details_desc=Edit the details of this Web Form form_template_details_desc=Edit the details of Web Form {0} in Web Project {1}.
form_template_conf_workflow=Configure Workflow form_template_conf_workflow=Configure Workflow
form_template_select_templates=Configure Templates form_template_select_templates=Configure Templates
form_template_templates=Configure Templates form_template_templates=Configure Templates
form_template_templates_desc=Setup the Templates you want to use for the Web Content Form. 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=Configure Workflow
form_template_workflow_desc=Configure the workflow defaults for this Web Project form_template_workflow_desc=Configure the workflow defaults for this Web Project
create_website_step2_title=Step Two - Configure Web Content Forms create_website_step2_title=Step Two - Configure Web Content Forms
@@ -1219,7 +1220,12 @@ rerun_report=Run Report Again
update_status=Update Status update_status=Update Status
fixed_items=Items you have fixed fixed_items=Items you have fixed
no_items=No items to display no_items=No items to display
prompt_for_web_form=Select Web Form
prompt_for_web_form_info=Select the Web Form to use for editing this file
prompt_for_web_form_form_not_found_error_in_web_project=Unable to find Web Form {0} associated with {1} in Web Project {2}.
prompt_for_web_form_form_not_found_error=Unable to find Web Form {0} associated with {1}.
prompt_for_web_form_explanation=Select the Web Form to use for {0}.
prompt_for_web_form_continue_msg=To edit {0} using the selected Web Form, click ok. If {0} is not a Web Form generated asset and should be treated as regular content, click cancel.
# New User Wizard messages # New User Wizard messages
new_user_title=New User Wizard new_user_title=New User Wizard
new_user_title_edit=Edit User Wizard new_user_title_edit=Edit User Wizard

View File

@@ -254,7 +254,7 @@
</bean> </bean>
<!-- NOTE: This references a bean in the repository Spring configuration --> <!-- NOTE: This references a bean in the repository Spring configuration -->
<bean id="formsService" class="org.alfresco.web.forms.FormsService"> <bean id="FormsService" class="org.alfresco.web.forms.FormsService">
<constructor-arg> <constructor-arg>
<ref bean="ContentService" /> <ref bean="ContentService" />
</constructor-arg> </constructor-arg>

View File

@@ -162,10 +162,25 @@
icon="/images/icons/delete_large.gif" title-id="delete_folder" icon="/images/icons/delete_large.gif" title-id="delete_folder"
description-id="delete_avm_folder_info" /> description-id="delete_avm_folder_info" />
<dialog name="promptForWebForm" page="/jsp/wcm/prompt-for-web-form.jsp" managed-bean="PromptForWebFormDialog"
icon="/images/icons/details_large.gif" title-id="prompt_for_web_form"
description-id="prompt_for_web_form_info" />
<dialog name="createAvmFolder" page="/jsp/wcm/create-folder-dialog.jsp" managed-bean="CreateFolderDialog" <dialog name="createAvmFolder" page="/jsp/wcm/create-folder-dialog.jsp" managed-bean="CreateFolderDialog"
icon="/images/icons/create_space_large.gif" title-id="create_folder" icon="/images/icons/create_space_large.gif" title-id="create_folder"
description-id="create_avm_folder_info" /> description-id="create_avm_folder_info" />
<dialog name="editAvmFile" page="/jsp/wcm/edit-file.jsp"
managed-bean="EditAvmFileDialog" icon="/images/icons/edit_large.gif"
title-id="title_edit_file" description-id="editfile_description"
show-ok-button="false"/>
<!--
<dialog name="updateAvmFile" page="/jsp/wcm/update-file.jsp"
managed-bean="EditAvmFileDialog" icon="/images/icons/update_large.gif"
title-id="title_update_file" description-id="update_avm-file_desc" />
-->
<dialog name="editAvmFileProperties" page="/jsp/content/edit-content-properties.jsp" <dialog name="editAvmFileProperties" page="/jsp/content/edit-content-properties.jsp"
managed-bean="EditFilePropertiesDialog" icon="/images/icons/details_large.gif" managed-bean="EditFilePropertiesDialog" icon="/images/icons/details_large.gif"
title-id="edit_file_properties" description-id="edit_file_description" /> title-id="edit_file_properties" description-id="edit_file_description" />

View File

@@ -11,7 +11,7 @@
<evaluator>org.alfresco.web.action.evaluator.WCMWorkflowEvaluator</evaluator> <evaluator>org.alfresco.web.action.evaluator.WCMWorkflowEvaluator</evaluator>
<label-id>edit</label-id> <label-id>edit</label-id>
<image>/images/icons/edit_icon.gif</image> <image>/images/icons/edit_icon.gif</image>
<action-listener>#{AVMEditBean.setupEditAction}</action-listener> <action-listener>#{AVMBrowseBean.setupEditAction}</action-listener>
<params> <params>
<param name="id">#{actionContext.id}</param> <param name="id">#{actionContext.id}</param>
</params> </params>

View File

@@ -684,29 +684,7 @@ public class AlfrescoNavigationHandler extends NavigationHandler
if (logger.isDebugEnabled()) if (logger.isDebugEnabled())
logger.debug("Popped item from the top of the view stack: " + topOfStack); logger.debug("Popped item from the top of the view stack: " + topOfStack);
String newViewId = null; String newViewId = getViewIdFromStackObject(context, topOfStack);
if (topOfStack instanceof String)
{
newViewId = (String)topOfStack;
}
else if (topOfStack instanceof DialogState)
{
// restore the dialog state and get the dialog container viewId
Application.getDialogManager().restoreState((DialogState)topOfStack);
newViewId = getDialogContainer(context);
}
else if (topOfStack instanceof WizardState)
{
// restore the wizard state and get the wizard container viewId
Application.getWizardManager().restoreState((WizardState)topOfStack);
newViewId = getWizardContainer(context);
}
else
{
if (logger.isWarnEnabled())
logger.warn("Invalid object found on view stack: " + topOfStack);
}
// go to the appropraite page // go to the appropraite page
goToView(context, newViewId); goToView(context, newViewId);
@@ -714,7 +692,10 @@ public class AlfrescoNavigationHandler extends NavigationHandler
else else
{ {
// we also need to empty the dialog stack if we have been given // we also need to empty the dialog stack if we have been given
// an overidden outcome as we could be going anywhere in the app // an overidden outcome as we could be going anywhere in the app.
// grab the current top item first though in case we need to open
// another dialog or wizard
String previousViewId = getViewIdFromStackObject(context, getViewStack(context).peek());
getViewStack(context).clear(); getViewStack(context).clear();
if (logger.isDebugEnabled()) if (logger.isDebugEnabled())
@@ -724,6 +705,17 @@ public class AlfrescoNavigationHandler extends NavigationHandler
// the navigation handler from the beginning // the navigation handler from the beginning
if (isDialog(overriddenOutcome) || isWizard(overriddenOutcome)) if (isDialog(overriddenOutcome) || isWizard(overriddenOutcome))
{ {
// set the view id to the page at the top of the stack so when
// the new dialog or wizard closes it goes back to the correct page
context.getViewRoot().setViewId(previousViewId);
if (logger.isDebugEnabled())
{
logger.debug("view stack: " + getViewStack(context));
logger.debug("Opening '" + overriddenOutcome + "' after " + closingItem +
" close using view id: " + previousViewId);
}
this.handleNavigation(context, fromAction, overriddenOutcome); this.handleNavigation(context, fromAction, overriddenOutcome);
} }
else else
@@ -745,6 +737,42 @@ public class AlfrescoNavigationHandler extends NavigationHandler
} }
} }
/**
* Returns the view id of the given item retrieved from the view stack.
*
* @param context FacesContext
* @param topOfStack The object retrieved from the view stack
* @return The view id
*/
protected String getViewIdFromStackObject(FacesContext context, Object topOfStack)
{
String viewId = null;
if (topOfStack instanceof String)
{
viewId = (String)topOfStack;
}
else if (topOfStack instanceof DialogState)
{
// restore the dialog state and get the dialog container viewId
Application.getDialogManager().restoreState((DialogState)topOfStack);
viewId = getDialogContainer(context);
}
else if (topOfStack instanceof WizardState)
{
// restore the wizard state and get the wizard container viewId
Application.getWizardManager().restoreState((WizardState)topOfStack);
viewId = getWizardContainer(context);
}
else
{
if (logger.isWarnEnabled())
logger.warn("Invalid object found on view stack: " + topOfStack);
}
return viewId;
}
/** /**
* Adds the current view to the stack (if required). * Adds the current view to the stack (if required).
* If the current view is already the top of the stack it is not added again * If the current view is already the top of the stack it is not added again

View File

@@ -41,7 +41,6 @@ import org.alfresco.web.app.servlet.BaseServlet;
import org.alfresco.web.app.servlet.FacesHelper; import org.alfresco.web.app.servlet.FacesHelper;
import org.alfresco.web.bean.NavigationBean; import org.alfresco.web.bean.NavigationBean;
import org.alfresco.web.bean.wcm.AVMBrowseBean; import org.alfresco.web.bean.wcm.AVMBrowseBean;
import org.alfresco.web.bean.wcm.AVMEditBean;
import org.alfresco.web.bean.wizard.WizardManager; import org.alfresco.web.bean.wizard.WizardManager;
import org.alfresco.web.ui.wcm.component.UIUserSandboxes; import org.alfresco.web.ui.wcm.component.UIUserSandboxes;
@@ -73,7 +72,6 @@ public class EditWebContentCommand extends BaseUIActionCommand
ServletResponse res = (ServletResponse)properties.get(PROP_RESPONSE); ServletResponse res = (ServletResponse)properties.get(PROP_RESPONSE);
FacesContext fc = FacesHelper.getFacesContext(req, res, sc); FacesContext fc = FacesHelper.getFacesContext(req, res, sc);
AVMBrowseBean avmBrowseBean = (AVMBrowseBean)FacesHelper.getManagedBean(fc, AVMBrowseBean.BEAN_NAME); AVMBrowseBean avmBrowseBean = (AVMBrowseBean)FacesHelper.getManagedBean(fc, AVMBrowseBean.BEAN_NAME);
AVMEditBean avmEditBean = (AVMEditBean)FacesHelper.getManagedBean(fc, AVMEditBean.BEAN_NAME);
NavigationBean navigator = (NavigationBean)FacesHelper.getManagedBean(fc, NavigationBean.BEAN_NAME); NavigationBean navigator = (NavigationBean)FacesHelper.getManagedBean(fc, NavigationBean.BEAN_NAME);
// setup context from url args in properties map // setup context from url args in properties map
@@ -86,7 +84,7 @@ public class EditWebContentCommand extends BaseUIActionCommand
navigator.setCurrentNodeId(webProjectId); navigator.setCurrentNodeId(webProjectId);
avmBrowseBean.setSandbox(sandbox); avmBrowseBean.setSandbox(sandbox);
// navigation handler is called directly in this method // navigation handler is called directly in this method
avmEditBean.setupEditAction(path); avmBrowseBean.setupEditAction(path);
String viewId = fc.getViewRoot().getViewId(); String viewId = fc.getViewRoot().getViewId();
try try

View File

@@ -24,6 +24,7 @@
*/ */
package org.alfresco.web.bean.wcm; package org.alfresco.web.bean.wcm;
import java.io.FileNotFoundException;
import java.io.Serializable; import java.io.Serializable;
import java.text.MessageFormat; import java.text.MessageFormat;
import java.util.ArrayList; import java.util.ArrayList;
@@ -148,7 +149,7 @@ public class AVMBrowseBean implements IContextListener
private List<String> deploymentMonitorIds = new ArrayList<String>(); private List<String> deploymentMonitorIds = new ArrayList<String>();
/** List of expired paths to submit */ /** List of expired paths to submit */
private List<AVMNodeDescriptor> expiredNodes = Collections.<AVMNodeDescriptor>emptyList(); private List<AVMNodeDescriptor> nodesForSubmit = Collections.<AVMNodeDescriptor>emptyList();
/** Object used by link validation service to monitor the status of a link check */ /** Object used by link validation service to monitor the status of a link check */
private HrefValidationProgress linkValidationMonitor; private HrefValidationProgress linkValidationMonitor;
@@ -195,6 +196,9 @@ public class AVMBrowseBean implements IContextListener
/** Action service bean reference */ /** Action service bean reference */
protected ActionService actionService; protected ActionService actionService;
/** The FormsService reference */
protected FormsService formsService;
/** /**
* Default Constructor * Default Constructor
*/ */
@@ -266,6 +270,14 @@ public class AVMBrowseBean implements IContextListener
this.actionService = actionService; this.actionService = actionService;
} }
/**
* @param formsService The FormsService to set.
*/
public void setFormsService(final FormsService formsService)
{
this.formsService = formsService;
}
/** /**
* Summary text for the staging store: * Summary text for the staging store:
* Created On: xx/yy/zz * Created On: xx/yy/zz
@@ -499,23 +511,17 @@ public class AVMBrowseBean implements IContextListener
} }
/** /**
* Returns the list of expired nodes. Used by the submit dialog to retrieve
* nodes to potentially submit when a user completes a change request
* task dealing with content expiration.
*
* @return The list of expired nodes
*/ */
public List<AVMNodeDescriptor> getExpiredNodes() public List<AVMNodeDescriptor> getNodesForSubmit()
{ {
return this.expiredNodes; return this.nodesForSubmit;
} }
/** /**
* @param expiredNodes List of nodes in the users sandbox that have expired
*/ */
public void setExpiredNodes(List<AVMNodeDescriptor> expiredNodes) public void setNodesForSubmit(final List<AVMNodeDescriptor> nodesForSubmit)
{ {
this.expiredNodes = expiredNodes; this.nodesForSubmit = nodesForSubmit;
} }
/** /**
@@ -1001,6 +1007,88 @@ public class AVMBrowseBean implements IContextListener
} }
} }
/**
* Action handler called to calculate which editing screen to display based on the mimetype
* of a document. If appropriate, the in-line editing screen will be shown.
*/
public void setupEditAction(final ActionEvent event)
{
final UIActionLink link = (UIActionLink)event.getComponent();
final Map<String, String> params = link.getParameterMap();
this.setupEditAction(params.get("id"));
}
/**
* Action handler called to calculate which editing screen to display based on the mimetype
* of a document. If appropriate, the in-line editing screen will be shown.
*/
public void setupEditAction(final String path)
{
this.setupContentAction(path, true);
// retrieve the content reader for this node
String avmPath = this.getAvmActionNode().getPath();
if (this.avmService.hasAspect(-1, avmPath, WCMAppModel.ASPECT_RENDITION))
{
if (LOGGER.isDebugEnabled())
LOGGER.debug(avmPath + " is a rendition, editing primary rendition instead");
try
{
final FormInstanceData fid = this.formsService.getRendition(-1, avmPath).getPrimaryFormInstanceData();
avmPath = fid.getPath();
if (LOGGER.isDebugEnabled())
LOGGER.debug("Editing primary form instance data " + avmPath);
this.setAvmActionNode(new AVMNode(this.avmService.lookup(-1, avmPath)));
}
catch (FileNotFoundException fnfe)
{
this.avmService.removeAspect(avmPath, WCMAppModel.ASPECT_RENDITION);
this.avmService.removeAspect(avmPath, WCMAppModel.ASPECT_FORM_INSTANCE_DATA);
Utils.addErrorMessage(fnfe.getMessage(), fnfe);
}
}
if (LOGGER.isDebugEnabled())
LOGGER.debug("Editing AVM node: " + avmPath);
String outcome = null;
// calculate which editor screen to display
if (this.avmService.hasAspect(-1, avmPath, WCMAppModel.ASPECT_FORM_INSTANCE_DATA))
{
// make content available to the editing screen
try
{
// make sure the form association works before proceeding to the
// edit web content wizard
this.formsService.getFormInstanceData(-1, avmPath).getForm();
// navigate to appropriate screen
outcome = "wizard:editWebContent";
}
catch (FormNotFoundException fnfe)
{
LOGGER.debug(fnfe.getMessage(), fnfe);
final Map<String, String> params = new HashMap<String, String>(2, 1.0f);
params.put("finishOutcome", "wizard:editWebContent");
params.put("cancelOutcome", "dialog:editAvmFile");
Application.getDialogManager().setupParameters(params);
outcome = "dialog:promptForWebForm";
}
}
else
{
// normal downloadable document
outcome = "dialog:editAvmFile";
}
LOGGER.debug("outcome " + outcome + " for path " + path);
final FacesContext fc = FacesContext.getCurrentInstance();
fc.getApplication().getNavigationHandler().handleNavigation(fc, null, outcome);
}
/** /**
* Action handler for all nodes from user sandbox * Action handler for all nodes from user sandbox
*/ */
@@ -1049,11 +1137,11 @@ public class AVMBrowseBean implements IContextListener
FormInstanceData fid = null; FormInstanceData fid = null;
if (this.avmService.hasAspect(-1, path, WCMAppModel.ASPECT_RENDITION)) if (this.avmService.hasAspect(-1, path, WCMAppModel.ASPECT_RENDITION))
{ {
fid = new RenditionImpl(-1, path).getPrimaryFormInstanceData(); fid = this.formsService.getRendition(-1, path).getPrimaryFormInstanceData();
} }
else if (this.avmService.hasAspect(-1, path, WCMAppModel.ASPECT_FORM_INSTANCE_DATA)) else if (this.avmService.hasAspect(-1, path, WCMAppModel.ASPECT_FORM_INSTANCE_DATA))
{ {
fid = new FormInstanceDataImpl(-1, path); fid = this.formsService.getFormInstanceData(-1, path);
} }
List<Pair<Integer, String>> versionPaths = new ArrayList<Pair<Integer, String>>(); List<Pair<Integer, String>> versionPaths = new ArrayList<Pair<Integer, String>>();
if (fid != null) if (fid != null)
@@ -1166,15 +1254,14 @@ public class AVMBrowseBean implements IContextListener
/** /**
* Create web content from a specific Form via the User Sandbox 'Available Forms' panel * Create web content from a specific Form via the User Sandbox 'Available Forms' panel
*/ */
public void createFormContent(ActionEvent event) public void createFormContent(final ActionEvent event)
{ {
// setup the correct sandbox for the create action // setup the correct sandbox for the create action
setupSandboxAction(event); this.setupSandboxAction(event);
// pass form ID to the wizard - to be picked up in init() // pass form ID to the wizard - to be picked up in init()
FacesContext fc = FacesContext.getCurrentInstance(); Application.getWizardManager().setupParameters(event);
WizardManager manager = (WizardManager)FacesHelper.getManagedBean(fc, WizardManager.BEAN_NAME); final FacesContext fc = FacesContext.getCurrentInstance();
manager.setupParameters(event);
fc.getApplication().getNavigationHandler().handleNavigation(fc, null, "wizard:createWebContent"); fc.getApplication().getNavigationHandler().handleNavigation(fc, null, "wizard:createWebContent");
} }

View File

@@ -45,12 +45,11 @@ import org.alfresco.web.bean.FileUploadBean;
import org.alfresco.web.bean.repository.Repository; import org.alfresco.web.bean.repository.Repository;
import org.alfresco.web.forms.Form; import org.alfresco.web.forms.Form;
import org.alfresco.web.forms.FormInstanceData; import org.alfresco.web.forms.FormInstanceData;
import org.alfresco.web.forms.FormInstanceDataImpl;
import org.alfresco.web.forms.FormNotFoundException; import org.alfresco.web.forms.FormNotFoundException;
import org.alfresco.web.forms.FormProcessor; import org.alfresco.web.forms.FormProcessor;
import org.alfresco.web.forms.FormsService;
import org.alfresco.web.forms.RenderingEngineTemplate; import org.alfresco.web.forms.RenderingEngineTemplate;
import org.alfresco.web.forms.Rendition; import org.alfresco.web.forms.Rendition;
import org.alfresco.web.forms.RenditionImpl;
import org.alfresco.web.forms.XMLUtil; import org.alfresco.web.forms.XMLUtil;
import org.alfresco.web.ui.common.Utils; import org.alfresco.web.ui.common.Utils;
import org.alfresco.web.ui.common.component.UIActionLink; import org.alfresco.web.ui.common.component.UIActionLink;
@@ -66,28 +65,17 @@ import org.w3c.dom.Document;
*/ */
public class AVMEditBean public class AVMEditBean
{ {
public static final String BEAN_NAME = "AVMEditBean";
private static final Log LOGGER = LogFactory.getLog(AVMEditBean.class); private static final Log LOGGER = LogFactory.getLog(AVMEditBean.class);
private static final String MSG_ERROR_UPDATE = "error_update"; private static final String MSG_ERROR_UPDATE = "error_update";
private static final String MSG_UPLOAD_SUCCESS = "file_upload_success"; private static final String MSG_UPLOAD_SUCCESS = "file_upload_success";
private String documentContent = null;
private Document instanceDataDocument = null;
private String editorOutput = null;
private File file = null; private File file = null;
private String fileName = null; private String fileName = null;
/** AVM service bean reference */
protected AVMService avmService; protected AVMService avmService;
/** AVM sync service bean reference */
protected AVMSyncService avmSyncService;
/** AVM Browse Bean reference */
protected AVMBrowseBean avmBrowseBean; protected AVMBrowseBean avmBrowseBean;
protected FormsService formsService;
// ------------------------------------------------------------------------------ // ------------------------------------------------------------------------------
// Bean property getters and setters // Bean property getters and setters
@@ -100,14 +88,6 @@ public class AVMEditBean
this.avmService = avmService; this.avmService = avmService;
} }
/**
* @param avmSyncService The AVMSyncService to set.
*/
public void setAvmSyncService(final AVMSyncService avmSyncService)
{
this.avmSyncService = avmSyncService;
}
/** /**
* @param avmBrowseBean The AVMBrowseBean to set. * @param avmBrowseBean The AVMBrowseBean to set.
*/ */
@@ -116,6 +96,14 @@ public class AVMEditBean
this.avmBrowseBean = avmBrowseBean; this.avmBrowseBean = avmBrowseBean;
} }
/**
* @param formsService The FormsService to set.
*/
public void setFormsService(final FormsService formsService)
{
this.formsService = formsService;
}
/** /**
* @return Returns the current AVM node context. * @return Returns the current AVM node context.
*/ */
@@ -140,47 +128,6 @@ public class AVMEditBean
return Utils.getFileTypeImage(getAvmNode().getName(), true); return Utils.getFileTypeImage(getAvmNode().getName(), true);
} }
/**
* @return Content URL for current AVM node
*/
public String getUrl()
{
return DownloadContentServlet.generateDownloadURL(AVMNodeConverter.ToNodeRef(-1, getAvmNode().getPath()),
getAvmNode().getName());
}
/**
* @return Returns the document content used for HTML in-line editing.
*/
public String getDocumentContent()
{
return this.documentContent;
}
/**
* @param documentContent The document content for HTML in-line editing.
*/
public void setDocumentContent(String documentContent)
{
this.documentContent = documentContent;
}
/**
* @return Returns output from the in-line editor page.
*/
public String getEditorOutput()
{
return this.editorOutput;
}
/**
* @param editorOutput The output from the in-line editor page
*/
public void setEditorOutput(String editorOutput)
{
this.editorOutput = editorOutput;
}
/** /**
* @return Returns the name of the file * @return Returns the name of the file
*/ */
@@ -212,113 +159,6 @@ public class AVMEditBean
// ------------------------------------------------------------------------------ // ------------------------------------------------------------------------------
// Action event handlers // Action event handlers
/**
* Action handler called to calculate which editing screen to display based on the mimetype
* of a document. If appropriate, the in-line editing screen will be shown.
*/
public void setupEditAction(final ActionEvent event)
{
final UIActionLink link = (UIActionLink)event.getComponent();
final Map<String, String> params = link.getParameterMap();
this.setupEditAction(params.get("id"));
}
/**
* Action handler called to calculate which editing screen to display based on the mimetype
* of a document. If appropriate, the in-line editing screen will be shown.
*/
public void setupEditAction(String path)
{
this.avmBrowseBean.setupContentAction(path, true);
// retrieve the content reader for this node
String avmPath = getAvmNode().getPath();
if (this.avmService.hasAspect(-1, avmPath, WCMAppModel.ASPECT_RENDITION))
{
if (LOGGER.isDebugEnabled())
LOGGER.debug(avmPath + " is a rendition, editing primary rendition instead");
try
{
final FormInstanceData fid =
new RenditionImpl(AVMNodeConverter.ToNodeRef(-1, avmPath)).getPrimaryFormInstanceData();
avmPath = fid.getPath();
if (LOGGER.isDebugEnabled())
LOGGER.debug("Editing primary form instance data " + avmPath);
this.avmBrowseBean.setAvmActionNode(new AVMNode(this.avmService.lookup(-1, avmPath)));
}
catch (FileNotFoundException fnfe)
{
this.avmService.removeAspect(avmPath, WCMAppModel.ASPECT_RENDITION);
this.avmService.removeAspect(avmPath, WCMAppModel.ASPECT_FORM_INSTANCE_DATA);
Utils.addErrorMessage(fnfe.getMessage(), fnfe);
}
}
if (this.avmService.hasAspect(-1, avmPath, WCMAppModel.ASPECT_FORM_INSTANCE_DATA))
{
// reset the preview layer
String storeName = AVMUtil.getStoreName(avmPath);
storeName = AVMUtil.getCorrespondingPreviewStoreName(storeName);
final String rootPath = AVMUtil.buildStoreRootPath(storeName);
if (LOGGER.isDebugEnabled())
LOGGER.debug("reseting layer " + rootPath);
this.avmSyncService.resetLayer(rootPath);
}
if (LOGGER.isDebugEnabled())
LOGGER.debug("Editing AVM node: " + avmPath);
ContentReader reader = this.avmService.getContentReader(-1, avmPath);
if (reader != null)
{
String mimetype = reader.getMimetype();
String outcome = null;
// calculate which editor screen to display
if (MimetypeMap.MIMETYPE_XML.equals(mimetype) &&
this.avmService.hasAspect(-1, avmPath, WCMAppModel.ASPECT_FORM_INSTANCE_DATA))
{
// make content available to the editing screen
this.setEditorOutput(reader.getContentString());
// navigate to appropriate screen
outcome = "wizard:editWebContent";
}
else
{
// normal downloadable document
outcome = "dialog:editAvmFile";
}
final FacesContext fc = FacesContext.getCurrentInstance();
fc.getApplication().getNavigationHandler().handleNavigation(fc, null, outcome);
}
}
/**
* Action called upon completion of the Edit File download page
*/
public String editFileOK()
{
String outcome = null;
AVMNode node = getAvmNode();
if (node != null)
{
// Possibly notify virt server
AVMUtil.updateVServerWebapp(node.getPath(), false);
resetState();
outcome = AlfrescoNavigationHandler.CLOSE_DIALOG_OUTCOME;
}
return outcome;
}
/** /**
* Action called upon completion of the Update File page * Action called upon completion of the Update File page
*/ */
@@ -386,8 +226,6 @@ public class AVMEditBean
{ {
// clean up and clear action context // clean up and clear action context
clearUpload(); clearUpload();
setDocumentContent(null);
setEditorOutput(null);
} }
/** /**
@@ -413,24 +251,7 @@ public class AVMEditBean
throws FormNotFoundException throws FormNotFoundException
{ {
final String avmPath = this.getAvmNode().getPath(); final String avmPath = this.getAvmNode().getPath();
final FormInstanceData fid = new FormInstanceDataImpl(-1, avmPath) final FormInstanceData fid = this.formsService.getFormInstanceData(-1, avmPath);
{
@Override
public Form getForm()
throws FormNotFoundException
{
final WebProject wp = new WebProject(this.getPath());
Form f = super.getForm();
try
{
return wp.getForm(f.getName());
}
catch (FormNotFoundException fnfe)
{
throw new FormNotFoundException(f, wp, this);
}
}
};
final List<FormInstanceData.RegenerateResult> result = fid.regenerateRenditions(); final List<FormInstanceData.RegenerateResult> result = fid.regenerateRenditions();
for (FormInstanceData.RegenerateResult rr : result) for (FormInstanceData.RegenerateResult rr : result)
{ {

View File

@@ -32,6 +32,7 @@ import java.io.ObjectOutputStream;
import java.io.Serializable; import java.io.Serializable;
import java.util.ArrayList; import java.util.ArrayList;
import java.util.Collections; import java.util.Collections;
import java.util.HashSet;
import java.util.List; import java.util.List;
import java.util.StringTokenizer; import java.util.StringTokenizer;
@@ -91,13 +92,29 @@ public class AVMWorkflowUtil extends WorkflowUtil
final WorkflowService workflowService, final WorkflowService workflowService,
final NodeService nodeService) final NodeService nodeService)
{ {
// create package paths (layered to user sandbox area as target) // create package paths (layered to user sandbox area as target)
final String workflowMainStoreName = sandboxInfo.getMainStoreName(); final String workflowMainStoreName = sandboxInfo.getMainStoreName();
final String packagesPath = AVMUtil.buildStoreRootPath(workflowMainStoreName); final String packagesPath = AVMUtil.buildStoreRootPath(workflowMainStoreName);
final String stagingStoreName = AVMUtil.getStoreId(workflowMainStoreName);
final HashSet<String> directoriesAdded = new HashSet<String>();
final List<AVMDifference> diffs = new ArrayList<AVMDifference>(srcPaths.size()); final List<AVMDifference> diffs = new ArrayList<AVMDifference>(srcPaths.size());
for (final String srcPath : srcPaths) for (final String srcPath : srcPaths)
{ {
// add all newly created directories
String parentPath = AVMNodeConverter.SplitBase(srcPath)[0];
while (!directoriesAdded.contains(parentPath) &&
avmService.lookup(-1, AVMUtil.getCorrespondingPath(parentPath, stagingStoreName)) == null)
{
diffs.add(new AVMDifference(-1, parentPath,
-1, AVMUtil.getCorrespondingPath(parentPath, workflowMainStoreName),
AVMDifference.NEWER));
avmSubmittedAspect.markSubmitted(-1, parentPath, path.instance.id);
directoriesAdded.add(parentPath);
parentPath = AVMNodeConverter.SplitBase(parentPath)[0];
}
diffs.add(new AVMDifference(-1, srcPath, diffs.add(new AVMDifference(-1, srcPath,
-1, AVMUtil.getCorrespondingPath(srcPath, workflowMainStoreName), -1, AVMUtil.getCorrespondingPath(srcPath, workflowMainStoreName),
AVMDifference.NEWER)); AVMDifference.NEWER));
@@ -118,7 +135,6 @@ public class AVMWorkflowUtil extends WorkflowUtil
final ServiceRegistry services = Repository.getServiceRegistry(FacesContext.getCurrentInstance()); final ServiceRegistry services = Repository.getServiceRegistry(FacesContext.getCurrentInstance());
final PermissionService permissionService = services.getPermissionService(); final PermissionService permissionService = services.getPermissionService();
permissionService.setPermission(packageNodeRef, PermissionService.ALL_AUTHORITIES, PermissionService.ALL_PERMISSIONS, true); permissionService.setPermission(packageNodeRef, PermissionService.ALL_AUTHORITIES, PermissionService.ALL_PERMISSIONS, true);
return packageNodeRef; return packageNodeRef;
} }

View File

@@ -203,6 +203,7 @@ public class CreateFormWizard
protected ContentService contentService; protected ContentService contentService;
protected MimetypeService mimetypeService; protected MimetypeService mimetypeService;
protected WorkflowService workflowService; protected WorkflowService workflowService;
protected FormsService formsService;
private String schemaRootElementName = null; private String schemaRootElementName = null;
private String formName = null; private String formName = null;
@@ -234,7 +235,7 @@ public class CreateFormWizard
LOGGER.debug("creating form " + this.getFormName()); LOGGER.debug("creating form " + this.getFormName());
// get the node ref of the node that will contain the content // get the node ref of the node that will contain the content
final NodeRef contentFormsNodeRef = FormsService.getInstance().getContentFormsNodeRef(); final NodeRef contentFormsNodeRef = this.formsService.getContentFormsNodeRef();
final FileInfo folderInfo = final FileInfo folderInfo =
this.fileFolderService.create(contentFormsNodeRef, this.fileFolderService.create(contentFormsNodeRef,
@@ -518,7 +519,12 @@ public class CreateFormWizard
final String name = this.getRenderingEngineTemplateName(); final String name = this.getRenderingEngineTemplateName();
if (name == null || name.length() == 0) if (name == null || name.length() == 0)
{ {
Utils.addErrorMessage("Please provide a name for the rendering engine template"); Utils.addErrorMessage("Please provide a name for the rendering engine template.");
return;
}
if (this.renderingEngine == null)
{
Utils.addErrorMessage("Please select the rendering engine to use.");
return; return;
} }
final String opp = this.getOutputPathPatternForRendition(); final String opp = this.getOutputPathPatternForRendition();
@@ -712,9 +718,8 @@ public class CreateFormWizard
if (this.renderingEngine == null && if (this.renderingEngine == null &&
this.getRenderingEngineTemplateFileName() != null) this.getRenderingEngineTemplateFileName() != null)
{ {
final FormsService fs = FormsService.getInstance();
this.renderingEngine = this.renderingEngine =
fs.guessRenderingEngine(this.getRenderingEngineTemplateFileName()); this.formsService.guessRenderingEngine(this.getRenderingEngineTemplateFileName());
} }
return (this.renderingEngine == null return (this.renderingEngine == null
? null ? null
@@ -726,10 +731,9 @@ public class CreateFormWizard
*/ */
public void setRenderingEngineName(final String renderingEngineName) public void setRenderingEngineName(final String renderingEngineName)
{ {
final FormsService fs = FormsService.getInstance();
this.renderingEngine = (renderingEngineName == null this.renderingEngine = (renderingEngineName == null
? null ? null
: fs.getRenderingEngine(renderingEngineName)); : this.formsService.getRenderingEngine(renderingEngineName));
} }
/** /**
@@ -737,9 +741,8 @@ public class CreateFormWizard
*/ */
public List<SelectItem> getRenderingEngineChoices() public List<SelectItem> getRenderingEngineChoices()
{ {
final FormsService fs = FormsService.getInstance();
final List<SelectItem> result = new LinkedList<SelectItem>(); final List<SelectItem> result = new LinkedList<SelectItem>();
for (RenderingEngine re : fs.getRenderingEngines()) for (RenderingEngine re : this.formsService.getRenderingEngines())
{ {
result.add(new SelectItem(re.getName(), re.getName())); result.add(new SelectItem(re.getName(), re.getName()));
} }
@@ -1098,6 +1101,14 @@ public class CreateFormWizard
this.workflowService = workflowService; this.workflowService = workflowService;
} }
/**
* @param formsService The FormsService to set.
*/
public void setFormsService(final FormsService formsService)
{
this.formsService = formsService;
}
// ------------------------------------------------------------------------------ // ------------------------------------------------------------------------------
// Helper Methods // Helper Methods

View File

@@ -64,6 +64,7 @@ import org.alfresco.service.cmr.workflow.WorkflowTask;
import org.alfresco.service.cmr.workflow.WorkflowTaskState; import org.alfresco.service.cmr.workflow.WorkflowTaskState;
import org.alfresco.service.namespace.QName; import org.alfresco.service.namespace.QName;
import org.alfresco.service.namespace.RegexQNamePattern; import org.alfresco.service.namespace.RegexQNamePattern;
import org.alfresco.web.app.AlfrescoNavigationHandler;
import org.alfresco.web.app.Application; import org.alfresco.web.app.Application;
import org.alfresco.web.bean.content.BaseContentWizard; import org.alfresco.web.bean.content.BaseContentWizard;
import org.alfresco.web.bean.repository.Node; import org.alfresco.web.bean.repository.Node;
@@ -72,7 +73,6 @@ import org.alfresco.web.data.IDataContainer;
import org.alfresco.web.data.QuickSort; import org.alfresco.web.data.QuickSort;
import org.alfresco.web.forms.Form; import org.alfresco.web.forms.Form;
import org.alfresco.web.forms.FormInstanceData; import org.alfresco.web.forms.FormInstanceData;
import org.alfresco.web.forms.FormInstanceDataImpl;
import org.alfresco.web.forms.FormNotFoundException; import org.alfresco.web.forms.FormNotFoundException;
import org.alfresco.web.forms.FormProcessor; import org.alfresco.web.forms.FormProcessor;
import org.alfresco.web.forms.FormsService; import org.alfresco.web.forms.FormsService;
@@ -106,23 +106,12 @@ public class CreateWebContentWizard extends BaseContentWizard
protected boolean formSelectDisabled = false; protected boolean formSelectDisabled = false;
protected boolean startWorkflow = false; protected boolean startWorkflow = false;
/** AVM service bean reference */
protected AVMService avmService; protected AVMService avmService;
/** AVM sync service bean reference */
protected AVMSyncService avmSyncService; protected AVMSyncService avmSyncService;
/** AVM Browse Bean reference */
protected AVMBrowseBean avmBrowseBean; protected AVMBrowseBean avmBrowseBean;
/** AVM Submitted Aspect reference */
protected AVMSubmittedAspect avmSubmittedAspect; protected AVMSubmittedAspect avmSubmittedAspect;
/** Workflow service bean reference */
protected WorkflowService workflowService;
/** The FilePickerBean reference */
protected FilePickerBean filePickerBean; protected FilePickerBean filePickerBean;
protected FormsService formsService;
/** /**
* @param avmService The AVMService to set. * @param avmService The AVMService to set.
@@ -148,15 +137,6 @@ public class CreateWebContentWizard extends BaseContentWizard
this.avmSubmittedAspect = avmSubmittedAspect; this.avmSubmittedAspect = avmSubmittedAspect;
} }
/**
* @param workflowService The WorkflowService to set.
*/
public void setWorkflowService(WorkflowService workflowService)
{
this.workflowService = workflowService;
}
/** /**
* @param avmBrowseBean The AVMBrowseBean to set. * @param avmBrowseBean The AVMBrowseBean to set.
*/ */
@@ -173,6 +153,13 @@ public class CreateWebContentWizard extends BaseContentWizard
this.filePickerBean = filePickerBean; this.filePickerBean = filePickerBean;
} }
/**
* @param formsService The FormsService to set.
*/
public void setFormsService(final FormsService formsService)
{
this.formsService = formsService;
}
// ------------------------------------------------------------------------------ // ------------------------------------------------------------------------------
// Wizard implementation // Wizard implementation
@@ -295,7 +282,7 @@ public class CreateWebContentWizard extends BaseContentWizard
} }
@Override @Override
protected String finishImpl(final FacesContext context, final String outcome) protected String finishImpl(final FacesContext context, String outcome)
throws Exception throws Exception
{ {
final NodeRef[] uploadedFiles = this.filePickerBean.getUploadedFiles(); final NodeRef[] uploadedFiles = this.filePickerBean.getUploadedFiles();
@@ -331,105 +318,23 @@ public class CreateWebContentWizard extends BaseContentWizard
if (this.startWorkflow) if (this.startWorkflow)
{ {
final WorkflowDefinition wd = this.getForm().getDefaultWorkflow(); final List<AVMNodeDescriptor> submitNodes =
if (wd == null) new ArrayList<AVMNodeDescriptor>(1 +
this.getUploadedFiles().size() +
this.getRenditions().size());
for (final AVMDifference d : diffList)
{ {
throw new AlfrescoRuntimeException(Application.getMessage(context, "submit_no_workflow_warning")); submitNodes.add(this.avmService.lookup(-1, d.getDestinationPath()));
} }
this.avmBrowseBean.setNodesForSubmit(submitNodes);
final Map<QName, Serializable> parameters = this.getForm().getDefaultWorkflowParameters(); final Map<String, String> dialogParams = new HashMap<String, String>(1);
dialogParams.put(SubmitDialog.PARAM_LOAD_SELECTED_NODES_FROM_BROWSE_BEAN,
if (LOGGER.isDebugEnabled()) Boolean.TRUE.toString());
LOGGER.debug("starting workflow " + wd + " with parameters " + parameters); Application.getDialogManager().setupParameters(dialogParams);
outcome = (outcome +
if (parameters == null) AlfrescoNavigationHandler.OUTCOME_SEPARATOR +
{ AlfrescoNavigationHandler.DIALOG_PREFIX + "submitSandboxItems");
throw new AlfrescoRuntimeException(Application.getMessage(context, "submit_workflow_config_error"));
} }
// start the workflow to get access to the start task
WorkflowPath path = this.workflowService.startWorkflow(wd.id, null);
if (path != null)
{
// extract the start task
List<WorkflowTask> tasks = this.workflowService.getTasksForWorkflowPath(path.id);
if (tasks.size() == 1)
{
WorkflowTask startTask = tasks.get(0);
if (startTask.state == WorkflowTaskState.IN_PROGRESS)
{
if (LOGGER.isDebugEnabled())
LOGGER.debug("creating workflow package");
// create package paths (layered to user sandbox area as target)
final String storeId = this.avmBrowseBean.getStagingStore();
final List<String> srcPaths = new ArrayList<String>();
// construct diffs for selected items for submission
final String sandboxName = this.avmBrowseBean.getSandbox();
if (MimetypeMap.MIMETYPE_XML.equals(this.mimeType) && this.formName != null)
{
// collect diffs for form data instance and all renditions
for (Rendition rendition : this.getRenditions())
{
srcPaths.add(AVMUtil.getCorrespondingPath(rendition.getPath(), sandboxName));
}
for (NodeRef uploadedFile : uploadedFiles)
{
final String uploadPath = AVMNodeConverter.ToAVMVersionPath(uploadedFile).getSecond();
srcPaths.add(AVMUtil.getCorrespondingPath(uploadPath, sandboxName));
}
srcPaths.add(AVMUtil.getCorrespondingPath(this.formInstanceData.getPath(), sandboxName));
}
else
{
// diff for txt or html content
srcPaths.add(AVMUtil.getCorrespondingPath(this.createdPath, sandboxName));
}
if (LOGGER.isDebugEnabled())
{
LOGGER.debug("creating workflow package with " + srcPaths.size() + " files: {");
for (final String srcPath : srcPaths)
{
LOGGER.debug("-- " + srcPath + ",");
}
LOGGER.debug("}");
}
// Create workflow sandbox for workflow package
final SandboxInfo sandboxInfo = SandboxFactory.createWorkflowSandbox(storeId);
final NodeRef packageNodeRef =
AVMWorkflowUtil.createWorkflowPackage(srcPaths,
sandboxInfo,
path,
avmSubmittedAspect,
this.avmSyncService,
this.avmService,
this.workflowService,
this.nodeService);
parameters.put(WorkflowModel.ASSOC_PACKAGE, packageNodeRef);
parameters.put(WCMWorkflowModel.ASSOC_WEBPROJECT,
this.avmBrowseBean.getWebsite().getNodeRef());
// TODO: capture label and comment?
parameters.put(WCMWorkflowModel.PROP_LABEL,
MimetypeMap.MIMETYPE_XML.equals(this.mimeType) && this.formName != null
? this.formInstanceData.getName()
: this.getFileName());
parameters.put(WCMWorkflowModel.PROP_FROM_PATH, AVMUtil.buildStoreRootPath(sandboxName));
// update start task with submit parameters
this.workflowService.updateTask(startTask.id, parameters, null, null);
// end the start task to trigger the first 'proper' task in the workflow
this.workflowService.endTask(startTask.id, null);
}
}
}
}
if (this.formProcessorSession != null) if (this.formProcessorSession != null)
{ {
this.formProcessorSession.destroy(); this.formProcessorSession.destroy();
@@ -450,7 +355,7 @@ public class CreateWebContentWizard extends BaseContentWizard
if (MimetypeMap.MIMETYPE_XML.equals(this.mimeType) && this.formName != null) if (MimetypeMap.MIMETYPE_XML.equals(this.mimeType) && this.formName != null)
{ {
this.formInstanceData = new FormInstanceDataImpl(-1, this.createdPath); this.formInstanceData = this.formsService.getFormInstanceData(-1, this.createdPath);
this.renditions = this.formInstanceData.getRenditions(); this.renditions = this.formInstanceData.getRenditions();
if (LOGGER.isDebugEnabled()) if (LOGGER.isDebugEnabled())
LOGGER.debug("reset form instance data " + this.formInstanceData.getName() + LOGGER.debug("reset form instance data " + this.formInstanceData.getName() +
@@ -536,16 +441,12 @@ public class CreateWebContentWizard extends BaseContentWizard
if (form != null) if (form != null)
{ {
this.formInstanceData = new FormInstanceDataImpl(formInstanceDataNodeRef)
{
@Override
public Form getForm() { return form; }
};
props.clear(); props.clear();
props.put(WCMAppModel.PROP_PARENT_FORM_NAME, form.getName()); props.put(WCMAppModel.PROP_PARENT_FORM_NAME, form.getName());
props.put(WCMAppModel.PROP_ORIGINAL_PARENT_PATH, cwd); props.put(WCMAppModel.PROP_ORIGINAL_PARENT_PATH, cwd);
this.nodeService.addAspect(formInstanceDataNodeRef, WCMAppModel.ASPECT_FORM_INSTANCE_DATA, props); this.nodeService.addAspect(formInstanceDataNodeRef, WCMAppModel.ASPECT_FORM_INSTANCE_DATA, props);
this.formInstanceData = this.formsService.getFormInstanceData(formInstanceDataNodeRef);
this.renditions = new LinkedList<Rendition>(); this.renditions = new LinkedList<Rendition>();
for (RenderingEngineTemplate ret : form.getRenderingEngineTemplates()) for (RenderingEngineTemplate ret : form.getRenderingEngineTemplates())
{ {
@@ -674,6 +575,9 @@ public class CreateWebContentWizard extends BaseContentWizard
return this.createMimeTypes; return this.createMimeTypes;
} }
/**
* @return the current seleted form's name or <tt>null</tt>.
*/
public String getFormName() public String getFormName()
{ {
return this.formName; return this.formName;

View File

@@ -86,7 +86,7 @@ public class CreateWebsiteWizard extends BaseWizardBean
private static final String WEBAPP_DEFAULT = "ROOT"; private static final String WEBAPP_DEFAULT = "ROOT";
private static Log logger = LogFactory.getLog(CreateWebsiteWizard.class); protected final static Log LOGGER = LogFactory.getLog(CreateWebsiteWizard.class);
protected boolean editMode = false; protected boolean editMode = false;
protected String dnsName; protected String dnsName;
@@ -101,6 +101,7 @@ public class CreateWebsiteWizard extends BaseWizardBean
protected WorkflowService workflowService; protected WorkflowService workflowService;
protected PersonService personService; protected PersonService personService;
protected AVMLockingService avmLockingService; protected AVMLockingService avmLockingService;
protected FormsService formsService;
/** datamodel for table of selected forms */ /** datamodel for table of selected forms */
protected DataModel formsDataModel = null; protected DataModel formsDataModel = null;
@@ -170,8 +171,8 @@ public class CreateWebsiteWizard extends BaseWizardBean
WCMAppModel.TYPE_AVMWEBFOLDER); WCMAppModel.TYPE_AVMWEBFOLDER);
NodeRef nodeRef = fileInfo.getNodeRef(); NodeRef nodeRef = fileInfo.getNodeRef();
if (logger.isDebugEnabled()) if (LOGGER.isDebugEnabled())
logger.debug("Created website folder node with name: " + this.name); LOGGER.debug("Created website folder node with name: " + this.name);
// TODO: check that this dns is unique by querying existing store properties for a match // TODO: check that this dns is unique by querying existing store properties for a match
String avmStore = DNSNameMangler.MakeDNSName(this.dnsName); String avmStore = DNSNameMangler.MakeDNSName(this.dnsName);
@@ -384,6 +385,14 @@ public class CreateWebsiteWizard extends BaseWizardBean
this.avmLockingService = avmLockingService; this.avmLockingService = avmLockingService;
} }
/**
* @param formsService The FormsService to set.
*/
public void setFormsService(final FormsService formsService)
{
this.formsService = formsService;
}
// ------------------------------------------------------------------------------ // ------------------------------------------------------------------------------
// Bean getters and setters // Bean getters and setters
@@ -614,7 +623,7 @@ public class CreateWebsiteWizard extends BaseWizardBean
*/ */
public List<UIListItem> getFormsList() public List<UIListItem> getFormsList()
{ {
Collection<Form> forms = FormsService.getInstance().getForms(); Collection<Form> forms = this.formsService.getForms();
List<UIListItem> items = new ArrayList<UIListItem>(forms.size()); List<UIListItem> items = new ArrayList<UIListItem>(forms.size());
for (Form form : forms) for (Form form : forms)
{ {

View File

@@ -51,7 +51,7 @@ public class DeleteFileDialog extends BaseDialogBean
protected AVMService avmService; protected AVMService avmService;
protected AVMBrowseBean avmBrowseBean; protected AVMBrowseBean avmBrowseBean;
protected FormsService formsService;
/** /**
* @param avmBrowseBean The avmBrowseBean to set. * @param avmBrowseBean The avmBrowseBean to set.
@@ -69,6 +69,13 @@ public class DeleteFileDialog extends BaseDialogBean
this.avmService = avmService; this.avmService = avmService;
} }
/**
* @param formsService The FormsService to set.
*/
public void setFormsService(final FormsService formsService)
{
this.formsService = formsService;
}
// ------------------------------------------------------------------------------ // ------------------------------------------------------------------------------
// Dialog implementation // Dialog implementation
@@ -79,7 +86,11 @@ public class DeleteFileDialog extends BaseDialogBean
{ {
// get the content to delete // get the content to delete
final AVMNode node = this.avmBrowseBean.getAvmActionNode(); final AVMNode node = this.avmBrowseBean.getAvmActionNode();
if (node != null) if (node == null)
{
logger.warn("WARNING: delete called without a current AVM Node!");
}
else
{ {
if (logger.isDebugEnabled()) if (logger.isDebugEnabled())
logger.debug("Trying to delete AVM node: " + node.getPath()); logger.debug("Trying to delete AVM node: " + node.getPath());
@@ -88,7 +99,7 @@ public class DeleteFileDialog extends BaseDialogBean
{ {
try try
{ {
fid = new RenditionImpl(node.getNodeRef()).getPrimaryFormInstanceData(); fid = this.formsService.getRendition(node.getNodeRef()).getPrimaryFormInstanceData();
} }
catch (FileNotFoundException fnfe) catch (FileNotFoundException fnfe)
{ {
@@ -97,7 +108,7 @@ public class DeleteFileDialog extends BaseDialogBean
} }
else if (node.hasAspect(WCMAppModel.ASPECT_FORM_INSTANCE_DATA)) else if (node.hasAspect(WCMAppModel.ASPECT_FORM_INSTANCE_DATA))
{ {
fid = new FormInstanceDataImpl(node.getNodeRef()); fid = this.formsService.getFormInstanceData(node.getNodeRef());
} }
if (fid != null) if (fid != null)
{ {
@@ -117,11 +128,6 @@ public class DeleteFileDialog extends BaseDialogBean
AVMNodeConverter.SplitBase(node.getPath())[1]); AVMNodeConverter.SplitBase(node.getPath())[1]);
} }
} }
else
{
logger.warn("WARNING: delete called without a current AVM Node!");
}
return outcome; return outcome;
} }
@@ -160,7 +166,7 @@ public class DeleteFileDialog extends BaseDialogBean
{ {
try try
{ {
final FormInstanceData fid = new RenditionImpl(node.getNodeRef()).getPrimaryFormInstanceData(); final FormInstanceData fid = this.formsService.getRendition(node.getNodeRef()).getPrimaryFormInstanceData();
return MessageFormat.format(Application.getMessage(FacesContext.getCurrentInstance(), return MessageFormat.format(Application.getMessage(FacesContext.getCurrentInstance(),
"delete_rendition_confirm"), "delete_rendition_confirm"),
node.getName(), node.getName(),
@@ -175,12 +181,11 @@ public class DeleteFileDialog extends BaseDialogBean
} }
else if (node.hasAspect(WCMAppModel.ASPECT_FORM_INSTANCE_DATA)) else if (node.hasAspect(WCMAppModel.ASPECT_FORM_INSTANCE_DATA))
{ {
final FormInstanceData fid = new FormInstanceDataImpl(node.getNodeRef()); final FormInstanceData fid = this.formsService.getFormInstanceData(node.getNodeRef());
return MessageFormat.format(Application.getMessage(FacesContext.getCurrentInstance(), return MessageFormat.format(Application.getMessage(FacesContext.getCurrentInstance(),
"delete_form_instance_data_confirm"), "delete_form_instance_data_confirm"),
fid.getName(), fid.getName(),
fid.getRenditions().size()); fid.getRenditions().size());
} }
return MessageFormat.format(Application.getMessage(FacesContext.getCurrentInstance(), return MessageFormat.format(Application.getMessage(FacesContext.getCurrentInstance(),
"delete_avm_file_confirm"), "delete_avm_file_confirm"),

View File

@@ -0,0 +1,141 @@
/*
* 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.text.MessageFormat;
import java.util.ArrayList;
import java.util.List;
import java.util.Map;
import javax.faces.context.FacesContext;
import javax.faces.model.SelectItem;
import org.alfresco.model.WCMAppModel;
import org.alfresco.repo.avm.AVMNodeConverter;
import org.alfresco.service.cmr.avm.AVMService;
import org.alfresco.web.app.AlfrescoNavigationHandler;
import org.alfresco.web.app.Application;
import org.alfresco.web.app.servlet.DownloadContentServlet;
import org.alfresco.web.bean.dialog.BaseDialogBean;
import org.alfresco.web.bean.repository.Node;
import org.alfresco.web.ui.common.Utils;
import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;
/**
* @author arielb
*/
public class EditAvmFileDialog
extends BaseDialogBean
{
private static final Log LOGGER = LogFactory.getLog(EditAvmFileDialog.class);
/** AVM service reference */
protected AVMService avmService;
/** AVM Browse Bean reference */
protected AVMBrowseBean avmBrowseBean;
// ------------------------------------------------------------------------------
// Bean property getters and setters
/**
* @param avmService The avmService to set.
*/
public void setAvmService(AVMService avmService)
{
this.avmService = avmService;
}
/**
* @param avmBrowseBean The AVMBrowseBean to set.
*/
public void setAvmBrowseBean(final AVMBrowseBean avmBrowseBean)
{
this.avmBrowseBean = avmBrowseBean;
}
/**
* @return Returns the current AVM node context.
*/
public AVMNode getAvmNode()
{
return this.avmBrowseBean.getAvmActionNode();
}
/**
* @return Large file icon for current AVM node
*/
public String getFileType32()
{
return Utils.getFileTypeImage(getAvmNode().getName(), false);
}
/**
* @return Content URL for current AVM node
*/
public String getUrl()
{
return DownloadContentServlet.generateDownloadURL(AVMNodeConverter.ToNodeRef(-1, getAvmNode().getPath()),
getAvmNode().getName());
}
// ------------------------------------------------------------------------------
// Dialog implementation
@Override
public void init(final Map<String, String> parameters)
{
super.init(parameters);
}
@Override
protected String finishImpl(final FacesContext context, String outcome)
throws Exception
{
AVMNode node = getAvmNode();
if (node != null)
{
// Possibly notify virt server
AVMUtil.updateVServerWebapp(node.getPath(), false);
outcome = AlfrescoNavigationHandler.CLOSE_DIALOG_OUTCOME;
}
return outcome;
}
@Override
public String getContainerTitle()
{
return this.getAvmNode().getName();
}
@Override
public String getCancelButtonLabel()
{
return Application.getMessage(FacesContext.getCurrentInstance(), "close");
}
}

View File

@@ -19,7 +19,8 @@
* and Open Source Software ("FLOSS") applications as described in Alfresco's * and Open Source Software ("FLOSS") applications as described in Alfresco's
* FLOSS exception. You should have recieved a copy of the text describing * FLOSS exception. You should have recieved a copy of the text describing
* the FLOSS exception, and it is also available here: * the FLOSS exception, and it is also available here:
* http://www.alfresco.com/legal/licensing" */ * http://www.alfresco.com/legal/licensing
*/
package org.alfresco.web.bean.wcm; package org.alfresco.web.bean.wcm;
import java.io.Serializable; import java.io.Serializable;
@@ -80,7 +81,7 @@ public class EditFormWizard
throw new IllegalArgumentException("Edit Form wizard requires action node context."); throw new IllegalArgumentException("Edit Form wizard requires action node context.");
} }
final Form form = FormsService.getInstance().getForm(formNodeRef); final Form form = this.formsService.getForm(formNodeRef);
// simple properties // simple properties
this.setFormName(form.getName()); this.setFormName(form.getName());
this.setFormTitle(form.getTitle()); this.setFormTitle(form.getTitle());
@@ -141,7 +142,8 @@ public class EditFormWizard
* @see org.alfresco.web.bean.dialog.BaseDialogBean#finishImpl(javax.faces.context.FacesContext, java.lang.String) * @see org.alfresco.web.bean.dialog.BaseDialogBean#finishImpl(javax.faces.context.FacesContext, java.lang.String)
*/ */
@Override @Override
protected String finishImpl(FacesContext context, String outcome) protected String finishImpl(final FacesContext context,
final String outcome)
throws Exception throws Exception
{ {
final NodeRef formNodeRef = this.browseBean.getActionSpace().getNodeRef(); final NodeRef formNodeRef = this.browseBean.getActionSpace().getNodeRef();
@@ -225,7 +227,7 @@ public class EditFormWizard
this.saveRenderingEngineTemplate(retd, formNodeRef); this.saveRenderingEngineTemplate(retd, formNodeRef);
} }
} }
return AlfrescoNavigationHandler.CLOSE_WIZARD_OUTCOME; return outcome;
} }
/** /**

View File

@@ -74,7 +74,6 @@ import org.alfresco.web.data.IDataContainer;
import org.alfresco.web.data.QuickSort; import org.alfresco.web.data.QuickSort;
import org.alfresco.web.forms.Form; import org.alfresco.web.forms.Form;
import org.alfresco.web.forms.FormInstanceData; import org.alfresco.web.forms.FormInstanceData;
import org.alfresco.web.forms.FormInstanceDataImpl;
import org.alfresco.web.forms.FormNotFoundException; import org.alfresco.web.forms.FormNotFoundException;
import org.alfresco.web.forms.FormProcessor; import org.alfresco.web.forms.FormProcessor;
import org.alfresco.web.forms.FormsService; import org.alfresco.web.forms.FormsService;
@@ -113,7 +112,7 @@ public class EditWebContentWizard extends CreateWebContentWizard
} }
LOGGER.debug("path is " + this.avmNode.getPath()); LOGGER.debug("path is " + this.avmNode.getPath());
this.createdPath = AVMUtil.getCorrespondingPathInPreviewStore(this.avmNode.getPath()); this.createdPath = AVMUtil.getCorrespondingPathInPreviewStore(this.avmNode.getPath());
this.formInstanceData = new FormInstanceDataImpl(-1, this.createdPath); this.formInstanceData = this.formsService.getFormInstanceData(-1, this.createdPath);
final WebProject webProject = new WebProject(this.createdPath); final WebProject webProject = new WebProject(this.createdPath);
try try
{ {
@@ -152,15 +151,8 @@ public class EditWebContentWizard extends CreateWebContentWizard
final ContentWriter writer = this.avmService.getContentWriter(this.createdPath); final ContentWriter writer = this.avmService.getContentWriter(this.createdPath);
this.content = XMLUtil.toString(this.instanceDataDocument, false); this.content = XMLUtil.toString(this.instanceDataDocument, false);
writer.putContent(this.content); writer.putContent(this.content);
this.formInstanceData = new FormInstanceDataImpl(-1, this.createdPath) // XXXarielb might not need to do this reload
{ this.formInstanceData = this.formsService.getFormInstanceData(-1, this.createdPath);
@Override
public Form getForm()
throws FormNotFoundException
{
return EditWebContentWizard.this.getForm();
}
};
final List<FormInstanceData.RegenerateResult> result = this.formInstanceData.regenerateRenditions(); final List<FormInstanceData.RegenerateResult> result = this.formInstanceData.regenerateRenditions();
this.renditions = new LinkedList<Rendition>(); this.renditions = new LinkedList<Rendition>();
for (FormInstanceData.RegenerateResult rr : result) for (FormInstanceData.RegenerateResult rr : result)

View File

@@ -98,7 +98,7 @@ public class EditWebsiteWizard extends CreateWebsiteWizard
String name = (String)this.nodeService.getProperty(formRef, WCMAppModel.PROP_FORMNAME); String name = (String)this.nodeService.getProperty(formRef, WCMAppModel.PROP_FORMNAME);
try try
{ {
final Form formImpl = FormsService.getInstance().getForm(name); final Form formImpl = this.formsService.getForm(name);
FormWrapper form = new FormWrapper(formImpl); FormWrapper form = new FormWrapper(formImpl);
form.setTitle((String)this.nodeService.getProperty(formRef, ContentModel.PROP_TITLE)); form.setTitle((String)this.nodeService.getProperty(formRef, ContentModel.PROP_TITLE));
form.setDescription((String)this.nodeService.getProperty(formRef, ContentModel.PROP_DESCRIPTION)); form.setDescription((String)this.nodeService.getProperty(formRef, ContentModel.PROP_DESCRIPTION));
@@ -147,6 +147,7 @@ public class EditWebsiteWizard extends CreateWebsiteWizard
catch (FormNotFoundException fnfe) catch (FormNotFoundException fnfe)
{ {
//ignore //ignore
LOGGER.debug(fnfe.getMessage(), fnfe);
} }
} }

View File

@@ -24,6 +24,7 @@
*/ */
package org.alfresco.web.bean.wcm; package org.alfresco.web.bean.wcm;
import java.text.MessageFormat;
import java.util.ArrayList; import java.util.ArrayList;
import java.util.List; import java.util.List;
import java.util.Map; import java.util.Map;
@@ -34,6 +35,7 @@ import javax.faces.model.SelectItem;
import org.alfresco.service.cmr.avm.AVMService; import org.alfresco.service.cmr.avm.AVMService;
import org.alfresco.service.cmr.workflow.WorkflowDefinition; import org.alfresco.service.cmr.workflow.WorkflowDefinition;
import org.alfresco.service.cmr.workflow.WorkflowService; import org.alfresco.service.cmr.workflow.WorkflowService;
import org.alfresco.web.app.Application;
import org.alfresco.web.bean.dialog.BaseDialogBean; import org.alfresco.web.bean.dialog.BaseDialogBean;
import org.alfresco.web.bean.wcm.CreateWebsiteWizard.FormWrapper; import org.alfresco.web.bean.wcm.CreateWebsiteWizard.FormWrapper;
import org.alfresco.web.bean.wcm.CreateWebsiteWizard.WorkflowWrapper; import org.alfresco.web.bean.wcm.CreateWebsiteWizard.WorkflowWrapper;
@@ -75,6 +77,14 @@ public class FormDetailsDialog extends BaseDialogBean
this.workflowSelectedValue = null; this.workflowSelectedValue = null;
} }
@Override
public String getContainerDescription()
{
return MessageFormat.format(Application.getBundle(FacesContext.getCurrentInstance()).getString("form_template_details_desc"),
this.getActionForm().getName(),
this.websiteWizard.getName());
}
/** /**
* @param avmService The avmService to set. * @param avmService The avmService to set.
*/ */

View File

@@ -24,6 +24,7 @@
*/ */
package org.alfresco.web.bean.wcm; package org.alfresco.web.bean.wcm;
import java.text.MessageFormat;
import java.util.ArrayList; import java.util.ArrayList;
import java.util.List; import java.util.List;
import java.util.Map; import java.util.Map;
@@ -34,6 +35,7 @@ import javax.faces.model.DataModel;
import javax.faces.model.ListDataModel; import javax.faces.model.ListDataModel;
import org.alfresco.service.cmr.avm.AVMService; import org.alfresco.service.cmr.avm.AVMService;
import org.alfresco.web.app.Application;
import org.alfresco.web.bean.dialog.BaseDialogBean; import org.alfresco.web.bean.dialog.BaseDialogBean;
import org.alfresco.web.bean.wcm.CreateWebsiteWizard.FormWrapper; import org.alfresco.web.bean.wcm.CreateWebsiteWizard.FormWrapper;
import org.alfresco.web.bean.wcm.CreateWebsiteWizard.PresentationTemplate; import org.alfresco.web.bean.wcm.CreateWebsiteWizard.PresentationTemplate;
@@ -97,6 +99,14 @@ public class FormTemplatesDialog extends BaseDialogBean
this.templates.addAll(getActionForm().getTemplates()); this.templates.addAll(getActionForm().getTemplates());
} }
@Override
public String getContainerDescription()
{
return MessageFormat.format(Application.getBundle(FacesContext.getCurrentInstance()).getString("form_template_templates_desc"),
this.getActionForm().getName(),
this.websiteWizard.getName());
}
/** /**
* @return an object representing the form for the current action * @return an object representing the form for the current action
*/ */

View File

@@ -234,9 +234,10 @@ public class ManageChangeRequestTaskDialog extends ManageTaskDialog
Application.getCurrentUser(context).getUserName()); Application.getCurrentUser(context).getUserName());
// setup the context for the submit dialog and initialise it // setup the context for the submit dialog and initialise it
this.avmBrowseBean.setExpiredNodes(submitNodes); this.avmBrowseBean.setNodesForSubmit(submitNodes);
Map<String, String> dialogParams = new HashMap<String, String>(1); Map<String, String> dialogParams = new HashMap<String, String>(1);
dialogParams.put(SubmitDialog.PARAM_STARTED_FROM_WORKFLOW, Boolean.TRUE.toString()); dialogParams.put(SubmitDialog.PARAM_LOAD_SELECTED_NODES_FROM_BROWSE_BEAN,
Boolean.TRUE.toString());
Application.getDialogManager().setupParameters(dialogParams); Application.getDialogManager().setupParameters(dialogParams);
} }
} }

View File

@@ -0,0 +1,236 @@
/*
* 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.text.MessageFormat;
import java.util.ArrayList;
import java.util.List;
import java.util.Map;
import javax.faces.context.FacesContext;
import javax.faces.model.SelectItem;
import org.alfresco.model.WCMAppModel;
import org.alfresco.repo.domain.PropertyValue;
import org.alfresco.service.cmr.avm.AVMService;
import org.alfresco.service.cmr.dictionary.DataTypeDefinition;
import org.alfresco.web.app.AlfrescoNavigationHandler;
import org.alfresco.web.app.Application;
import org.alfresco.web.bean.dialog.BaseDialogBean;
import org.alfresco.web.bean.repository.Node;
import org.alfresco.web.data.IDataContainer;
import org.alfresco.web.data.QuickSort;
import org.alfresco.web.forms.*;
import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;
/**
* @author arielb
*/
public class PromptForWebFormDialog
extends BaseDialogBean
{
private static final Log LOGGER = LogFactory.getLog(PromptForWebFormDialog.class);
/** AVM service reference */
protected AVMService avmService;
/** AVM Browse Bean reference */
protected AVMBrowseBean avmBrowseBean;
/** The FormsService reference */
protected FormsService formsService;
private transient List<SelectItem> formChoices;
private String formName;
private String cancelOutcome;
private String finishOutcome;
// ------------------------------------------------------------------------------
// Bean property getters and setters
/**
* @param avmService The avmService to set.
*/
public void setAvmService(AVMService avmService)
{
this.avmService = avmService;
}
/**
* @param avmBrowseBean The AVMBrowseBean to set.
*/
public void setAvmBrowseBean(final AVMBrowseBean avmBrowseBean)
{
this.avmBrowseBean = avmBrowseBean;
}
/**
* @param formsService The FormsService to set.
*/
public void setFormsService(final FormsService formsService)
{
this.formsService = formsService;
}
/**
* @return Returns the current AVM node context.
*/
public AVMNode getAvmNode()
{
return this.avmBrowseBean.getAvmActionNode();
}
// ------------------------------------------------------------------------------
// Dialog implementation
@Override
public void init(final Map<String, String> parameters)
{
super.init(parameters);
this.cancelOutcome = (this.parameters.containsKey("cancelOutcome")
? this.parameters.get("cancelOutcome")
: "dialog:editAvmFile");
this.finishOutcome = (this.parameters.containsKey("finishOutcome")
? this.parameters.get("finishOutcome")
: "wizard:editWebContent");
this.formName = null;
this.formChoices = null;
final String avmPath = this.getAvmNode().getPath();
if (this.avmService.hasAspect(this.getAvmNode().getVersion(),
avmPath,
WCMAppModel.ASPECT_FORM_INSTANCE_DATA))
{
// build a status message if this is an error case
final FormInstanceData fid = this.formsService.getFormInstanceData(this.getAvmNode().getVersion(), avmPath);
try
{
final Form f = fid.getForm();
this.formName = f.getName();
// strange case... this should throw an exception if we're here...
LOGGER.debug(avmPath + ".getForm() did not throw a form not found. why are we here?");
}
catch (final FormNotFoundException fnfe)
{
String msg = (fnfe.getWebProject() != null
? "prompt_for_web_form_form_not_found_error_in_web_project"
: "prompt_for_web_form_form_not_found_error");
msg = Application.getMessage(FacesContext.getCurrentInstance(), msg);
msg = (fnfe.getWebProject() != null
? MessageFormat.format(msg,
fnfe.getFormName(),
fid.getName(),
fnfe.getWebProject().getName())
: MessageFormat.format(msg,
fnfe.getFormName(),
fid.getName()));
this.avmBrowseBean.displayStatusMessage(FacesContext.getCurrentInstance(), msg);
}
}
}
@Override
protected String finishImpl(final FacesContext context, String outcome)
throws Exception
{
LOGGER.debug("configuring " + this.getAvmNode().getPath() +
" to use form " + this.getFormName());
this.avmService.setNodeProperty(this.getAvmNode().getPath(),
WCMAppModel.PROP_PARENT_FORM_NAME,
new PropertyValue(DataTypeDefinition.TEXT, this.getFormName()));
if (!this.avmService.hasAspect(this.getAvmNode().getVersion(),
this.getAvmNode().getPath(),
WCMAppModel.ASPECT_FORM_INSTANCE_DATA))
{
this.avmService.addAspect(this.getAvmNode().getPath(), WCMAppModel.ASPECT_FORM_INSTANCE_DATA);
}
return outcome;
}
@Override
public boolean getFinishButtonDisabled()
{
return this.getFormChoices().size() == 0;
}
@Override
protected String getDefaultCancelOutcome()
{
return (super.getDefaultCancelOutcome() +
AlfrescoNavigationHandler.OUTCOME_SEPARATOR +
this.cancelOutcome);
}
@Override
protected String getDefaultFinishOutcome()
{
return (super.getDefaultFinishOutcome() +
AlfrescoNavigationHandler.OUTCOME_SEPARATOR +
this.finishOutcome);
}
// ------------------------------------------------------------------------------
// Bean Getters and Setters
/**
* @return the available forms from this web project that can be created.
*/
public List<SelectItem> getFormChoices()
{
if (this.formChoices == null)
{
final WebProject wp = new WebProject(this.getAvmNode().getPath());
final List<Form> forms = wp.getForms();
this.formChoices = new ArrayList<SelectItem>(forms.size());
for (final Form f : forms)
{
this.formChoices.add(new SelectItem(f.getName(), f.getTitle()));
}
final QuickSort sorter = new QuickSort(this.formChoices, "label", true, IDataContainer.SORT_CASEINSENSITIVE);
sorter.sort();
}
return this.formChoices;
}
/**
* @return the currently selected form
*/
public String getFormName()
{
return this.formName;
}
/**
* @param form Sets the currently selected form
*/
public void setFormName(final String formName)
{
this.formName = formName;
}
}

View File

@@ -89,6 +89,7 @@ public class RegenerateRenditionsWizard
private AVMSyncService avmSyncService; private AVMSyncService avmSyncService;
private ContentService contentService; private ContentService contentService;
private SearchService searchService; private SearchService searchService;
private FormsService formsService;
private WebProject selectedWebProject; private WebProject selectedWebProject;
private String[] selectedForms; private String[] selectedForms;
private String[] selectedRenderingEngineTemplates; private String[] selectedRenderingEngineTemplates;
@@ -395,6 +396,14 @@ public class RegenerateRenditionsWizard
this.searchService = searchService; this.searchService = searchService;
} }
/**
* @param formsService The FormsService to set.
*/
public void setFormsService(final FormsService formsService)
{
this.formsService = formsService;
}
// ------------------------------------------------------------------------------ // ------------------------------------------------------------------------------
// Helper Methods // Helper Methods
@@ -418,24 +427,7 @@ public class RegenerateRenditionsWizard
{ {
final String avmPath = AVMNodeConverter.ToAVMVersionPath(row.getNodeRef()).getSecond(); final String avmPath = AVMNodeConverter.ToAVMVersionPath(row.getNodeRef()).getSecond();
final String previewAvmPath = AVMUtil.getCorrespondingPathInPreviewStore(avmPath); final String previewAvmPath = AVMUtil.getCorrespondingPathInPreviewStore(avmPath);
final FormInstanceDataImpl fid = new FormInstanceDataImpl(-1, previewAvmPath) result.add(this.formsService.getFormInstanceData(-1, previewAvmPath));
{
@Override
public Form getForm()
throws FormNotFoundException
{
final Form f = super.getForm();
try
{
return RegenerateRenditionsWizard.this.selectedWebProject.getForm(f.getName());
}
catch (FormNotFoundException fnfe)
{
throw new FormNotFoundException(f, RegenerateRenditionsWizard.this.selectedWebProject, this);
}
}
};
result.add(fid);
} }
return result; return result;
} }
@@ -459,8 +451,7 @@ public class RegenerateRenditionsWizard
{ {
final String avmPath = AVMNodeConverter.ToAVMVersionPath(row.getNodeRef()).getSecond(); final String avmPath = AVMNodeConverter.ToAVMVersionPath(row.getNodeRef()).getSecond();
final String previewAvmPath = AVMUtil.getCorrespondingPathInPreviewStore(avmPath); final String previewAvmPath = AVMUtil.getCorrespondingPathInPreviewStore(avmPath);
final Rendition r = new RenditionImpl(-1, previewAvmPath); result.add(this.formsService.getRendition(-1, previewAvmPath));
result.add(r);
} }
return result; return result;
} }
@@ -540,24 +531,7 @@ public class RegenerateRenditionsWizard
if (this.regenerateScope.equals(REGENERATE_SCOPE_ALL) || if (this.regenerateScope.equals(REGENERATE_SCOPE_ALL) ||
this.regenerateScope.equals(REGENERATE_SCOPE_FORM)) this.regenerateScope.equals(REGENERATE_SCOPE_FORM))
{ {
final FormInstanceDataImpl fid = new FormInstanceDataImpl(-1, previewAvmPath) final FormInstanceData fid = this.formsService.getFormInstanceData(-1, previewAvmPath);
{
@Override
public Form getForm()
throws FormNotFoundException
{
final Form f = super.getForm();
try
{
return RegenerateRenditionsWizard.this.selectedWebProject.getForm(f.getName());
}
catch (FormNotFoundException fnfe)
{
throw new FormNotFoundException(f, RegenerateRenditionsWizard.this.selectedWebProject, this);
}
}
};
try try
{ {
final List<FormInstanceData.RegenerateResult> regenResults = fid.regenerateRenditions(); final List<FormInstanceData.RegenerateResult> regenResults = fid.regenerateRenditions();
@@ -582,7 +556,7 @@ public class RegenerateRenditionsWizard
} }
else else
{ {
final Rendition r = new RenditionImpl(-1, previewAvmPath); final Rendition r = this.formsService.getRendition(-1, previewAvmPath);
try try
{ {
r.regenerate(); r.regenerate();

View File

@@ -75,7 +75,7 @@ import org.alfresco.web.bean.dialog.BaseDialogBean;
import org.alfresco.web.bean.repository.Repository; import org.alfresco.web.bean.repository.Repository;
import org.alfresco.web.config.ClientConfigElement; import org.alfresco.web.config.ClientConfigElement;
import org.alfresco.web.forms.FormInstanceData; import org.alfresco.web.forms.FormInstanceData;
import org.alfresco.web.forms.FormInstanceDataImpl; import org.alfresco.web.forms.FormsService;
import org.alfresco.web.forms.Rendition; import org.alfresco.web.forms.Rendition;
import org.alfresco.web.ui.common.Utils; import org.alfresco.web.ui.common.Utils;
import org.alfresco.web.ui.common.component.UIListItem; import org.alfresco.web.ui.common.component.UIListItem;
@@ -89,7 +89,7 @@ import org.apache.commons.logging.LogFactory;
*/ */
public class SubmitDialog extends BaseDialogBean public class SubmitDialog extends BaseDialogBean
{ {
public static final String PARAM_STARTED_FROM_WORKFLOW = "startedFromWorkflow"; public static final String PARAM_LOAD_SELECTED_NODES_FROM_BROWSE_BEAN = "loadSelectedNodesFromBrowseBean";
private static final String SPACE_ICON = "/images/icons/" + BrowseBean.SPACE_SMALL_DEFAULT + ".gif"; private static final String SPACE_ICON = "/images/icons/" + BrowseBean.SPACE_SMALL_DEFAULT + ".gif";
private static final String MSG_DELETED_ITEM = "avm_node_deleted"; private static final String MSG_DELETED_ITEM = "avm_node_deleted";
private static final String MSG_ERR_WORKFLOW_CONFIG = "submit_workflow_config_error"; private static final String MSG_ERR_WORKFLOW_CONFIG = "submit_workflow_config_error";
@@ -98,7 +98,7 @@ public class SubmitDialog extends BaseDialogBean
private String label; private String label;
private String[] workflowSelectedValue; private String[] workflowSelectedValue;
private boolean enteringExpireDate = false; private boolean enteringExpireDate = false;
private boolean startedFromWorkflow = false; private boolean loadSelectedNodesFromBrowseBean = false;
private boolean validateLinks = true; private boolean validateLinks = true;
private Date defaultExpireDate; private Date defaultExpireDate;
private Date launchDate; private Date launchDate;
@@ -106,7 +106,7 @@ public class SubmitDialog extends BaseDialogBean
private List<ItemWrapper> submitItems; private List<ItemWrapper> submitItems;
private List<ItemWrapper> warningItems; private List<ItemWrapper> warningItems;
private HashSet<FormWorkflowWrapper> workflows; private HashSet<FormWorkflowWrapper> workflows;
private Map<String, FormWorkflowWrapper> formWorkflowMap; // private Map<String, FormWorkflowWrapper> formWorkflowMap;
private Map<String, Date> expirationDates; private Map<String, Date> expirationDates;
private List<UIListItem> workflowItems; private List<UIListItem> workflowItems;
private Map<QName, Serializable> workflowParams; private Map<QName, Serializable> workflowParams;
@@ -130,11 +130,12 @@ public class SubmitDialog extends BaseDialogBean
protected AVMSyncService avmSyncService; protected AVMSyncService avmSyncService;
protected AVMLockingService avmLockingService; protected AVMLockingService avmLockingService;
protected NameMatcher nameMatcher; protected NameMatcher nameMatcher;
protected FormsService formsService;
/** Current workflow for dialog context */ /** Current workflow for dialog context */
protected WorkflowConfiguration actionWorkflow = null; protected WorkflowConfiguration actionWorkflow = null;
private static Log logger = LogFactory.getLog(SubmitDialog.class); private static final Log LOGGER = LogFactory.getLog(SubmitDialog.class);
/** /**
* @param avmService The AVM Service to set. * @param avmService The AVM Service to set.
@@ -192,6 +193,14 @@ public class SubmitDialog extends BaseDialogBean
this.nameMatcher = nameMatcher; this.nameMatcher = nameMatcher;
} }
/**
* @param formsService The FormsService to set.
*/
public void setFormsService(final FormsService formsService)
{
this.formsService = formsService;
}
/** /**
* @see org.alfresco.web.bean.dialog.BaseDialogBean#init(java.util.Map) * @see org.alfresco.web.bean.dialog.BaseDialogBean#init(java.util.Map)
*/ */
@@ -216,29 +225,7 @@ public class SubmitDialog extends BaseDialogBean
this.virtUpdatePath = null; this.virtUpdatePath = null;
// determine if the dialog has been started from a workflow // determine if the dialog has been started from a workflow
Boolean bool = new Boolean(this.parameters.get(PARAM_STARTED_FROM_WORKFLOW)); this.loadSelectedNodesFromBrowseBean = Boolean.valueOf(this.parameters.get(PARAM_LOAD_SELECTED_NODES_FROM_BROWSE_BEAN));
this.startedFromWorkflow = bool;
// walk all the web forms attached the website, and lookup the workflow defaults for each
NodeRef websiteRef = this.avmBrowseBean.getWebsite().getNodeRef();
List<ChildAssociationRef> webFormRefs = this.nodeService.getChildAssocs(
websiteRef, WCMAppModel.ASSOC_WEBFORM, RegexQNamePattern.MATCH_ALL);
this.formWorkflowMap = new HashMap<String, FormWorkflowWrapper>(webFormRefs.size(), 1.0f);
for (ChildAssociationRef ref : webFormRefs)
{
NodeRef webFormRef = ref.getChildRef();
String form = (String)this.nodeService.getProperty(webFormRef, WCMAppModel.PROP_FORMNAME);
List<ChildAssociationRef> wfRefs = this.nodeService.getChildAssocs(
webFormRef, WCMAppModel.TYPE_WORKFLOW_DEFAULTS, RegexQNamePattern.MATCH_ALL);
if (wfRefs.size() == 1)
{
NodeRef wfDefaultsRef = wfRefs.get(0).getChildRef();
String wfName = (String)this.nodeService.getProperty(wfDefaultsRef, WCMAppModel.PROP_WORKFLOW_NAME);
Map<QName, Serializable> params = (Map<QName, Serializable>)AVMWorkflowUtil.deserializeWorkflowParams(
wfDefaultsRef);
this.formWorkflowMap.put(form, new FormWorkflowWrapper(wfName, params));
}
}
} }
@Override @Override
@@ -637,7 +624,7 @@ public class SubmitDialog extends BaseDialogBean
catch (Throwable e) catch (Throwable e)
{ {
// not much we can do now, just log the error to inform admins // not much we can do now, just log the error to inform admins
logger.error("Failed to cleanup workflow sandbox after workflow failure", e); LOGGER.error("Failed to cleanup workflow sandbox after workflow failure", e);
} }
} }
@@ -873,7 +860,7 @@ public class SubmitDialog extends BaseDialogBean
// add first workflow as default selection // add first workflow as default selection
if (workflowSelectedValue == null) if (workflowSelectedValue == null)
{ {
workflowSelectedValue = new String[]{workflowDef.getName()}; workflowSelectedValue = new String[]{ workflowDef.getName() };
} }
} }
this.workflowItems = items; this.workflowItems = items;
@@ -946,16 +933,14 @@ public class SubmitDialog extends BaseDialogBean
tx.begin(); tx.begin();
List<AVMNodeDescriptor> selected; List<AVMNodeDescriptor> selected;
if (this.startedFromWorkflow) if (this.loadSelectedNodesFromBrowseBean)
{ {
// if the dialog was started from a workflow the AVM browse bean should // if the dialog was started from a workflow the AVM browse bean should
// have the list of nodes that need submitting // have the list of nodes that need submitting
selected = this.avmBrowseBean.getExpiredNodes(); selected = this.avmBrowseBean.getNodesForSubmit();
} }
else
{
// if the dialog was started from the UI determine what nodes the user selected to submit // if the dialog was started from the UI determine what nodes the user selected to submit
if (this.avmBrowseBean.getAllItemsAction()) else if (this.avmBrowseBean.getAllItemsAction())
{ {
String webapp = this.avmBrowseBean.getWebapp(); String webapp = this.avmBrowseBean.getWebapp();
String userStore = AVMUtil.buildStoreWebappPath(this.avmBrowseBean.getSandbox(), webapp); String userStore = AVMUtil.buildStoreWebappPath(this.avmBrowseBean.getSandbox(), webapp);
@@ -964,8 +949,7 @@ public class SubmitDialog extends BaseDialogBean
selected = new ArrayList<AVMNodeDescriptor>(diffs.size()); selected = new ArrayList<AVMNodeDescriptor>(diffs.size());
for (AVMDifference diff : diffs) for (AVMDifference diff : diffs)
{ {
AVMNodeDescriptor node = this.avmService.lookup(-1, diff.getSourcePath(), true); selected.add(this.avmService.lookup(-1, diff.getSourcePath(), true));
selected.add(node);
} }
} }
else if (this.avmBrowseBean.getAvmActionNode() == null) else if (this.avmBrowseBean.getAvmActionNode() == null)
@@ -976,101 +960,82 @@ public class SubmitDialog extends BaseDialogBean
else else
{ {
// single item selected // single item selected
AVMNodeDescriptor node =
this.avmService.lookup(-1, this.avmBrowseBean.getAvmActionNode().getPath(), true);
selected = new ArrayList<AVMNodeDescriptor>(1); selected = new ArrayList<AVMNodeDescriptor>(1);
selected.add(node); selected.add(this.avmService.lookup(-1, this.avmBrowseBean.getAvmActionNode().getPath(), true));
}
} }
if (selected != null) if (selected == null)
{
this.submitItems = Collections.<ItemWrapper>emptyList();
this.warningItems = Collections.<ItemWrapper>emptyList();
}
else
{ {
Set<String> submittedPaths = new HashSet<String>(selected.size()); Set<String> submittedPaths = new HashSet<String>(selected.size());
this.submitItems = new ArrayList<ItemWrapper>(selected.size()); this.submitItems = new ArrayList<ItemWrapper>(selected.size());
this.warningItems = new ArrayList<ItemWrapper>(selected.size() >> 1); this.warningItems = new ArrayList<ItemWrapper>(selected.size() >> 1);
for (AVMNodeDescriptor node : selected) for (AVMNodeDescriptor node : selected)
{ {
if (this.avmService.hasAspect(-1, node.getPath(), AVMSubmittedAspect.ASPECT) == false) if (this.avmService.hasAspect(-1, node.getPath(), AVMSubmittedAspect.ASPECT))
{ {
this.warningItems.add(new ItemWrapper(node));
continue;
}
NodeRef ref = AVMNodeConverter.ToNodeRef(-1, node.getPath()); NodeRef ref = AVMNodeConverter.ToNodeRef(-1, node.getPath());
if (submittedPaths.contains(node.getPath()) == false) if (submittedPaths.contains(node.getPath()))
{ {
if (node.isDeleted() == false) continue;
}
if (node.isDeleted())
{ {
// found a deleted node for submit
this.submitItems.add(new ItemWrapper(node));
submittedPaths.add(node.getPath());
}
// lookup if this item was created via a form - then lookup the workflow defaults // lookup if this item was created via a form - then lookup the workflow defaults
// for that form and store into the list of available workflows // for that form and store into the list of available workflows
if (this.nodeService.hasAspect(ref, WCMAppModel.ASPECT_FORM_INSTANCE_DATA)) else if (! this.nodeService.hasAspect(ref, WCMAppModel.ASPECT_FORM_INSTANCE_DATA))
{ {
NodeRef formInstanceDataRef = ref; this.submitItems.add(new ItemWrapper(node));
submittedPaths.add(node.getPath());
}
else
{
FormInstanceData fid = null;
// check if this is a rendition - as they also have the forminstancedata aspect // check if this is a rendition - as they also have the forminstancedata aspect
if (this.nodeService.hasAspect(ref, WCMAppModel.ASPECT_RENDITION)) if (this.nodeService.hasAspect(ref, WCMAppModel.ASPECT_RENDITION))
{ {
// found a generated rendition asset - locate the parent form instance data file // found a generated rendition asset - locate the parent form instance data file
// and use this to find all generated assets that are appropriate // and use this to find all generated assets that are appropriate
// NOTE: this path value is store relative // NOTE: this path value is store relative
String strFormInstance = (String)this.nodeService.getProperty( fid = this.formsService.getRendition(ref).getPrimaryFormInstanceData();
ref, WCMAppModel.PROP_PRIMARY_FORM_INSTANCE_DATA); }
strFormInstance = this.avmBrowseBean.getSandbox() + ':' + strFormInstance; else
formInstanceDataRef = AVMNodeConverter.ToNodeRef(-1, strFormInstance); {
fid = this.formsService.getFormInstanceData(ref);
} }
// add the form instance data file to the list for submission // add the form instance data file to the list for submission
AVMNodeDescriptor formInstanceNode = this.avmService.lookup( if (!submittedPaths.contains(fid.getPath()))
-1, AVMNodeConverter.ToAVMVersionPath(formInstanceDataRef).getSecond());
if (submittedPaths.contains(formInstanceNode.getPath()) == false)
{ {
this.submitItems.add(new ItemWrapper(formInstanceNode)); this.submitItems.add(new ItemWrapper(this.avmService.lookup(-1, fid.getPath())));
submittedPaths.add(formInstanceNode.getPath()); submittedPaths.add(fid.getPath());
} }
// locate renditions for this form instance data file and add to list for submission // locate renditions for this form instance data file and add to list for submission
FormInstanceData formImpl = new FormInstanceDataImpl(formInstanceDataRef); for (final Rendition rendition : fid.getRenditions())
for (Rendition rendition : formImpl.getRenditions())
{ {
String renditionPath = rendition.getPath(); final String renditionPath = rendition.getPath();
if (submittedPaths.contains(renditionPath) == false) if (!submittedPaths.contains(renditionPath))
{ {
AVMNodeDescriptor renditionNode = this.avmService.lookup(-1, renditionPath); this.submitItems.add(new ItemWrapper(this.avmService.lookup(-1, renditionPath)));
this.submitItems.add(new ItemWrapper(renditionNode));
submittedPaths.add(renditionPath); submittedPaths.add(renditionPath);
} }
} }
this.workflows.add(new FormWorkflowWrapper(fid.getForm().getDefaultWorkflow().getName(),
// lookup the associated Form workflow from the parent form property fid.getForm().getDefaultWorkflowParameters()));
String formName = (String)this.nodeService.getProperty(
formInstanceDataRef, WCMAppModel.PROP_PARENT_FORM_NAME);
FormWorkflowWrapper wrapper = this.formWorkflowMap.get(formName);
if (wrapper != null)
{
// found a workflow attached to the form
this.workflows.add(wrapper);
} }
} }
else
{
this.submitItems.add(new ItemWrapper(node));
submittedPaths.add(node.getPath());
}
}
else
{
// found a deleted node for submit
this.submitItems.add(new ItemWrapper(node));
submittedPaths.add(node.getPath());
}
}
}
else
{
this.warningItems.add(new ItemWrapper(node));
}
}
}
else
{
this.submitItems = Collections.<ItemWrapper>emptyList();
this.warningItems = Collections.<ItemWrapper>emptyList();
} }
tx.commit(); tx.commit();
@@ -1092,8 +1057,10 @@ public class SubmitDialog extends BaseDialogBean
// if an expiration date has been set for this item we need to // if an expiration date has been set for this item we need to
// add the expires aspect and the date supplied // add the expires aspect and the date supplied
Date expirationDate = this.expirationDates.get(srcPath); Date expirationDate = this.expirationDates.get(srcPath);
if (expirationDate != null) if (expirationDate == null)
{ {
return;
}
// make sure the aspect is present // make sure the aspect is present
if (this.avmService.hasAspect(-1, srcPath, WCMAppModel.ASPECT_EXPIRES) == false) if (this.avmService.hasAspect(-1, srcPath, WCMAppModel.ASPECT_EXPIRES) == false)
{ {
@@ -1104,19 +1071,20 @@ public class SubmitDialog extends BaseDialogBean
this.avmService.setNodeProperty(srcPath, WCMAppModel.PROP_EXPIRATIONDATE, this.avmService.setNodeProperty(srcPath, WCMAppModel.PROP_EXPIRATIONDATE,
new PropertyValue(DataTypeDefinition.DATETIME, expirationDate)); new PropertyValue(DataTypeDefinition.DATETIME, expirationDate));
if (logger.isDebugEnabled()) if (LOGGER.isDebugEnabled())
logger.debug("Set expiration date of " + expirationDate + LOGGER.debug("Set expiration date of " + expirationDate +
" for " + srcPath); " for " + srcPath);
} }
}
/** /**
* Action method to setup a workflow for dialog context for the current row * Action method to setup a workflow for dialog context for the current row
*/ */
public void setupConfigureWorkflow(ActionEvent event) public void setupConfigureWorkflow(ActionEvent event)
{ {
if (this.workflowSelectedValue != null) if (this.workflowSelectedValue == null)
{ {
return;
}
String workflowName = this.workflowSelectedValue[0]; String workflowName = this.workflowSelectedValue[0];
for (WorkflowConfiguration wrapper : this.workflows) for (WorkflowConfiguration wrapper : this.workflows)
{ {
@@ -1126,7 +1094,6 @@ public class SubmitDialog extends BaseDialogBean
} }
} }
} }
}
/** /**
* @return Returns the action Workflow for dialog context * @return Returns the action Workflow for dialog context
@@ -1151,8 +1118,8 @@ public class SubmitDialog extends BaseDialogBean
*/ */
public void applyDefaultExpireDateToAll(ActionEvent event) public void applyDefaultExpireDateToAll(ActionEvent event)
{ {
if (logger.isDebugEnabled()) if (LOGGER.isDebugEnabled())
logger.debug("applying default expiration date of " + this.defaultExpireDate + " to all modified items"); LOGGER.debug("applying default expiration date of " + this.defaultExpireDate + " to all modified items");
List<ItemWrapper> items = this.getSubmitItems(); List<ItemWrapper> items = this.getSubmitItems();
for (ItemWrapper item : items) for (ItemWrapper item : items)
@@ -1241,14 +1208,8 @@ public class SubmitDialog extends BaseDialogBean
boolean matchesPath(String path) boolean matchesPath(String path)
{ {
if (filenamePattern != null) return (filenamePattern != null &&
{ filenamePattern.matcher(path).matches());
return filenamePattern.matcher(path).matches();
}
else
{
return false;
}
} }
@Override @Override
@@ -1260,14 +1221,8 @@ public class SubmitDialog extends BaseDialogBean
@Override @Override
public boolean equals(Object obj) public boolean equals(Object obj)
{ {
if (obj instanceof FormWorkflowWrapper) return (obj instanceof FormWorkflowWrapper &&
{ this.name.equals(((FormWorkflowWrapper)obj).name));
return this.name.equals( ((FormWorkflowWrapper)obj).name );
}
else
{
return false;
}
} }
} }
@@ -1376,14 +1331,8 @@ public class SubmitDialog extends BaseDialogBean
@Override @Override
public boolean equals(Object obj) public boolean equals(Object obj)
{ {
if (obj instanceof ItemWrapper) return (obj instanceof ItemWrapper &&
{ ((ItemWrapper)obj).descriptor.getPath().equals(descriptor.getPath()));
return ((ItemWrapper)obj).descriptor.getPath().equals(descriptor.getPath());
}
else
{
return false;
}
} }
@Override @Override

View File

@@ -51,6 +51,7 @@ import org.alfresco.service.namespace.NamespaceService;
import org.alfresco.service.namespace.QName; import org.alfresco.service.namespace.QName;
import org.alfresco.service.namespace.RegexQNamePattern; import org.alfresco.service.namespace.RegexQNamePattern;
import org.alfresco.web.app.Application; 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.repository.Repository;
import org.alfresco.web.bean.repository.User; import org.alfresco.web.bean.repository.User;
import org.alfresco.web.data.IDataContainer; import org.alfresco.web.data.IDataContainer;
@@ -85,9 +86,11 @@ public class WebProject
private Form baseForm; private Form baseForm;
private NodeRef defaultWorkflowNodeRef; private NodeRef defaultWorkflowNodeRef;
private FormWrapper(final Form form, final NodeRef formNodeRef) private FormWrapper(final Form form,
final NodeRef formNodeRef,
final FormsService formsService)
{ {
super(((FormImpl)form).getNodeRef()); super(((FormImpl)form).getNodeRef(), formsService);
this.formNodeRef = formNodeRef; this.formNodeRef = formNodeRef;
} }
@@ -160,7 +163,8 @@ public class WebProject
allRets.get(renderingEngineTemplateName); allRets.get(renderingEngineTemplateName);
result.put(ret.getName(), result.put(ret.getName(),
new RenderingEngineTemplateImpl(ret.getNodeRef(), new RenderingEngineTemplateImpl(ret.getNodeRef(),
ret.getRenditionPropertiesNodeRef()) ret.getRenditionPropertiesNodeRef(),
this.formsService)
{ {
@Override @Override
public String getOutputPathPattern() public String getOutputPathPattern()
@@ -308,8 +312,14 @@ public class WebProject
throw new NullPointerException(); throw new NullPointerException();
} }
final Form result = this.getFormsImpl().get(name); final Form result = this.getFormsImpl().get(name);
if (result == null) if (result == null || !name.equals(result.getName()))
{ {
if (result != null)
{
LOGGER.debug("removing " + name +
" from cache as it doesn't match mapped form " + result.getName());
this.getFormsImpl().remove(name);
}
throw new FormNotFoundException(name, this); throw new FormNotFoundException(name, this);
} }
return result; return result;
@@ -420,7 +430,7 @@ public class WebProject
{ {
final ServiceRegistry serviceRegistry = this.getServiceRegistry(); final ServiceRegistry serviceRegistry = this.getServiceRegistry();
final NodeService nodeService = serviceRegistry.getNodeService(); final NodeService nodeService = serviceRegistry.getNodeService();
final FormsService formsService = FormsService.getInstance(); final FormsService formsService = WebProject.getFormsService();
final List<ChildAssociationRef> formRefs = final List<ChildAssociationRef> formRefs =
nodeService.getChildAssocs(this.nodeRef, nodeService.getChildAssocs(this.nodeRef,
WCMAppModel.ASSOC_WEBFORM, WCMAppModel.ASSOC_WEBFORM,
@@ -433,16 +443,23 @@ public class WebProject
try try
{ {
final Form baseForm = formsService.getForm(formName); final Form baseForm = formsService.getForm(formName);
result.put(formName, new FormWrapper(baseForm, ref.getChildRef())); result.put(formName, new FormWrapper(baseForm, ref.getChildRef(), formsService));
} }
catch (FormNotFoundException fnfe) catch (FormNotFoundException fnfe)
{ {
LOGGER.debug(fnfe); LOGGER.debug("got exception " + fnfe.getMessage() +
" while loading web forms for project " + this.getName());
} }
} }
return result; return result;
} }
private static FormsService getFormsService()
{
return (FormsService)FacesHelper.getManagedBean(FacesContext.getCurrentInstance(),
"FormsService");
}
private static ServiceRegistry getServiceRegistry() private static ServiceRegistry getServiceRegistry()
{ {
final FacesContext fc = FacesContext.getCurrentInstance(); final FacesContext fc = FacesContext.getCurrentInstance();

View File

@@ -64,6 +64,7 @@ public class FormImpl
private static final Log LOGGER = LogFactory.getLog(FormImpl.class); private static final Log LOGGER = LogFactory.getLog(FormImpl.class);
private final NodeRef folderNodeRef; private final NodeRef folderNodeRef;
protected final FormsService formsService;
private transient Map<String, RenderingEngineTemplate> renderingEngineTemplates; private transient Map<String, RenderingEngineTemplate> renderingEngineTemplates;
private final static LinkedList<FormProcessor> PROCESSORS = private final static LinkedList<FormProcessor> PROCESSORS =
@@ -73,9 +74,25 @@ public class FormImpl
FormImpl.PROCESSORS.add(new XFormsProcessor()); FormImpl.PROCESSORS.add(new XFormsProcessor());
} }
public FormImpl(final NodeRef folderNodeRef) protected FormImpl(final NodeRef folderNodeRef,
final FormsService formsService)
{ {
if (folderNodeRef == null)
{
throw new NullPointerException();
}
if (formsService == null)
{
throw new NullPointerException();
}
final NodeService nodeService = this.getServiceRegistry().getNodeService();
if (!nodeService.hasAspect(folderNodeRef, WCMAppModel.ASPECT_FORM))
{
throw new IllegalArgumentException("node " + folderNodeRef +
" does not have aspect " + WCMAppModel.ASPECT_FORM);
}
this.folderNodeRef = folderNodeRef; this.folderNodeRef = folderNodeRef;
this.formsService = formsService;
} }
public String getName() public String getName()
@@ -304,7 +321,7 @@ public class FormImpl
final NodeRef renditionPropertiesNodeRef = assoc2.getChildRef(); final NodeRef renditionPropertiesNodeRef = assoc2.getChildRef();
final RenderingEngineTemplate ret = final RenderingEngineTemplate ret =
new RenderingEngineTemplateImpl(retNodeRef, renditionPropertiesNodeRef); new RenderingEngineTemplateImpl(retNodeRef, renditionPropertiesNodeRef, this.formsService);
LOGGER.debug("loaded rendering engine template " + ret); LOGGER.debug("loaded rendering engine template " + ret);
result.put(ret.getName(), ret); result.put(ret.getName(), ret);
} }

View File

@@ -48,26 +48,41 @@ import org.xml.sax.SAXException;
* *
* @author Ariel Backenroth * @author Ariel Backenroth
*/ */
public class FormInstanceDataImpl /* package */ class FormInstanceDataImpl
implements FormInstanceData implements FormInstanceData
{ {
private static final Log LOGGER = LogFactory.getLog(RenditionImpl.class); private static final Log LOGGER = LogFactory.getLog(RenditionImpl.class);
private final NodeRef nodeRef; private final NodeRef nodeRef;
private final FormsService formsService;
public FormInstanceDataImpl(final NodeRef nodeRef) /* package */ FormInstanceDataImpl(final NodeRef nodeRef,
final FormsService formsService)
{ {
if (nodeRef == null) if (nodeRef == null)
{ {
throw new NullPointerException(); throw new NullPointerException();
} }
if (formsService == null)
{
throw new NullPointerException();
}
final NodeService nodeService = this.getServiceRegistry().getNodeService();
if (!nodeService.hasAspect(nodeRef, WCMAppModel.ASPECT_FORM_INSTANCE_DATA))
{
throw new IllegalArgumentException("node " + nodeRef +
" does not have aspect " + WCMAppModel.ASPECT_FORM_INSTANCE_DATA);
}
this.nodeRef = nodeRef; this.nodeRef = nodeRef;
this.formsService = formsService;
} }
public FormInstanceDataImpl(final int version, final String avmPath) /* package */ FormInstanceDataImpl(final int version,
final String avmPath,
final FormsService formsService)
{ {
this(AVMNodeConverter.ToNodeRef(version, avmPath)); this(AVMNodeConverter.ToNodeRef(version, avmPath), formsService);
} }
/** the name of this rendition */ /** the name of this rendition */
@@ -106,7 +121,7 @@ public class FormInstanceDataImpl
final String parentFormName = this.getParentFormName(); final String parentFormName = this.getParentFormName();
try try
{ {
return FormsService.getInstance().getForm(parentFormName); return this.formsService.getForm(parentFormName);
} }
catch (FormNotFoundException fnfe) catch (FormNotFoundException fnfe)
{ {
@@ -194,7 +209,8 @@ public class FormInstanceDataImpl
{ {
if (avmService.lookup(-1, storeName + ':' + (String)path) != null) if (avmService.lookup(-1, storeName + ':' + (String)path) != null)
{ {
final Rendition r = new RenditionImpl(AVMNodeConverter.ToNodeRef(-1, storeName + ':' + (String)path)); final Rendition r = new RenditionImpl(AVMNodeConverter.ToNodeRef(-1, storeName + ':' + (String)path),
this.formsService);
if (r.getRenderingEngineTemplate() != null) if (r.getRenderingEngineTemplate() != null)
{ {
result.add(r); result.add(r);

View File

@@ -107,4 +107,14 @@ public class FormNotFoundException
this.webProject = webProject; this.webProject = webProject;
this.fid = fid; this.fid = fid;
} }
public String getFormName()
{
return this.formName;
}
public WebProject getWebProject()
{
return this.webProject;
}
} }

View File

@@ -19,7 +19,8 @@
* and Open Source Software ("FLOSS") applications as described in Alfresco's * and Open Source Software ("FLOSS") applications as described in Alfresco's
* FLOSS exception. You should have recieved a copy of the text describing * FLOSS exception. You should have recieved a copy of the text describing
* the FLOSS exception, and it is also available here: * the FLOSS exception, and it is also available here:
* http://www.alfresco.com/legal/licensing" */ * http://www.alfresco.com/legal/licensing
*/
package org.alfresco.web.forms; package org.alfresco.web.forms;
import java.io.*; import java.io.*;
@@ -58,6 +59,7 @@ import org.alfresco.util.ISO9075;
import org.alfresco.web.app.Application; import org.alfresco.web.app.Application;
import org.alfresco.web.bean.repository.Repository; import org.alfresco.web.bean.repository.Repository;
import org.alfresco.web.bean.wcm.AVMUtil; import org.alfresco.web.bean.wcm.AVMUtil;
import org.alfresco.web.bean.wcm.WebProject;
import org.alfresco.web.data.IDataContainer; import org.alfresco.web.data.IDataContainer;
import org.alfresco.web.data.QuickSort; import org.alfresco.web.data.QuickSort;
import org.apache.commons.logging.Log; import org.apache.commons.logging.Log;
@@ -76,10 +78,6 @@ public final class FormsService
{ {
private static final Log LOGGER = LogFactory.getLog(FormsService.class); private static final Log LOGGER = LogFactory.getLog(FormsService.class);
/** the single instance initialized using spring */
private static FormsService INSTANCE;
private static final RenderingEngine[] RENDERING_ENGINES = new RenderingEngine[] private static final RenderingEngine[] RENDERING_ENGINES = new RenderingEngine[]
{ {
new FreeMarkerRenderingEngine(), new FreeMarkerRenderingEngine(),
@@ -104,14 +102,6 @@ public final class FormsService
this.nodeService = nodeService; this.nodeService = nodeService;
this.namespaceService = namespaceService; this.namespaceService = namespaceService;
this.searchService = searchService; this.searchService = searchService;
if (INSTANCE == null)
INSTANCE = this;
}
/** Provides the forms service instance, loads config if necessary */
public static FormsService getInstance()
{
return FormsService.INSTANCE;
} }
/** /**
@@ -213,24 +203,9 @@ public final class FormsService
public Form getForm(final String name) public Form getForm(final String name)
throws FormNotFoundException throws FormNotFoundException
{ {
final SearchParameters sp = new SearchParameters(); final NodeRef result = this.nodeService.getChildByName(this.getContentFormsNodeRef(),
sp.addStore(Repository.getStoreRef()); ContentModel.ASSOC_CONTAINS,
sp.setLanguage(SearchService.LANGUAGE_LUCENE); name);
sp.setQuery("ASPECT:\"" + WCMAppModel.ASPECT_FORM +
"\" AND QNAME:\"cm:" + ISO9075.encode(QName.createValidLocalName(name)) + "\"");
if (LOGGER.isDebugEnabled())
LOGGER.debug("running query [" + sp.getQuery() + "]");
final ResultSet rs = this.searchService.query(sp);
NodeRef result = null;
for (ResultSetRow row : rs)
{
final NodeRef nr = row.getNodeRef();
if (this.nodeService.getProperty(nr, ContentModel.PROP_NAME).equals(name))
{
result = nr;
break;
}
}
if (result == null) if (result == null)
{ {
throw new FormNotFoundException(name); throw new FormNotFoundException(name);
@@ -251,9 +226,47 @@ public final class FormsService
{ {
throw new IllegalArgumentException("node " + nodeRef + " is not a form"); throw new IllegalArgumentException("node " + nodeRef + " is not a form");
} }
final Form result = new FormImpl(nodeRef); final Form result = new FormImpl(nodeRef, this);
if (LOGGER.isDebugEnabled()) if (LOGGER.isDebugEnabled())
LOGGER.debug("loaded form " + result + " for noderef " + nodeRef); LOGGER.debug("loaded form " + result + " for noderef " + nodeRef);
return result; return result;
} }
public FormInstanceData getFormInstanceData(final int version, final String avmPath)
{
return this.getFormInstanceData(AVMNodeConverter.ToNodeRef(version, avmPath));
}
public FormInstanceData getFormInstanceData(final NodeRef nodeRef)
{
final String avmPath = AVMNodeConverter.ToAVMVersionPath(nodeRef).getSecond();
final WebProject webProject = new WebProject(avmPath);
return new FormInstanceDataImpl(nodeRef, this)
{
@Override
public Form getForm()
throws FormNotFoundException
{
final Form f = super.getForm();
try
{
return webProject.getForm(f.getName());
}
catch (FormNotFoundException fnfne)
{
throw new FormNotFoundException(f, webProject, this);
}
}
};
}
public Rendition getRendition(final int version, final String avmPath)
{
return this.getRendition(AVMNodeConverter.ToNodeRef(version, avmPath));
}
public Rendition getRendition(final NodeRef nodeRef)
{
return new RenditionImpl(nodeRef, this);
}
} }

View File

@@ -90,9 +90,11 @@ public class RenderingEngineTemplateImpl
private final NodeRef nodeRef; private final NodeRef nodeRef;
private final NodeRef renditionPropertiesNodeRef; private final NodeRef renditionPropertiesNodeRef;
private final FormsService formsService;
protected RenderingEngineTemplateImpl(final NodeRef nodeRef, protected RenderingEngineTemplateImpl(final NodeRef nodeRef,
final NodeRef renditionPropertiesNodeRef) final NodeRef renditionPropertiesNodeRef,
final FormsService formsService)
{ {
if (nodeRef == null) if (nodeRef == null)
{ {
@@ -102,8 +104,13 @@ public class RenderingEngineTemplateImpl
{ {
throw new NullPointerException(); throw new NullPointerException();
} }
if (formsService == null)
{
throw new NullPointerException();
}
this.nodeRef = nodeRef; this.nodeRef = nodeRef;
this.renditionPropertiesNodeRef = renditionPropertiesNodeRef; this.renditionPropertiesNodeRef = renditionPropertiesNodeRef;
this.formsService = formsService;
} }
public String getName() public String getName()
@@ -162,8 +169,7 @@ public class RenderingEngineTemplateImpl
final String renderingEngineName = (String) final String renderingEngineName = (String)
nodeService.getProperty(this.nodeRef, nodeService.getProperty(this.nodeRef,
WCMAppModel.PROP_PARENT_RENDERING_ENGINE_NAME); WCMAppModel.PROP_PARENT_RENDERING_ENGINE_NAME);
final FormsService fs = FormsService.getInstance(); return this.formsService.getRenderingEngine(renderingEngineName);
return fs.getRenderingEngine(renderingEngineName);
} }
/** /**
@@ -262,17 +268,18 @@ public class RenderingEngineTemplateImpl
AVMNodeConverter.SplitBase(renditionAvmPath)[1]); AVMNodeConverter.SplitBase(renditionAvmPath)[1]);
if (LOGGER.isDebugEnabled()) if (LOGGER.isDebugEnabled())
LOGGER.debug("Created file node for file: " + renditionAvmPath); LOGGER.debug("Created file node for file: " + renditionAvmPath);
avmService.addAspect(renditionAvmPath, WCMAppModel.ASPECT_FORM_INSTANCE_DATA);
avmService.addAspect(renditionAvmPath, ContentModel.ASPECT_TITLED);
avmService.addAspect(renditionAvmPath, WCMAppModel.ASPECT_RENDITION);
} }
final Rendition result = new RenditionImpl(AVMNodeConverter.ToNodeRef(-1, renditionAvmPath)); final Rendition result = new RenditionImpl(AVMNodeConverter.ToNodeRef(-1, renditionAvmPath),
this.formsService);
this.render(formInstanceData, result); this.render(formInstanceData, result);
if (!isRegenerate) if (!isRegenerate)
{ {
avmService.addAspect(renditionAvmPath, WCMAppModel.ASPECT_FORM_INSTANCE_DATA);
avmService.addAspect(renditionAvmPath, ContentModel.ASPECT_TITLED);
avmService.addAspect(renditionAvmPath, WCMAppModel.ASPECT_RENDITION);
final PropertyValue pv = final PropertyValue pv =
avmService.getNodeProperty(-1, formInstanceData.getPath(), WCMAppModel.PROP_RENDITIONS); avmService.getNodeProperty(-1, formInstanceData.getPath(), WCMAppModel.PROP_RENDITIONS);
final Collection<Serializable> renditions = (pv == null final Collection<Serializable> renditions = (pv == null

View File

@@ -51,27 +51,41 @@ import org.xml.sax.SAXException;
* *
* @author Ariel Backenroth * @author Ariel Backenroth
*/ */
public class RenditionImpl /* package */ class RenditionImpl
implements Rendition implements Rendition
{ {
private static final Log LOGGER = LogFactory.getLog(RenditionImpl.class); private static final Log LOGGER = LogFactory.getLog(RenditionImpl.class);
private final NodeRef nodeRef; private final NodeRef nodeRef;
private final FormsService formsService;
private transient RenderingEngineTemplate renderingEngineTemplate; private transient RenderingEngineTemplate renderingEngineTemplate;
public RenditionImpl(final NodeRef nodeRef) /* package */ RenditionImpl(final NodeRef nodeRef, final FormsService formsService)
{ {
if (nodeRef == null) if (nodeRef == null)
{ {
throw new NullPointerException(); throw new NullPointerException();
} }
if (formsService == null)
{
throw new NullPointerException();
}
final NodeService nodeService = this.getServiceRegistry().getNodeService();
if (!nodeService.hasAspect(nodeRef, WCMAppModel.ASPECT_RENDITION))
{
throw new IllegalArgumentException("node " + nodeRef +
" does not have aspect " + WCMAppModel.ASPECT_RENDITION);
}
this.nodeRef = nodeRef; this.nodeRef = nodeRef;
this.formsService = formsService;
} }
public RenditionImpl(final int version, final String avmPath) /* package */ RenditionImpl(final int version,
final String avmPath,
final FormsService formsService)
{ {
this(AVMNodeConverter.ToNodeRef(version, avmPath)); this(AVMNodeConverter.ToNodeRef(version, avmPath), formsService);
} }
/** the name of this rendition */ /** the name of this rendition */
@@ -115,7 +129,7 @@ public class RenditionImpl
{ {
throw new FileNotFoundException("unable to find primary form instance data " + path); throw new FileNotFoundException("unable to find primary form instance data " + path);
} }
return new FormInstanceDataImpl(-1, path); return this.formsService.getFormInstanceData(-1, path);
} }
/** the rendering engine template that generated this rendition */ /** the rendering engine template that generated this rendition */
@@ -159,7 +173,7 @@ public class RenditionImpl
this.getPath()); this.getPath());
return null; return null;
} }
this.renderingEngineTemplate = new RenderingEngineTemplateImpl(retNodeRef, rpNodeRef); this.renderingEngineTemplate = new RenderingEngineTemplateImpl(retNodeRef, rpNodeRef, this.formsService);
} }
return this.renderingEngineTemplate; return this.renderingEngineTemplate;
} }

View File

@@ -87,6 +87,7 @@ public class Schema2XForms
private final String action; private final String action;
private final SubmitMethod submitMethod; private final SubmitMethod submitMethod;
private final String base; private final String base;
private final Stack parentStack = new Stack();
/** /**
* generic counter -> replaced by an hashMap with: * generic counter -> replaced by an hashMap with:
@@ -1144,6 +1145,8 @@ public class Schema2XForms
final ResourceBundle resourceBundle) final ResourceBundle resourceBundle)
throws FormBuilderException throws FormBuilderException
{ {
LOGGER.debug("adding element " + elementDecl + " at path " + pathToRoot);
XSTypeDefinition controlType = elementDecl.getTypeDefinition(); XSTypeDefinition controlType = elementDecl.getTypeDefinition();
if (controlType == null) if (controlType == null)
{ {
@@ -1659,7 +1662,14 @@ public class Schema2XForms
final String path = (pathToRoot.length() == 0 final String path = (pathToRoot.length() == 0
? elementName ? elementName
: pathToRoot + "/" + elementName); : pathToRoot + "/" + elementName);
LOGGER.debug("addElement to group " + elementName + " at " + path); LOGGER.debug("addElement to group " + elementName + " at " + path + " parentStack " + this.parentStack);
if (this.parentStack.contains(element))
{
throw new FormBuilderException("recursion detected at element " + elementName);
}
LOGGER.debug("pushing element " + element + " onto parent stack");
this.parentStack.push(element);
final Element newDefaultInstanceElement = xformsDocument.createElement(elementName); final Element newDefaultInstanceElement = xformsDocument.createElement(elementName);
if (element.getConstraintType() != XSConstants.VC_NONE) if (element.getConstraintType() != XSConstants.VC_NONE)
@@ -1677,6 +1687,8 @@ public class Schema2XForms
path, path,
occurs, occurs,
resourceBundle); resourceBundle);
LOGGER.debug("popped element " + this.parentStack.pop() + " from parent stack");
// final SchemaUtil.Occurrence occurs = SchemaUtil.getOccurrence(element); // final SchemaUtil.Occurrence occurs = SchemaUtil.getOccurrence(element);
LOGGER.debug("adding " + (occurs.maximum == 1 LOGGER.debug("adding " + (occurs.maximum == 1

View File

@@ -160,6 +160,7 @@ public class Schema2XFormsTest
} }
catch (FormBuilderException fbe) catch (FormBuilderException fbe)
{ {
LOGGER.debug("got expected exception " + fbe.getMessage());
} }
} }
@@ -181,6 +182,31 @@ public class Schema2XFormsTest
// } // }
} }
public void testRecursive()
throws Exception
{
final Document schemaDocument = this.loadTestResourceDocument("xforms/unit-tests/automated/recursive-test.xsd");
Document xformsDocument = this.buildXForm(null, schemaDocument, "non-recursive-test");
try
{
xformsDocument = this.buildXForm(null, schemaDocument, "recursive-test");
fail("expected failure creating xform with recursive element definition root element recursive-test in schema " + XMLUtil.toString(schemaDocument));
}
catch (FormBuilderException fbe)
{
LOGGER.debug("got expected exception " + fbe.getMessage());
}
try
{
xformsDocument = this.buildXForm(null, schemaDocument, "nested-recursive-test");
fail("expected failure creating xform with recursive element definition root element nested-recursive-test in schema " + XMLUtil.toString(schemaDocument));
}
catch (FormBuilderException fbe)
{
LOGGER.debug("got expected exception " + fbe.getMessage());
}
}
private void assertRepeatProperties(final Document xformsDocument, final String nodeset, final SchemaUtil.Occurrence o) private void assertRepeatProperties(final Document xformsDocument, final String nodeset, final SchemaUtil.Occurrence o)
{ {
final Element[] bindElements = this.resolveBind(xformsDocument, nodeset); final Element[] bindElements = this.resolveBind(xformsDocument, nodeset);

View File

@@ -0,0 +1,82 @@
<?xml version="1.0"?>
<xs:schema xmlns:xs="http://www.w3.org/2001/XMLSchema"
xmlns:alf="http://www.alfresco.org"
elementFormDefault="qualified" >
<xs:complexType name="thing">
<xs:sequence>
<xs:element name="string" type="xs:normalizedString" />
<xs:element name="sub-thing" type="thing" minOccurs="0" maxOccurs="1" />
</xs:sequence>
</xs:complexType>
<xs:complexType name="nested-recursive-thing">
<xs:sequence>
<xs:element name="string" type="xs:normalizedString"/>
<xs:element name="nested-complex-type">
<xs:complexType>
<xs:sequence>
<xs:element name="nested-nested-recursive-thing" type="nested-nested-recursive-thing"/>
</xs:sequence>
</xs:complexType>
</xs:element>
</xs:sequence>
</xs:complexType>
<xs:complexType name="nested-nested-recursive-thing">
<xs:sequence>
<xs:element name="string" type="xs:normalizedString"/>
<xs:element name="nested-recursive-thing" type="nested-recursive-thing"/>
</xs:sequence>
</xs:complexType>
<xs:element name="recursive-test">
<xs:complexType>
<xs:sequence>
<xs:element name="recursive-thing" type="thing" minOccurs="1" maxOccurs="1"/>
</xs:sequence>
</xs:complexType>
</xs:element>
<xs:element name="nested-recursive-test">
<xs:complexType>
<xs:sequence>
<xs:element name="nested-recursive-thing" type="nested-recursive-thing" minOccurs="1" maxOccurs="1"/>
</xs:sequence>
</xs:complexType>
</xs:element>
<xs:element name="non-recursive-test">
<xs:complexType>
<xs:sequence>
<xs:element name="non-recursive-thing" minOccurs="1" maxOccurs="1">
<xs:complexType>
<xs:sequence>
<xs:element name="string" type="xs:normalizedString"/>
<xs:element name="non-recursive-sub-thing" minOccurs="0" maxOccurs="1">
<xs:complexType>
<xs:sequence>
<xs:element name="string" type="xs:normalizedString"/>
<xs:element name="non-recursive-sub-thing" minOccurs="0" maxOccurs="1">
<xs:complexType>
<xs:sequence>
<xs:element name="string" type="xs:normalizedString"/>
<xs:element name="non-recursive-sub-thing" minOccurs="0" maxOccurs="1">
<xs:complexType>
<xs:sequence>
<xs:element name="string" type="xs:normalizedString"/>
</xs:sequence>
</xs:complexType>
</xs:element>
</xs:sequence>
</xs:complexType>
</xs:element>
</xs:sequence>
</xs:complexType>
</xs:element>
</xs:sequence>
</xs:complexType>
</xs:element>
</xs:sequence>
</xs:complexType>
</xs:element>
</xs:schema>

View File

@@ -2492,6 +2492,10 @@
<property-name>workflowService</property-name> <property-name>workflowService</property-name>
<value>#{WorkflowService}</value> <value>#{WorkflowService}</value>
</managed-property> </managed-property>
<managed-property>
<property-name>formsService</property-name>
<value>#{FormsService}</value>
</managed-property>
</managed-bean> </managed-bean>
<managed-bean> <managed-bean>
@@ -2537,6 +2541,10 @@
<property-name>workflowService</property-name> <property-name>workflowService</property-name>
<value>#{WorkflowService}</value> <value>#{WorkflowService}</value>
</managed-property> </managed-property>
<managed-property>
<property-name>formsService</property-name>
<value>#{FormsService}</value>
</managed-property>
</managed-bean> </managed-bean>
<managed-bean> <managed-bean>
@@ -2582,6 +2590,10 @@
<property-name>avmSyncService</property-name> <property-name>avmSyncService</property-name>
<value>#{AVMSyncService}</value> <value>#{AVMSyncService}</value>
</managed-property> </managed-property>
<managed-property>
<property-name>formsService</property-name>
<value>#{FormsService}</value>
</managed-property>
</managed-bean> </managed-bean>
<managed-bean> <managed-bean>
@@ -2619,10 +2631,6 @@
<property-name>dictionaryService</property-name> <property-name>dictionaryService</property-name>
<value>#{DictionaryService}</value> <value>#{DictionaryService}</value>
</managed-property> </managed-property>
<managed-property>
<property-name>workflowService</property-name>
<value>#{WorkflowService}</value>
</managed-property>
<managed-property> <managed-property>
<property-name>avmService</property-name> <property-name>avmService</property-name>
<value>#{AVMLockingAwareService}</value> <value>#{AVMLockingAwareService}</value>
@@ -2643,6 +2651,10 @@
<property-name>filePickerBean</property-name> <property-name>filePickerBean</property-name>
<value>#{FilePickerBean}</value> <value>#{FilePickerBean}</value>
</managed-property> </managed-property>
<managed-property>
<property-name>formsService</property-name>
<value>#{FormsService}</value>
</managed-property>
</managed-bean> </managed-bean>
<managed-bean> <managed-bean>
@@ -2680,10 +2692,6 @@
<property-name>dictionaryService</property-name> <property-name>dictionaryService</property-name>
<value>#{DictionaryService}</value> <value>#{DictionaryService}</value>
</managed-property> </managed-property>
<managed-property>
<property-name>workflowService</property-name>
<value>#{WorkflowService}</value>
</managed-property>
<managed-property> <managed-property>
<property-name>avmService</property-name> <property-name>avmService</property-name>
<value>#{AVMLockingAwareService}</value> <value>#{AVMLockingAwareService}</value>
@@ -2704,6 +2712,10 @@
<property-name>filePickerBean</property-name> <property-name>filePickerBean</property-name>
<value>#{FilePickerBean}</value> <value>#{FilePickerBean}</value>
</managed-property> </managed-property>
<managed-property>
<property-name>formsService</property-name>
<value>#{FormsService}</value>
</managed-property>
</managed-bean> </managed-bean>
<managed-bean> <managed-bean>
@@ -2745,6 +2757,10 @@
<property-name>avmLockingService</property-name> <property-name>avmLockingService</property-name>
<value>#{AVMLockingService}</value> <value>#{AVMLockingService}</value>
</managed-property> </managed-property>
<managed-property>
<property-name>formsService</property-name>
<value>#{FormsService}</value>
</managed-property>
</managed-bean> </managed-bean>
<managed-bean> <managed-bean>
@@ -2786,6 +2802,10 @@
<property-name>personService</property-name> <property-name>personService</property-name>
<value>#{PersonService}</value> <value>#{PersonService}</value>
</managed-property> </managed-property>
<managed-property>
<property-name>formsService</property-name>
<value>#{FormsService}</value>
</managed-property>
</managed-bean> </managed-bean>
<managed-bean> <managed-bean>
@@ -2897,6 +2917,10 @@
<property-name>workflowService</property-name> <property-name>workflowService</property-name>
<value>#{WorkflowService}</value> <value>#{WorkflowService}</value>
</managed-property> </managed-property>
<managed-property>
<property-name>formsService</property-name>
<value>#{FormsService}</value>
</managed-property>
</managed-bean> </managed-bean>
<managed-bean> <managed-bean>
@@ -2911,8 +2935,25 @@
<value>#{AVMLockingAwareService}</value> <value>#{AVMLockingAwareService}</value>
</managed-property> </managed-property>
<managed-property> <managed-property>
<property-name>avmSyncService</property-name> <property-name>avmBrowseBean</property-name>
<value>#{AVMSyncService}</value> <value>#{AVMBrowseBean}</value>
</managed-property>
<managed-property>
<property-name>formsService</property-name>
<value>#{FormsService}</value>
</managed-property>
</managed-bean>
<managed-bean>
<description>
The bean that backs up the AVM file editing screens
</description>
<managed-bean-name>EditAvmFileDialog</managed-bean-name>
<managed-bean-class>org.alfresco.web.bean.wcm.EditAvmFileDialog</managed-bean-class>
<managed-bean-scope>session</managed-bean-scope>
<managed-property>
<property-name>avmService</property-name>
<value>#{AVMLockingAwareService}</value>
</managed-property> </managed-property>
<managed-property> <managed-property>
<property-name>avmBrowseBean</property-name> <property-name>avmBrowseBean</property-name>
@@ -2920,6 +2961,27 @@
</managed-property> </managed-property>
</managed-bean> </managed-bean>
<managed-bean>
<description>
The bean that backs up the dialog for associating form instance data with a form
</description>
<managed-bean-name>PromptForWebFormDialog</managed-bean-name>
<managed-bean-class>org.alfresco.web.bean.wcm.PromptForWebFormDialog</managed-bean-class>
<managed-bean-scope>session</managed-bean-scope>
<managed-property>
<property-name>avmService</property-name>
<value>#{AVMLockingAwareService}</value>
</managed-property>
<managed-property>
<property-name>avmBrowseBean</property-name>
<value>#{AVMBrowseBean}</value>
</managed-property>
<managed-property>
<property-name>formsService</property-name>
<value>#{FormsService}</value>
</managed-property>
</managed-bean>
<managed-bean> <managed-bean>
<description> <description>
The bean that backs up the Snapshot Sandbox Dialog The bean that backs up the Snapshot Sandbox Dialog
@@ -2952,6 +3014,10 @@
<property-name>avmBrowseBean</property-name> <property-name>avmBrowseBean</property-name>
<value>#{AVMBrowseBean}</value> <value>#{AVMBrowseBean}</value>
</managed-property> </managed-property>
<managed-property>
<property-name>formsService</property-name>
<value>#{FormsService}</value>
</managed-property>
</managed-bean> </managed-bean>
<managed-bean> <managed-bean>
@@ -3383,6 +3449,10 @@
<property-name>nameMatcher</property-name> <property-name>nameMatcher</property-name>
<value>#{globalPathExcluder}</value> <value>#{globalPathExcluder}</value>
</managed-property> </managed-property>
<managed-property>
<property-name>formsService</property-name>
<value>#{FormsService}</value>
</managed-property>
</managed-bean> </managed-bean>
<managed-bean> <managed-bean>

View File

@@ -904,14 +904,17 @@
<from-outcome>addAvmContent</from-outcome> <from-outcome>addAvmContent</from-outcome>
<to-view-id>/jsp/wcm/add-content-dialog.jsp</to-view-id> <to-view-id>/jsp/wcm/add-content-dialog.jsp</to-view-id>
</navigation-case> </navigation-case>
<!--
<navigation-case> <navigation-case>
<from-outcome>editAvmFile</from-outcome> <from-outcome>editAvmFile</from-outcome>
<to-view-id>/jsp/wcm/edit-file.jsp</to-view-id> <to-view-id>/jsp/wcm/edit-file.jsp</to-view-id>
</navigation-case> </navigation-case>
-->
<navigation-case> <navigation-case>
<from-outcome>updateAvmFile</from-outcome> <from-outcome>updateAvmFile</from-outcome>
<to-view-id>/jsp/wcm/update-file.jsp</to-view-id> <to-view-id>/jsp/wcm/update-file.jsp</to-view-id>
</navigation-case> </navigation-case>
<navigation-case> <navigation-case>
<from-outcome>showFileDetails</from-outcome> <from-outcome>showFileDetails</from-outcome>
<to-view-id>/jsp/wcm/file-details.jsp</to-view-id> <to-view-id>/jsp/wcm/file-details.jsp</to-view-id>

View File

@@ -20,7 +20,7 @@
* and Open Source Software ("FLOSS") applications as described in Alfresco's * and Open Source Software ("FLOSS") applications as described in Alfresco's
* FLOSS exception. You should have recieved a copy of the text describing * FLOSS exception. You should have recieved a copy of the text describing
* the FLOSS exception, and it is also available here: * the FLOSS exception, and it is also available here:
* http://www.alfresco.com/legal/licensing" * http://www.alfresco.com/legal/licensing
--%> --%>
<%@ taglib uri="http://java.sun.com/jsf/html" prefix="h" %> <%@ taglib uri="http://java.sun.com/jsf/html" prefix="h" %>
<%@ taglib uri="http://java.sun.com/jsf/core" prefix="f" %> <%@ taglib uri="http://java.sun.com/jsf/core" prefix="f" %>
@@ -30,143 +30,24 @@
<%@ page buffer="32kb" contentType="text/html;charset=UTF-8" %> <%@ page buffer="32kb" contentType="text/html;charset=UTF-8" %>
<%@ page isELIgnored="false" %> <%@ page isELIgnored="false" %>
<%@ page import="org.alfresco.web.ui.common.PanelGenerator" %>
<r:page titleId="title_edit_file"> <h:panelGrid columns="1" cellpadding="2" style="padding-top:4px;padding-bottom:4px;"
width="100%" rowClasses="mainSubText">
<f:view>
<%-- load a bundle of properties with I18N strings --%>
<f:loadBundle basename="alfresco.messages.webclient" var="msg"/>
<%-- set the form name here --%>
<h:form acceptcharset="UTF-8" id="edit-file">
<%-- Main outer table --%>
<table cellspacing="0" cellpadding="2">
<%-- Title bar --%>
<tr>
<td colspan="2">
<%@ include file="../parts/titlebar.jsp" %>
</td>
</tr>
<%-- Main area --%>
<tr valign="top">
<%-- Shelf --%>
<td>
<%@ include file="../parts/shelf.jsp" %>
</td>
<%-- Work Area --%>
<td width="100%">
<table cellspacing="0" cellpadding="0" width="100%">
<%-- Breadcrumb --%>
<%@ include file="../parts/breadcrumb.jsp" %>
<%-- Status and Actions --%>
<tr>
<td style="background-image: url(<%=request.getContextPath()%>/images/parts/statuspanel_4.gif)" width="4"></td>
<td bgcolor="#dfe6ed">
<%-- Status and Actions inner contents table --%>
<%-- Generally this consists of an icon, textual summary and actions for the current object --%>
<table cellspacing="4" cellpadding="0" width="100%">
<tr>
<td width="26">
<h:graphicImage id="wizard-logo" url="/images/icons/edit_large.gif" />
</td>
<td>
<div class="mainTitle">'<h:outputText value="#{AVMEditBean.avmNode.name}" />'</div>
<div class="mainSubText"><h:outputText value="#{msg.editfile_description}" /></div>
</td>
</tr>
</table>
</td>
<td style="background-image: url(<%=request.getContextPath()%>/images/parts/statuspanel_6.gif)" width="4"></td>
</tr>
<%-- separator row with gradient shadow --%>
<tr>
<td><img src="<%=request.getContextPath()%>/images/parts/statuspanel_7.gif" width="4" height="9"></td>
<td style="background-image: url(<%=request.getContextPath()%>/images/parts/statuspanel_8.gif)"></td>
<td><img src="<%=request.getContextPath()%>/images/parts/statuspanel_9.gif" width="4" height="9"></td>
</tr>
<%-- Details --%>
<tr valign=top>
<td style="background-image: url(<%=request.getContextPath()%>/images/parts/whitepanel_4.gif)" width="4"></td>
<td>
<table cellspacing="0" cellpadding="3" border="0" width="100%">
<tr>
<td width="100%" valign="top">
<% PanelGenerator.generatePanelStart(out, request.getContextPath(), "white", "white"); %>
<table cellpadding="2" cellspacing="2" border="0" width="100%">
<tr>
<td class="mainSubText">
<h:outputFormat value="#{msg.edit_file_prompt}"> <h:outputFormat value="#{msg.edit_file_prompt}">
<f:param value="#{AVMEditBean.avmNode.name}" /> <f:param value="#{DialogManager.bean.avmNode.name}" />
</h:outputFormat> </h:outputFormat>
</td> </h:panelGrid>
</tr> <h:panelGrid columns="1" cellpadding="2" style="padding:10px; vertical-align: middle"
<tr> width="100%">
<td style="padding:10px" valign="middle">
<%-- downloadable file link --%> <%-- downloadable file link --%>
<a:actionLink styleClass="title" image="#{AVMEditBean.fileType32}" value="#{AVMEditBean.avmNode.name}" href="#{AVMEditBean.url}" /> <a:actionLink styleClass="title"
</td> image="#{DialogManager.bean.fileType32}"
</tr> value="#{DialogManager.bean.avmNode.name}"
<tr> href="#{DialogManager.bean.url}" />
<td> </h:panelGrid>
<h:panelGrid columns="1" cellpadding="2" style="padding-top:4px;padding-bottom:4px;"
width="100%" rowClasses="mainSubText">
<h:outputText value="#{msg.edit_download_complete}" /> <h:outputText value="#{msg.edit_download_complete}" />
</td>
</tr>
</table>
<% PanelGenerator.generatePanelEnd(out, request.getContextPath(), "white"); %>
</td>
<td valign="top"> <a:actionLink value="#{msg.edit_using_web_form}" showLink="true" action="dialog:close:dialog:promptForWebForm"/>
<% PanelGenerator.generatePanelStart(out, request.getContextPath(), "greyround", "#F5F5F5"); %> </h:panelGrid>
<table cellpadding="1" cellspacing="1" border="0">
<tr>
<td align="center">
<h:commandButton value="#{msg.close}" action="#{AVMEditBean.editFileOK}" styleClass="dialogControls" />
</td>
</tr>
</table>
<% PanelGenerator.generatePanelEnd(out, request.getContextPath(), "greyround"); %>
</td>
</tr>
</table>
</td>
<td style="background-image: url(<%=request.getContextPath()%>/images/parts/whitepanel_6.gif)" width="4"></td>
</tr>
<%-- Error Messages --%>
<tr valign="top">
<td style="background-image: url(<%=request.getContextPath()%>/images/parts/whitepanel_4.gif)" width="4"></td>
<td>
<%-- messages tag to show messages not handled by other specific message tags --%>
<h:messages globalOnly="true" styleClass="errorMessage" layout="table" />
</td>
<td style="background-image: url(<%=request.getContextPath()%>/images/parts/whitepanel_6.gif)" width="4"></td>
</tr>
<%-- separator row with bottom panel graphics --%>
<tr>
<td><img src="<%=request.getContextPath()%>/images/parts/whitepanel_7.gif" width="4" height="4"></td>
<td width="100%" align="center" style="background-image: url(<%=request.getContextPath()%>/images/parts/whitepanel_8.gif)"></td>
<td><img src="<%=request.getContextPath()%>/images/parts/whitepanel_9.gif" width="4" height="4"></td>
</tr>
</table>
</td>
</tr>
</table>
</h:form>
</f:view>
</r:page>

View File

@@ -1,46 +0,0 @@
<%--
* 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/core" prefix="f" %>
<%@ taglib uri="/WEB-INF/wcm.tld" prefix="wcm" %>
<f:verbatim>
<script type="text/javascript">
function _xforms_getSubmitButtons()
{
return [ document.getElementById("dialog:finish-button") ];
}
function _xforms_getSaveDraftButtons()
{
return [];
}
</script>
</f:verbatim>
<wcm:formProcessor id="form-data-renderer"
formProcessorSession="#{AVMEditBean.formProcessorSession}"
formInstanceData="#{AVMEditBean.instanceDataDocument}"
formInstanceDataName="#{AVMEditBean.formInstanceDataName}"
form="#{AVMEditBean.form}"/>

View File

@@ -0,0 +1,57 @@
<%--
* 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="http://java.sun.com/jsp/jstl/core" prefix="c" %>
<%@ taglib uri="/WEB-INF/alfresco.tld" prefix="a" %>
<%@ taglib uri="/WEB-INF/repo.tld" prefix="r" %>
<%@ page buffer="32kb" contentType="text/html;charset=UTF-8" %>
<%@ page isELIgnored="false" %>
<h:panelGrid columns="1" cellpadding="2" style="padding-top:4px;padding-bottom:4px;"
width="100%" rowClasses="mainSubText">
<h:outputFormat value="#{msg.prompt_for_web_form_explanation}">
<f:param value="#{DialogManager.bean.avmNode.name}"/>
</h:outputFormat>
</h:panelGrid>
<h:panelGrid columns="3" cellpadding="3" cellspacing="3" border="0">
<h:graphicImage value="/images/icons/required_field.gif" alt="#{msg.required_field}" />
<h:outputText value="#{msg.form}:"/>
<h:selectOneMenu value="#{DialogManager.bean.formName}"
rendered="#{!empty DialogManager.bean.formChoices}">
<f:selectItems value="#{DialogManager.bean.formChoices}" />
</h:selectOneMenu>
<h:outputText value="#{msg.sandbox_no_web_forms}"
style="font-style: italic"
rendered="#{empty DialogManager.bean.formChoices}"/>
</h:panelGrid>
<h:panelGrid columns="1" cellpadding="2" style="padding-top:4px;padding-bottom:4px;"
width="100%" rowClasses="mainSubText">
<h:outputFormat value="#{msg.prompt_for_web_form_continue_msg}">
<f:param value="#{DialogManager.bean.avmNode.name}"/>
</h:outputFormat>
</h:panelGrid>