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

@@ -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)
{