mirror of
https://github.com/Alfresco/alfresco-community-repo.git
synced 2025-08-07 17:49:17 +00:00
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:
@@ -24,6 +24,7 @@
|
||||
*/
|
||||
package org.alfresco.web.bean.wcm;
|
||||
|
||||
import java.io.FileNotFoundException;
|
||||
import java.io.Serializable;
|
||||
import java.text.MessageFormat;
|
||||
import java.util.ArrayList;
|
||||
@@ -148,7 +149,7 @@ public class AVMBrowseBean implements IContextListener
|
||||
private List<String> deploymentMonitorIds = new ArrayList<String>();
|
||||
|
||||
/** 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 */
|
||||
private HrefValidationProgress linkValidationMonitor;
|
||||
@@ -194,6 +195,9 @@ public class AVMBrowseBean implements IContextListener
|
||||
|
||||
/** Action service bean reference */
|
||||
protected ActionService actionService;
|
||||
|
||||
/** The FormsService reference */
|
||||
protected FormsService formsService;
|
||||
|
||||
/**
|
||||
* Default Constructor
|
||||
@@ -266,6 +270,14 @@ public class AVMBrowseBean implements IContextListener
|
||||
this.actionService = actionService;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param formsService The FormsService to set.
|
||||
*/
|
||||
public void setFormsService(final FormsService formsService)
|
||||
{
|
||||
this.formsService = formsService;
|
||||
}
|
||||
|
||||
/**
|
||||
* Summary text for the staging store:
|
||||
* 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
|
||||
*/
|
||||
@@ -1049,11 +1137,11 @@ public class AVMBrowseBean implements IContextListener
|
||||
FormInstanceData fid = null;
|
||||
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))
|
||||
{
|
||||
fid = new FormInstanceDataImpl(-1, path);
|
||||
fid = this.formsService.getFormInstanceData(-1, path);
|
||||
}
|
||||
List<Pair<Integer, String>> versionPaths = new ArrayList<Pair<Integer, String>>();
|
||||
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
|
||||
*/
|
||||
public void createFormContent(ActionEvent event)
|
||||
public void createFormContent(final ActionEvent event)
|
||||
{
|
||||
// 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()
|
||||
FacesContext fc = FacesContext.getCurrentInstance();
|
||||
WizardManager manager = (WizardManager)FacesHelper.getManagedBean(fc, WizardManager.BEAN_NAME);
|
||||
manager.setupParameters(event);
|
||||
Application.getWizardManager().setupParameters(event);
|
||||
final FacesContext fc = FacesContext.getCurrentInstance();
|
||||
fc.getApplication().getNavigationHandler().handleNavigation(fc, null, "wizard:createWebContent");
|
||||
}
|
||||
|
||||
|
@@ -45,12 +45,11 @@ import org.alfresco.web.bean.FileUploadBean;
|
||||
import org.alfresco.web.bean.repository.Repository;
|
||||
import org.alfresco.web.forms.Form;
|
||||
import org.alfresco.web.forms.FormInstanceData;
|
||||
import org.alfresco.web.forms.FormInstanceDataImpl;
|
||||
import org.alfresco.web.forms.FormNotFoundException;
|
||||
import org.alfresco.web.forms.FormProcessor;
|
||||
import org.alfresco.web.forms.FormsService;
|
||||
import org.alfresco.web.forms.RenderingEngineTemplate;
|
||||
import org.alfresco.web.forms.Rendition;
|
||||
import org.alfresco.web.forms.RenditionImpl;
|
||||
import org.alfresco.web.forms.XMLUtil;
|
||||
import org.alfresco.web.ui.common.Utils;
|
||||
import org.alfresco.web.ui.common.component.UIActionLink;
|
||||
@@ -66,28 +65,17 @@ import org.w3c.dom.Document;
|
||||
*/
|
||||
public class AVMEditBean
|
||||
{
|
||||
public static final String BEAN_NAME = "AVMEditBean";
|
||||
|
||||
private static final Log LOGGER = LogFactory.getLog(AVMEditBean.class);
|
||||
|
||||
private static final String MSG_ERROR_UPDATE = "error_update";
|
||||
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 String fileName = null;
|
||||
|
||||
/** AVM service bean reference */
|
||||
protected AVMService avmService;
|
||||
|
||||
/** AVM sync service bean reference */
|
||||
protected AVMSyncService avmSyncService;
|
||||
|
||||
/** AVM Browse Bean reference */
|
||||
protected AVMBrowseBean avmBrowseBean;
|
||||
protected FormsService formsService;
|
||||
|
||||
// ------------------------------------------------------------------------------
|
||||
// Bean property getters and setters
|
||||
@@ -100,14 +88,6 @@ public class AVMEditBean
|
||||
this.avmService = avmService;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param avmSyncService The AVMSyncService to set.
|
||||
*/
|
||||
public void setAvmSyncService(final AVMSyncService avmSyncService)
|
||||
{
|
||||
this.avmSyncService = avmSyncService;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param avmBrowseBean The AVMBrowseBean to set.
|
||||
*/
|
||||
@@ -116,6 +96,14 @@ public class AVMEditBean
|
||||
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.
|
||||
*/
|
||||
@@ -140,47 +128,6 @@ public class AVMEditBean
|
||||
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
|
||||
*/
|
||||
@@ -212,113 +159,6 @@ public class AVMEditBean
|
||||
// ------------------------------------------------------------------------------
|
||||
// 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
|
||||
*/
|
||||
@@ -386,8 +226,6 @@ public class AVMEditBean
|
||||
{
|
||||
// clean up and clear action context
|
||||
clearUpload();
|
||||
setDocumentContent(null);
|
||||
setEditorOutput(null);
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -413,24 +251,7 @@ public class AVMEditBean
|
||||
throws FormNotFoundException
|
||||
{
|
||||
final String avmPath = this.getAvmNode().getPath();
|
||||
final FormInstanceData fid = new FormInstanceDataImpl(-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 FormInstanceData fid = this.formsService.getFormInstanceData(-1, avmPath);
|
||||
final List<FormInstanceData.RegenerateResult> result = fid.regenerateRenditions();
|
||||
for (FormInstanceData.RegenerateResult rr : result)
|
||||
{
|
||||
|
@@ -32,6 +32,7 @@ import java.io.ObjectOutputStream;
|
||||
import java.io.Serializable;
|
||||
import java.util.ArrayList;
|
||||
import java.util.Collections;
|
||||
import java.util.HashSet;
|
||||
import java.util.List;
|
||||
import java.util.StringTokenizer;
|
||||
|
||||
@@ -91,13 +92,29 @@ public class AVMWorkflowUtil extends WorkflowUtil
|
||||
final WorkflowService workflowService,
|
||||
final NodeService nodeService)
|
||||
{
|
||||
|
||||
// create package paths (layered to user sandbox area as target)
|
||||
final String workflowMainStoreName = sandboxInfo.getMainStoreName();
|
||||
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());
|
||||
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,
|
||||
-1, AVMUtil.getCorrespondingPath(srcPath, workflowMainStoreName),
|
||||
AVMDifference.NEWER));
|
||||
@@ -118,7 +135,6 @@ public class AVMWorkflowUtil extends WorkflowUtil
|
||||
final ServiceRegistry services = Repository.getServiceRegistry(FacesContext.getCurrentInstance());
|
||||
final PermissionService permissionService = services.getPermissionService();
|
||||
permissionService.setPermission(packageNodeRef, PermissionService.ALL_AUTHORITIES, PermissionService.ALL_PERMISSIONS, true);
|
||||
|
||||
return packageNodeRef;
|
||||
}
|
||||
|
||||
|
@@ -203,6 +203,7 @@ public class CreateFormWizard
|
||||
protected ContentService contentService;
|
||||
protected MimetypeService mimetypeService;
|
||||
protected WorkflowService workflowService;
|
||||
protected FormsService formsService;
|
||||
|
||||
private String schemaRootElementName = null;
|
||||
private String formName = null;
|
||||
@@ -234,7 +235,7 @@ public class CreateFormWizard
|
||||
LOGGER.debug("creating form " + this.getFormName());
|
||||
|
||||
// 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 =
|
||||
this.fileFolderService.create(contentFormsNodeRef,
|
||||
@@ -518,7 +519,12 @@ public class CreateFormWizard
|
||||
final String name = this.getRenderingEngineTemplateName();
|
||||
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;
|
||||
}
|
||||
final String opp = this.getOutputPathPatternForRendition();
|
||||
@@ -712,9 +718,8 @@ public class CreateFormWizard
|
||||
if (this.renderingEngine == null &&
|
||||
this.getRenderingEngineTemplateFileName() != null)
|
||||
{
|
||||
final FormsService fs = FormsService.getInstance();
|
||||
this.renderingEngine =
|
||||
fs.guessRenderingEngine(this.getRenderingEngineTemplateFileName());
|
||||
this.formsService.guessRenderingEngine(this.getRenderingEngineTemplateFileName());
|
||||
}
|
||||
return (this.renderingEngine == null
|
||||
? null
|
||||
@@ -726,10 +731,9 @@ public class CreateFormWizard
|
||||
*/
|
||||
public void setRenderingEngineName(final String renderingEngineName)
|
||||
{
|
||||
final FormsService fs = FormsService.getInstance();
|
||||
this.renderingEngine = (renderingEngineName == null
|
||||
? null
|
||||
: fs.getRenderingEngine(renderingEngineName));
|
||||
: this.formsService.getRenderingEngine(renderingEngineName));
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -737,9 +741,8 @@ public class CreateFormWizard
|
||||
*/
|
||||
public List<SelectItem> getRenderingEngineChoices()
|
||||
{
|
||||
final FormsService fs = FormsService.getInstance();
|
||||
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()));
|
||||
}
|
||||
@@ -1097,6 +1100,14 @@ public class CreateFormWizard
|
||||
{
|
||||
this.workflowService = workflowService;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param formsService The FormsService to set.
|
||||
*/
|
||||
public void setFormsService(final FormsService formsService)
|
||||
{
|
||||
this.formsService = formsService;
|
||||
}
|
||||
|
||||
// ------------------------------------------------------------------------------
|
||||
// Helper Methods
|
||||
|
@@ -64,6 +64,7 @@ import org.alfresco.service.cmr.workflow.WorkflowTask;
|
||||
import org.alfresco.service.cmr.workflow.WorkflowTaskState;
|
||||
import org.alfresco.service.namespace.QName;
|
||||
import org.alfresco.service.namespace.RegexQNamePattern;
|
||||
import org.alfresco.web.app.AlfrescoNavigationHandler;
|
||||
import org.alfresco.web.app.Application;
|
||||
import org.alfresco.web.bean.content.BaseContentWizard;
|
||||
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.forms.Form;
|
||||
import org.alfresco.web.forms.FormInstanceData;
|
||||
import org.alfresco.web.forms.FormInstanceDataImpl;
|
||||
import org.alfresco.web.forms.FormNotFoundException;
|
||||
import org.alfresco.web.forms.FormProcessor;
|
||||
import org.alfresco.web.forms.FormsService;
|
||||
@@ -106,24 +106,13 @@ public class CreateWebContentWizard extends BaseContentWizard
|
||||
protected boolean formSelectDisabled = false;
|
||||
protected boolean startWorkflow = false;
|
||||
|
||||
/** AVM service bean reference */
|
||||
protected AVMService avmService;
|
||||
|
||||
/** AVM sync service bean reference */
|
||||
protected AVMSyncService avmSyncService;
|
||||
|
||||
/** AVM Browse Bean reference */
|
||||
protected AVMBrowseBean avmBrowseBean;
|
||||
|
||||
/** AVM Submitted Aspect reference */
|
||||
protected AVMSubmittedAspect avmSubmittedAspect;
|
||||
|
||||
/** Workflow service bean reference */
|
||||
protected WorkflowService workflowService;
|
||||
|
||||
/** The FilePickerBean reference */
|
||||
protected FilePickerBean filePickerBean;
|
||||
|
||||
protected FormsService formsService;
|
||||
|
||||
/**
|
||||
* @param avmService The AVMService to set.
|
||||
*/
|
||||
@@ -148,15 +137,6 @@ public class CreateWebContentWizard extends BaseContentWizard
|
||||
this.avmSubmittedAspect = avmSubmittedAspect;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param workflowService The WorkflowService to set.
|
||||
*/
|
||||
public void setWorkflowService(WorkflowService workflowService)
|
||||
{
|
||||
this.workflowService = workflowService;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* @param avmBrowseBean The AVMBrowseBean to set.
|
||||
*/
|
||||
@@ -172,8 +152,15 @@ public class CreateWebContentWizard extends BaseContentWizard
|
||||
{
|
||||
this.filePickerBean = filePickerBean;
|
||||
}
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* @param formsService The FormsService to set.
|
||||
*/
|
||||
public void setFormsService(final FormsService formsService)
|
||||
{
|
||||
this.formsService = formsService;
|
||||
}
|
||||
|
||||
// ------------------------------------------------------------------------------
|
||||
// Wizard implementation
|
||||
|
||||
@@ -295,7 +282,7 @@ public class CreateWebContentWizard extends BaseContentWizard
|
||||
}
|
||||
|
||||
@Override
|
||||
protected String finishImpl(final FacesContext context, final String outcome)
|
||||
protected String finishImpl(final FacesContext context, String outcome)
|
||||
throws Exception
|
||||
{
|
||||
final NodeRef[] uploadedFiles = this.filePickerBean.getUploadedFiles();
|
||||
@@ -331,105 +318,23 @@ public class CreateWebContentWizard extends BaseContentWizard
|
||||
|
||||
if (this.startWorkflow)
|
||||
{
|
||||
final WorkflowDefinition wd = this.getForm().getDefaultWorkflow();
|
||||
if (wd == null)
|
||||
final List<AVMNodeDescriptor> submitNodes =
|
||||
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"));
|
||||
}
|
||||
|
||||
final Map<QName, Serializable> parameters = this.getForm().getDefaultWorkflowParameters();
|
||||
|
||||
if (LOGGER.isDebugEnabled())
|
||||
LOGGER.debug("starting workflow " + wd + " with parameters " + parameters);
|
||||
|
||||
if (parameters == null)
|
||||
{
|
||||
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);
|
||||
}
|
||||
}
|
||||
submitNodes.add(this.avmService.lookup(-1, d.getDestinationPath()));
|
||||
}
|
||||
this.avmBrowseBean.setNodesForSubmit(submitNodes);
|
||||
final Map<String, String> dialogParams = new HashMap<String, String>(1);
|
||||
dialogParams.put(SubmitDialog.PARAM_LOAD_SELECTED_NODES_FROM_BROWSE_BEAN,
|
||||
Boolean.TRUE.toString());
|
||||
Application.getDialogManager().setupParameters(dialogParams);
|
||||
outcome = (outcome +
|
||||
AlfrescoNavigationHandler.OUTCOME_SEPARATOR +
|
||||
AlfrescoNavigationHandler.DIALOG_PREFIX + "submitSandboxItems");
|
||||
}
|
||||
|
||||
if (this.formProcessorSession != null)
|
||||
{
|
||||
this.formProcessorSession.destroy();
|
||||
@@ -450,7 +355,7 @@ public class CreateWebContentWizard extends BaseContentWizard
|
||||
|
||||
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();
|
||||
if (LOGGER.isDebugEnabled())
|
||||
LOGGER.debug("reset form instance data " + this.formInstanceData.getName() +
|
||||
@@ -536,16 +441,12 @@ public class CreateWebContentWizard extends BaseContentWizard
|
||||
|
||||
if (form != null)
|
||||
{
|
||||
this.formInstanceData = new FormInstanceDataImpl(formInstanceDataNodeRef)
|
||||
{
|
||||
@Override
|
||||
public Form getForm() { return form; }
|
||||
};
|
||||
props.clear();
|
||||
props.put(WCMAppModel.PROP_PARENT_FORM_NAME, form.getName());
|
||||
props.put(WCMAppModel.PROP_ORIGINAL_PARENT_PATH, cwd);
|
||||
this.nodeService.addAspect(formInstanceDataNodeRef, WCMAppModel.ASPECT_FORM_INSTANCE_DATA, props);
|
||||
|
||||
this.formInstanceData = this.formsService.getFormInstanceData(formInstanceDataNodeRef);
|
||||
this.renditions = new LinkedList<Rendition>();
|
||||
for (RenderingEngineTemplate ret : form.getRenderingEngineTemplates())
|
||||
{
|
||||
@@ -674,6 +575,9 @@ public class CreateWebContentWizard extends BaseContentWizard
|
||||
return this.createMimeTypes;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return the current seleted form's name or <tt>null</tt>.
|
||||
*/
|
||||
public String getFormName()
|
||||
{
|
||||
return this.formName;
|
||||
|
@@ -86,7 +86,7 @@ public class CreateWebsiteWizard extends BaseWizardBean
|
||||
|
||||
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 String dnsName;
|
||||
@@ -101,6 +101,7 @@ public class CreateWebsiteWizard extends BaseWizardBean
|
||||
protected WorkflowService workflowService;
|
||||
protected PersonService personService;
|
||||
protected AVMLockingService avmLockingService;
|
||||
protected FormsService formsService;
|
||||
|
||||
/** datamodel for table of selected forms */
|
||||
protected DataModel formsDataModel = null;
|
||||
@@ -170,8 +171,8 @@ public class CreateWebsiteWizard extends BaseWizardBean
|
||||
WCMAppModel.TYPE_AVMWEBFOLDER);
|
||||
NodeRef nodeRef = fileInfo.getNodeRef();
|
||||
|
||||
if (logger.isDebugEnabled())
|
||||
logger.debug("Created website folder node with name: " + this.name);
|
||||
if (LOGGER.isDebugEnabled())
|
||||
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
|
||||
String avmStore = DNSNameMangler.MakeDNSName(this.dnsName);
|
||||
@@ -384,6 +385,14 @@ public class CreateWebsiteWizard extends BaseWizardBean
|
||||
this.avmLockingService = avmLockingService;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param formsService The FormsService to set.
|
||||
*/
|
||||
public void setFormsService(final FormsService formsService)
|
||||
{
|
||||
this.formsService = formsService;
|
||||
}
|
||||
|
||||
|
||||
// ------------------------------------------------------------------------------
|
||||
// Bean getters and setters
|
||||
@@ -614,7 +623,7 @@ public class CreateWebsiteWizard extends BaseWizardBean
|
||||
*/
|
||||
public List<UIListItem> getFormsList()
|
||||
{
|
||||
Collection<Form> forms = FormsService.getInstance().getForms();
|
||||
Collection<Form> forms = this.formsService.getForms();
|
||||
List<UIListItem> items = new ArrayList<UIListItem>(forms.size());
|
||||
for (Form form : forms)
|
||||
{
|
||||
|
@@ -51,8 +51,8 @@ public class DeleteFileDialog extends BaseDialogBean
|
||||
|
||||
protected AVMService avmService;
|
||||
protected AVMBrowseBean avmBrowseBean;
|
||||
|
||||
|
||||
protected FormsService formsService;
|
||||
|
||||
/**
|
||||
* @param avmBrowseBean The avmBrowseBean to set.
|
||||
*/
|
||||
@@ -68,7 +68,14 @@ public class DeleteFileDialog extends BaseDialogBean
|
||||
{
|
||||
this.avmService = avmService;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* @param formsService The FormsService to set.
|
||||
*/
|
||||
public void setFormsService(final FormsService formsService)
|
||||
{
|
||||
this.formsService = formsService;
|
||||
}
|
||||
|
||||
// ------------------------------------------------------------------------------
|
||||
// Dialog implementation
|
||||
@@ -79,7 +86,11 @@ public class DeleteFileDialog extends BaseDialogBean
|
||||
{
|
||||
// get the content to delete
|
||||
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())
|
||||
logger.debug("Trying to delete AVM node: " + node.getPath());
|
||||
@@ -88,7 +99,7 @@ public class DeleteFileDialog extends BaseDialogBean
|
||||
{
|
||||
try
|
||||
{
|
||||
fid = new RenditionImpl(node.getNodeRef()).getPrimaryFormInstanceData();
|
||||
fid = this.formsService.getRendition(node.getNodeRef()).getPrimaryFormInstanceData();
|
||||
}
|
||||
catch (FileNotFoundException fnfe)
|
||||
{
|
||||
@@ -97,7 +108,7 @@ public class DeleteFileDialog extends BaseDialogBean
|
||||
}
|
||||
else if (node.hasAspect(WCMAppModel.ASPECT_FORM_INSTANCE_DATA))
|
||||
{
|
||||
fid = new FormInstanceDataImpl(node.getNodeRef());
|
||||
fid = this.formsService.getFormInstanceData(node.getNodeRef());
|
||||
}
|
||||
if (fid != null)
|
||||
{
|
||||
@@ -117,11 +128,6 @@ public class DeleteFileDialog extends BaseDialogBean
|
||||
AVMNodeConverter.SplitBase(node.getPath())[1]);
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
logger.warn("WARNING: delete called without a current AVM Node!");
|
||||
}
|
||||
|
||||
return outcome;
|
||||
}
|
||||
|
||||
@@ -160,7 +166,7 @@ public class DeleteFileDialog extends BaseDialogBean
|
||||
{
|
||||
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(),
|
||||
"delete_rendition_confirm"),
|
||||
node.getName(),
|
||||
@@ -175,12 +181,11 @@ public class DeleteFileDialog extends BaseDialogBean
|
||||
}
|
||||
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(),
|
||||
"delete_form_instance_data_confirm"),
|
||||
fid.getName(),
|
||||
fid.getRenditions().size());
|
||||
|
||||
}
|
||||
return MessageFormat.format(Application.getMessage(FacesContext.getCurrentInstance(),
|
||||
"delete_avm_file_confirm"),
|
||||
|
141
source/java/org/alfresco/web/bean/wcm/EditAvmFileDialog.java
Normal file
141
source/java/org/alfresco/web/bean/wcm/EditAvmFileDialog.java
Normal 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");
|
||||
}
|
||||
}
|
@@ -19,7 +19,8 @@
|
||||
* 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" */
|
||||
* http://www.alfresco.com/legal/licensing
|
||||
*/
|
||||
package org.alfresco.web.bean.wcm;
|
||||
|
||||
import java.io.Serializable;
|
||||
@@ -80,7 +81,7 @@ public class EditFormWizard
|
||||
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
|
||||
this.setFormName(form.getName());
|
||||
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)
|
||||
*/
|
||||
@Override
|
||||
protected String finishImpl(FacesContext context, String outcome)
|
||||
protected String finishImpl(final FacesContext context,
|
||||
final String outcome)
|
||||
throws Exception
|
||||
{
|
||||
final NodeRef formNodeRef = this.browseBean.getActionSpace().getNodeRef();
|
||||
@@ -225,7 +227,7 @@ public class EditFormWizard
|
||||
this.saveRenderingEngineTemplate(retd, formNodeRef);
|
||||
}
|
||||
}
|
||||
return AlfrescoNavigationHandler.CLOSE_WIZARD_OUTCOME;
|
||||
return outcome;
|
||||
}
|
||||
|
||||
/**
|
||||
|
@@ -74,7 +74,6 @@ import org.alfresco.web.data.IDataContainer;
|
||||
import org.alfresco.web.data.QuickSort;
|
||||
import org.alfresco.web.forms.Form;
|
||||
import org.alfresco.web.forms.FormInstanceData;
|
||||
import org.alfresco.web.forms.FormInstanceDataImpl;
|
||||
import org.alfresco.web.forms.FormNotFoundException;
|
||||
import org.alfresco.web.forms.FormProcessor;
|
||||
import org.alfresco.web.forms.FormsService;
|
||||
@@ -113,7 +112,7 @@ public class EditWebContentWizard extends CreateWebContentWizard
|
||||
}
|
||||
LOGGER.debug("path is " + 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);
|
||||
try
|
||||
{
|
||||
@@ -152,15 +151,8 @@ public class EditWebContentWizard extends CreateWebContentWizard
|
||||
final ContentWriter writer = this.avmService.getContentWriter(this.createdPath);
|
||||
this.content = XMLUtil.toString(this.instanceDataDocument, false);
|
||||
writer.putContent(this.content);
|
||||
this.formInstanceData = new FormInstanceDataImpl(-1, this.createdPath)
|
||||
{
|
||||
@Override
|
||||
public Form getForm()
|
||||
throws FormNotFoundException
|
||||
{
|
||||
return EditWebContentWizard.this.getForm();
|
||||
}
|
||||
};
|
||||
// XXXarielb might not need to do this reload
|
||||
this.formInstanceData = this.formsService.getFormInstanceData(-1, this.createdPath);
|
||||
final List<FormInstanceData.RegenerateResult> result = this.formInstanceData.regenerateRenditions();
|
||||
this.renditions = new LinkedList<Rendition>();
|
||||
for (FormInstanceData.RegenerateResult rr : result)
|
||||
|
@@ -98,7 +98,7 @@ public class EditWebsiteWizard extends CreateWebsiteWizard
|
||||
String name = (String)this.nodeService.getProperty(formRef, WCMAppModel.PROP_FORMNAME);
|
||||
try
|
||||
{
|
||||
final Form formImpl = FormsService.getInstance().getForm(name);
|
||||
final Form formImpl = this.formsService.getForm(name);
|
||||
FormWrapper form = new FormWrapper(formImpl);
|
||||
form.setTitle((String)this.nodeService.getProperty(formRef, ContentModel.PROP_TITLE));
|
||||
form.setDescription((String)this.nodeService.getProperty(formRef, ContentModel.PROP_DESCRIPTION));
|
||||
@@ -147,6 +147,7 @@ public class EditWebsiteWizard extends CreateWebsiteWizard
|
||||
catch (FormNotFoundException fnfe)
|
||||
{
|
||||
//ignore
|
||||
LOGGER.debug(fnfe.getMessage(), fnfe);
|
||||
}
|
||||
}
|
||||
|
||||
|
@@ -24,6 +24,7 @@
|
||||
*/
|
||||
package org.alfresco.web.bean.wcm;
|
||||
|
||||
import java.text.MessageFormat;
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
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.workflow.WorkflowDefinition;
|
||||
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.wcm.CreateWebsiteWizard.FormWrapper;
|
||||
import org.alfresco.web.bean.wcm.CreateWebsiteWizard.WorkflowWrapper;
|
||||
@@ -74,6 +76,14 @@ public class FormDetailsDialog extends BaseDialogBean
|
||||
this.outputPathPattern = 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.
|
||||
|
@@ -24,6 +24,7 @@
|
||||
*/
|
||||
package org.alfresco.web.bean.wcm;
|
||||
|
||||
import java.text.MessageFormat;
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
@@ -34,6 +35,7 @@ import javax.faces.model.DataModel;
|
||||
import javax.faces.model.ListDataModel;
|
||||
|
||||
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.wcm.CreateWebsiteWizard.FormWrapper;
|
||||
import org.alfresco.web.bean.wcm.CreateWebsiteWizard.PresentationTemplate;
|
||||
@@ -96,6 +98,14 @@ public class FormTemplatesDialog extends BaseDialogBean
|
||||
this.templates = new ArrayList<PresentationTemplate>(getActionForm().getTemplates().size());
|
||||
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
|
||||
|
@@ -234,9 +234,10 @@ public class ManageChangeRequestTaskDialog extends ManageTaskDialog
|
||||
Application.getCurrentUser(context).getUserName());
|
||||
|
||||
// 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);
|
||||
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);
|
||||
}
|
||||
}
|
||||
|
@@ -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;
|
||||
}
|
||||
}
|
@@ -89,6 +89,7 @@ public class RegenerateRenditionsWizard
|
||||
private AVMSyncService avmSyncService;
|
||||
private ContentService contentService;
|
||||
private SearchService searchService;
|
||||
private FormsService formsService;
|
||||
private WebProject selectedWebProject;
|
||||
private String[] selectedForms;
|
||||
private String[] selectedRenderingEngineTemplates;
|
||||
@@ -394,6 +395,14 @@ public class RegenerateRenditionsWizard
|
||||
{
|
||||
this.searchService = searchService;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param formsService The FormsService to set.
|
||||
*/
|
||||
public void setFormsService(final FormsService formsService)
|
||||
{
|
||||
this.formsService = formsService;
|
||||
}
|
||||
|
||||
// ------------------------------------------------------------------------------
|
||||
// Helper Methods
|
||||
@@ -418,24 +427,7 @@ public class RegenerateRenditionsWizard
|
||||
{
|
||||
final String avmPath = AVMNodeConverter.ToAVMVersionPath(row.getNodeRef()).getSecond();
|
||||
final String previewAvmPath = AVMUtil.getCorrespondingPathInPreviewStore(avmPath);
|
||||
final FormInstanceDataImpl fid = new FormInstanceDataImpl(-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);
|
||||
result.add(this.formsService.getFormInstanceData(-1, previewAvmPath));
|
||||
}
|
||||
return result;
|
||||
}
|
||||
@@ -454,13 +446,12 @@ public class RegenerateRenditionsWizard
|
||||
LOGGER.debug("running query " + query);
|
||||
sp.setQuery(query.toString());
|
||||
final ResultSet rs = this.searchService.query(sp);
|
||||
final List<Rendition> result = new ArrayList<Rendition>(rs.length());
|
||||
final List<Rendition> result = new ArrayList<Rendition>(rs.length());
|
||||
for (final ResultSetRow row : rs)
|
||||
{
|
||||
final String avmPath = AVMNodeConverter.ToAVMVersionPath(row.getNodeRef()).getSecond();
|
||||
final String previewAvmPath = AVMUtil.getCorrespondingPathInPreviewStore(avmPath);
|
||||
final Rendition r = new RenditionImpl(-1, previewAvmPath);
|
||||
result.add(r);
|
||||
result.add(this.formsService.getRendition(-1, previewAvmPath));
|
||||
}
|
||||
return result;
|
||||
}
|
||||
@@ -540,24 +531,7 @@ public class RegenerateRenditionsWizard
|
||||
if (this.regenerateScope.equals(REGENERATE_SCOPE_ALL) ||
|
||||
this.regenerateScope.equals(REGENERATE_SCOPE_FORM))
|
||||
{
|
||||
final FormInstanceDataImpl fid = new FormInstanceDataImpl(-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);
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
final FormInstanceData fid = this.formsService.getFormInstanceData(-1, previewAvmPath);
|
||||
try
|
||||
{
|
||||
final List<FormInstanceData.RegenerateResult> regenResults = fid.regenerateRenditions();
|
||||
@@ -582,7 +556,7 @@ public class RegenerateRenditionsWizard
|
||||
}
|
||||
else
|
||||
{
|
||||
final Rendition r = new RenditionImpl(-1, previewAvmPath);
|
||||
final Rendition r = this.formsService.getRendition(-1, previewAvmPath);
|
||||
try
|
||||
{
|
||||
r.regenerate();
|
||||
|
@@ -75,7 +75,7 @@ import org.alfresco.web.bean.dialog.BaseDialogBean;
|
||||
import org.alfresco.web.bean.repository.Repository;
|
||||
import org.alfresco.web.config.ClientConfigElement;
|
||||
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.ui.common.Utils;
|
||||
import org.alfresco.web.ui.common.component.UIListItem;
|
||||
@@ -89,7 +89,7 @@ import org.apache.commons.logging.LogFactory;
|
||||
*/
|
||||
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 MSG_DELETED_ITEM = "avm_node_deleted";
|
||||
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[] workflowSelectedValue;
|
||||
private boolean enteringExpireDate = false;
|
||||
private boolean startedFromWorkflow = false;
|
||||
private boolean loadSelectedNodesFromBrowseBean = false;
|
||||
private boolean validateLinks = true;
|
||||
private Date defaultExpireDate;
|
||||
private Date launchDate;
|
||||
@@ -106,7 +106,7 @@ public class SubmitDialog extends BaseDialogBean
|
||||
private List<ItemWrapper> submitItems;
|
||||
private List<ItemWrapper> warningItems;
|
||||
private HashSet<FormWorkflowWrapper> workflows;
|
||||
private Map<String, FormWorkflowWrapper> formWorkflowMap;
|
||||
// private Map<String, FormWorkflowWrapper> formWorkflowMap;
|
||||
private Map<String, Date> expirationDates;
|
||||
private List<UIListItem> workflowItems;
|
||||
private Map<QName, Serializable> workflowParams;
|
||||
@@ -130,11 +130,12 @@ public class SubmitDialog extends BaseDialogBean
|
||||
protected AVMSyncService avmSyncService;
|
||||
protected AVMLockingService avmLockingService;
|
||||
protected NameMatcher nameMatcher;
|
||||
protected FormsService formsService;
|
||||
|
||||
/** Current workflow for dialog context */
|
||||
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.
|
||||
@@ -192,6 +193,14 @@ public class SubmitDialog extends BaseDialogBean
|
||||
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)
|
||||
*/
|
||||
@@ -216,29 +225,7 @@ public class SubmitDialog extends BaseDialogBean
|
||||
this.virtUpdatePath = null;
|
||||
|
||||
// determine if the dialog has been started from a workflow
|
||||
Boolean bool = new Boolean(this.parameters.get(PARAM_STARTED_FROM_WORKFLOW));
|
||||
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));
|
||||
}
|
||||
}
|
||||
this.loadSelectedNodesFromBrowseBean = Boolean.valueOf(this.parameters.get(PARAM_LOAD_SELECTED_NODES_FROM_BROWSE_BEAN));
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -637,7 +624,7 @@ public class SubmitDialog extends BaseDialogBean
|
||||
catch (Throwable e)
|
||||
{
|
||||
// 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
|
||||
if (workflowSelectedValue == null)
|
||||
{
|
||||
workflowSelectedValue = new String[]{workflowDef.getName()};
|
||||
workflowSelectedValue = new String[]{ workflowDef.getName() };
|
||||
}
|
||||
}
|
||||
this.workflowItems = items;
|
||||
@@ -946,132 +933,110 @@ public class SubmitDialog extends BaseDialogBean
|
||||
tx.begin();
|
||||
|
||||
List<AVMNodeDescriptor> selected;
|
||||
if (this.startedFromWorkflow)
|
||||
if (this.loadSelectedNodesFromBrowseBean)
|
||||
{
|
||||
// if the dialog was started from a workflow the AVM browse bean should
|
||||
// have the list of nodes that need submitting
|
||||
selected = this.avmBrowseBean.getExpiredNodes();
|
||||
selected = this.avmBrowseBean.getNodesForSubmit();
|
||||
}
|
||||
// if the dialog was started from the UI determine what nodes the user selected to submit
|
||||
else if (this.avmBrowseBean.getAllItemsAction())
|
||||
{
|
||||
String webapp = this.avmBrowseBean.getWebapp();
|
||||
String userStore = AVMUtil.buildStoreWebappPath(this.avmBrowseBean.getSandbox(), webapp);
|
||||
String stagingStore = AVMUtil.buildStoreWebappPath(this.avmBrowseBean.getStagingStore(), webapp);
|
||||
List<AVMDifference> diffs = this.avmSyncService.compare(-1, userStore, -1, stagingStore, nameMatcher);
|
||||
selected = new ArrayList<AVMNodeDescriptor>(diffs.size());
|
||||
for (AVMDifference diff : diffs)
|
||||
{
|
||||
selected.add(this.avmService.lookup(-1, diff.getSourcePath(), true));
|
||||
}
|
||||
}
|
||||
else if (this.avmBrowseBean.getAvmActionNode() == null)
|
||||
{
|
||||
// multiple items selected
|
||||
selected = this.avmBrowseBean.getSelectedSandboxItems();
|
||||
}
|
||||
else
|
||||
{
|
||||
// if the dialog was started from the UI determine what nodes the user selected to submit
|
||||
if (this.avmBrowseBean.getAllItemsAction())
|
||||
{
|
||||
String webapp = this.avmBrowseBean.getWebapp();
|
||||
String userStore = AVMUtil.buildStoreWebappPath(this.avmBrowseBean.getSandbox(), webapp);
|
||||
String stagingStore = AVMUtil.buildStoreWebappPath(this.avmBrowseBean.getStagingStore(), webapp);
|
||||
List<AVMDifference> diffs = this.avmSyncService.compare(-1, userStore, -1, stagingStore, nameMatcher);
|
||||
selected = new ArrayList<AVMNodeDescriptor>(diffs.size());
|
||||
for (AVMDifference diff : diffs)
|
||||
{
|
||||
AVMNodeDescriptor node = this.avmService.lookup(-1, diff.getSourcePath(), true);
|
||||
selected.add(node);
|
||||
}
|
||||
}
|
||||
else if (this.avmBrowseBean.getAvmActionNode() == null)
|
||||
{
|
||||
// multiple items selected
|
||||
selected = this.avmBrowseBean.getSelectedSandboxItems();
|
||||
}
|
||||
else
|
||||
{
|
||||
// single item selected
|
||||
AVMNodeDescriptor node =
|
||||
this.avmService.lookup(-1, this.avmBrowseBean.getAvmActionNode().getPath(), true);
|
||||
selected = new ArrayList<AVMNodeDescriptor>(1);
|
||||
selected.add(node);
|
||||
}
|
||||
// single item selected
|
||||
selected = new ArrayList<AVMNodeDescriptor>(1);
|
||||
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());
|
||||
this.submitItems = new ArrayList<ItemWrapper>(selected.size());
|
||||
this.warningItems = new ArrayList<ItemWrapper>(selected.size() >> 1);
|
||||
for (AVMNodeDescriptor node : selected)
|
||||
{
|
||||
if (this.avmService.hasAspect(-1, node.getPath(), AVMSubmittedAspect.ASPECT) == false)
|
||||
if (this.avmService.hasAspect(-1, node.getPath(), AVMSubmittedAspect.ASPECT))
|
||||
{
|
||||
NodeRef ref = AVMNodeConverter.ToNodeRef(-1, node.getPath());
|
||||
if (submittedPaths.contains(node.getPath()) == false)
|
||||
{
|
||||
if (node.isDeleted() == false)
|
||||
{
|
||||
// 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
|
||||
if (this.nodeService.hasAspect(ref, WCMAppModel.ASPECT_FORM_INSTANCE_DATA))
|
||||
{
|
||||
NodeRef formInstanceDataRef = ref;
|
||||
|
||||
// check if this is a rendition - as they also have the forminstancedata aspect
|
||||
if (this.nodeService.hasAspect(ref, WCMAppModel.ASPECT_RENDITION))
|
||||
{
|
||||
// found a generated rendition asset - locate the parent form instance data file
|
||||
// and use this to find all generated assets that are appropriate
|
||||
// NOTE: this path value is store relative
|
||||
String strFormInstance = (String)this.nodeService.getProperty(
|
||||
ref, WCMAppModel.PROP_PRIMARY_FORM_INSTANCE_DATA);
|
||||
strFormInstance = this.avmBrowseBean.getSandbox() + ':' + strFormInstance;
|
||||
formInstanceDataRef = AVMNodeConverter.ToNodeRef(-1, strFormInstance);
|
||||
}
|
||||
|
||||
// add the form instance data file to the list for submission
|
||||
AVMNodeDescriptor formInstanceNode = this.avmService.lookup(
|
||||
-1, AVMNodeConverter.ToAVMVersionPath(formInstanceDataRef).getSecond());
|
||||
if (submittedPaths.contains(formInstanceNode.getPath()) == false)
|
||||
{
|
||||
this.submitItems.add(new ItemWrapper(formInstanceNode));
|
||||
submittedPaths.add(formInstanceNode.getPath());
|
||||
}
|
||||
|
||||
// locate renditions for this form instance data file and add to list for submission
|
||||
FormInstanceData formImpl = new FormInstanceDataImpl(formInstanceDataRef);
|
||||
for (Rendition rendition : formImpl.getRenditions())
|
||||
{
|
||||
String renditionPath = rendition.getPath();
|
||||
if (submittedPaths.contains(renditionPath) == false)
|
||||
{
|
||||
AVMNodeDescriptor renditionNode = this.avmService.lookup(-1, renditionPath);
|
||||
this.submitItems.add(new ItemWrapper(renditionNode));
|
||||
submittedPaths.add(renditionPath);
|
||||
}
|
||||
}
|
||||
|
||||
// lookup the associated Form workflow from the parent form property
|
||||
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());
|
||||
}
|
||||
}
|
||||
this.warningItems.add(new ItemWrapper(node));
|
||||
continue;
|
||||
}
|
||||
NodeRef ref = AVMNodeConverter.ToNodeRef(-1, node.getPath());
|
||||
if (submittedPaths.contains(node.getPath()))
|
||||
{
|
||||
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
|
||||
// for that form and store into the list of available workflows
|
||||
else if (! this.nodeService.hasAspect(ref, WCMAppModel.ASPECT_FORM_INSTANCE_DATA))
|
||||
{
|
||||
this.submitItems.add(new ItemWrapper(node));
|
||||
submittedPaths.add(node.getPath());
|
||||
}
|
||||
else
|
||||
{
|
||||
this.warningItems.add(new ItemWrapper(node));
|
||||
FormInstanceData fid = null;
|
||||
// check if this is a rendition - as they also have the forminstancedata aspect
|
||||
if (this.nodeService.hasAspect(ref, WCMAppModel.ASPECT_RENDITION))
|
||||
{
|
||||
// found a generated rendition asset - locate the parent form instance data file
|
||||
// and use this to find all generated assets that are appropriate
|
||||
// NOTE: this path value is store relative
|
||||
fid = this.formsService.getRendition(ref).getPrimaryFormInstanceData();
|
||||
}
|
||||
else
|
||||
{
|
||||
fid = this.formsService.getFormInstanceData(ref);
|
||||
}
|
||||
|
||||
// add the form instance data file to the list for submission
|
||||
if (!submittedPaths.contains(fid.getPath()))
|
||||
{
|
||||
this.submitItems.add(new ItemWrapper(this.avmService.lookup(-1, fid.getPath())));
|
||||
submittedPaths.add(fid.getPath());
|
||||
}
|
||||
|
||||
// locate renditions for this form instance data file and add to list for submission
|
||||
for (final Rendition rendition : fid.getRenditions())
|
||||
{
|
||||
final String renditionPath = rendition.getPath();
|
||||
if (!submittedPaths.contains(renditionPath))
|
||||
{
|
||||
this.submitItems.add(new ItemWrapper(this.avmService.lookup(-1, renditionPath)));
|
||||
submittedPaths.add(renditionPath);
|
||||
}
|
||||
}
|
||||
this.workflows.add(new FormWorkflowWrapper(fid.getForm().getDefaultWorkflow().getName(),
|
||||
fid.getForm().getDefaultWorkflowParameters()));
|
||||
}
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
this.submitItems = Collections.<ItemWrapper>emptyList();
|
||||
this.warningItems = Collections.<ItemWrapper>emptyList();
|
||||
}
|
||||
|
||||
tx.commit();
|
||||
}
|
||||
@@ -1092,22 +1057,23 @@ public class SubmitDialog extends BaseDialogBean
|
||||
// if an expiration date has been set for this item we need to
|
||||
// add the expires aspect and the date supplied
|
||||
Date expirationDate = this.expirationDates.get(srcPath);
|
||||
if (expirationDate != null)
|
||||
if (expirationDate == null)
|
||||
{
|
||||
// make sure the aspect is present
|
||||
if (this.avmService.hasAspect(-1, srcPath, WCMAppModel.ASPECT_EXPIRES) == false)
|
||||
{
|
||||
this.avmService.addAspect(srcPath, WCMAppModel.ASPECT_EXPIRES);
|
||||
}
|
||||
|
||||
// set the expiration date
|
||||
this.avmService.setNodeProperty(srcPath, WCMAppModel.PROP_EXPIRATIONDATE,
|
||||
new PropertyValue(DataTypeDefinition.DATETIME, expirationDate));
|
||||
|
||||
if (logger.isDebugEnabled())
|
||||
logger.debug("Set expiration date of " + expirationDate +
|
||||
" for " + srcPath);
|
||||
return;
|
||||
}
|
||||
// make sure the aspect is present
|
||||
if (this.avmService.hasAspect(-1, srcPath, WCMAppModel.ASPECT_EXPIRES) == false)
|
||||
{
|
||||
this.avmService.addAspect(srcPath, WCMAppModel.ASPECT_EXPIRES);
|
||||
}
|
||||
|
||||
// set the expiration date
|
||||
this.avmService.setNodeProperty(srcPath, WCMAppModel.PROP_EXPIRATIONDATE,
|
||||
new PropertyValue(DataTypeDefinition.DATETIME, expirationDate));
|
||||
|
||||
if (LOGGER.isDebugEnabled())
|
||||
LOGGER.debug("Set expiration date of " + expirationDate +
|
||||
" for " + srcPath);
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -1115,15 +1081,16 @@ public class SubmitDialog extends BaseDialogBean
|
||||
*/
|
||||
public void setupConfigureWorkflow(ActionEvent event)
|
||||
{
|
||||
if (this.workflowSelectedValue != null)
|
||||
if (this.workflowSelectedValue == null)
|
||||
{
|
||||
String workflowName = this.workflowSelectedValue[0];
|
||||
for (WorkflowConfiguration wrapper : this.workflows)
|
||||
return;
|
||||
}
|
||||
String workflowName = this.workflowSelectedValue[0];
|
||||
for (WorkflowConfiguration wrapper : this.workflows)
|
||||
{
|
||||
if (wrapper.getName().equals(workflowName))
|
||||
{
|
||||
if (wrapper.getName().equals(workflowName))
|
||||
{
|
||||
setActionWorkflow(wrapper);
|
||||
}
|
||||
setActionWorkflow(wrapper);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1151,8 +1118,8 @@ public class SubmitDialog extends BaseDialogBean
|
||||
*/
|
||||
public void applyDefaultExpireDateToAll(ActionEvent event)
|
||||
{
|
||||
if (logger.isDebugEnabled())
|
||||
logger.debug("applying default expiration date of " + this.defaultExpireDate + " to all modified items");
|
||||
if (LOGGER.isDebugEnabled())
|
||||
LOGGER.debug("applying default expiration date of " + this.defaultExpireDate + " to all modified items");
|
||||
|
||||
List<ItemWrapper> items = this.getSubmitItems();
|
||||
for (ItemWrapper item : items)
|
||||
@@ -1241,14 +1208,8 @@ public class SubmitDialog extends BaseDialogBean
|
||||
|
||||
boolean matchesPath(String path)
|
||||
{
|
||||
if (filenamePattern != null)
|
||||
{
|
||||
return filenamePattern.matcher(path).matches();
|
||||
}
|
||||
else
|
||||
{
|
||||
return false;
|
||||
}
|
||||
return (filenamePattern != null &&
|
||||
filenamePattern.matcher(path).matches());
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -1260,14 +1221,8 @@ public class SubmitDialog extends BaseDialogBean
|
||||
@Override
|
||||
public boolean equals(Object obj)
|
||||
{
|
||||
if (obj instanceof FormWorkflowWrapper)
|
||||
{
|
||||
return this.name.equals( ((FormWorkflowWrapper)obj).name );
|
||||
}
|
||||
else
|
||||
{
|
||||
return false;
|
||||
}
|
||||
return (obj instanceof FormWorkflowWrapper &&
|
||||
this.name.equals(((FormWorkflowWrapper)obj).name));
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1376,14 +1331,8 @@ public class SubmitDialog extends BaseDialogBean
|
||||
@Override
|
||||
public boolean equals(Object obj)
|
||||
{
|
||||
if (obj instanceof ItemWrapper)
|
||||
{
|
||||
return ((ItemWrapper)obj).descriptor.getPath().equals(descriptor.getPath());
|
||||
}
|
||||
else
|
||||
{
|
||||
return false;
|
||||
}
|
||||
return (obj instanceof ItemWrapper &&
|
||||
((ItemWrapper)obj).descriptor.getPath().equals(descriptor.getPath()));
|
||||
}
|
||||
|
||||
@Override
|
||||
|
@@ -51,6 +51,7 @@ import org.alfresco.service.namespace.NamespaceService;
|
||||
import org.alfresco.service.namespace.QName;
|
||||
import org.alfresco.service.namespace.RegexQNamePattern;
|
||||
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.User;
|
||||
import org.alfresco.web.data.IDataContainer;
|
||||
@@ -85,9 +86,11 @@ public class WebProject
|
||||
private Form baseForm;
|
||||
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;
|
||||
}
|
||||
|
||||
@@ -160,7 +163,8 @@ public class WebProject
|
||||
allRets.get(renderingEngineTemplateName);
|
||||
result.put(ret.getName(),
|
||||
new RenderingEngineTemplateImpl(ret.getNodeRef(),
|
||||
ret.getRenditionPropertiesNodeRef())
|
||||
ret.getRenditionPropertiesNodeRef(),
|
||||
this.formsService)
|
||||
{
|
||||
@Override
|
||||
public String getOutputPathPattern()
|
||||
@@ -308,8 +312,14 @@ public class WebProject
|
||||
throw new NullPointerException();
|
||||
}
|
||||
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);
|
||||
}
|
||||
return result;
|
||||
@@ -420,7 +430,7 @@ public class WebProject
|
||||
{
|
||||
final ServiceRegistry serviceRegistry = this.getServiceRegistry();
|
||||
final NodeService nodeService = serviceRegistry.getNodeService();
|
||||
final FormsService formsService = FormsService.getInstance();
|
||||
final FormsService formsService = WebProject.getFormsService();
|
||||
final List<ChildAssociationRef> formRefs =
|
||||
nodeService.getChildAssocs(this.nodeRef,
|
||||
WCMAppModel.ASSOC_WEBFORM,
|
||||
@@ -433,16 +443,23 @@ public class WebProject
|
||||
try
|
||||
{
|
||||
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)
|
||||
{
|
||||
LOGGER.debug(fnfe);
|
||||
LOGGER.debug("got exception " + fnfe.getMessage() +
|
||||
" while loading web forms for project " + this.getName());
|
||||
}
|
||||
}
|
||||
return result;
|
||||
}
|
||||
|
||||
private static FormsService getFormsService()
|
||||
{
|
||||
return (FormsService)FacesHelper.getManagedBean(FacesContext.getCurrentInstance(),
|
||||
"FormsService");
|
||||
}
|
||||
|
||||
private static ServiceRegistry getServiceRegistry()
|
||||
{
|
||||
final FacesContext fc = FacesContext.getCurrentInstance();
|
||||
|
Reference in New Issue
Block a user