mirror of
https://github.com/Alfresco/alfresco-community-repo.git
synced 2025-08-07 17:49:17 +00:00
Merged V2.1 to HEAD
6950: Fix for forum issue (6111) when using xsl:include 6951: Partial fix for WCM-862 6952: Merged V1.4 to V2.1 6921: Reindex tracking refactoring. 6954: Merged V1.4 to V2.1 6927: Config and startup changes for index tracking git-svn-id: https://svn.alfresco.com/repos/alfresco-enterprise/alfresco/HEAD/root@7369 c4b6b30b-aa2e-2d43-bbcb-ca4b014f7261
This commit is contained in:
@@ -34,6 +34,7 @@ import java.util.LinkedList;
|
|||||||
import java.util.List;
|
import java.util.List;
|
||||||
import java.util.Map;
|
import java.util.Map;
|
||||||
import java.util.ResourceBundle;
|
import java.util.ResourceBundle;
|
||||||
|
import java.util.StringTokenizer;
|
||||||
|
|
||||||
import javax.faces.context.FacesContext;
|
import javax.faces.context.FacesContext;
|
||||||
import javax.faces.event.ValueChangeEvent;
|
import javax.faces.event.ValueChangeEvent;
|
||||||
@@ -45,29 +46,21 @@ import org.alfresco.config.ConfigService;
|
|||||||
import org.alfresco.error.AlfrescoRuntimeException;
|
import org.alfresco.error.AlfrescoRuntimeException;
|
||||||
import org.alfresco.model.ContentModel;
|
import org.alfresco.model.ContentModel;
|
||||||
import org.alfresco.model.WCMAppModel;
|
import org.alfresco.model.WCMAppModel;
|
||||||
import org.alfresco.model.WCMWorkflowModel;
|
|
||||||
import org.alfresco.repo.avm.AVMNodeConverter;
|
import org.alfresco.repo.avm.AVMNodeConverter;
|
||||||
import org.alfresco.repo.content.MimetypeMap;
|
import org.alfresco.repo.content.MimetypeMap;
|
||||||
import org.alfresco.repo.workflow.WorkflowModel;
|
import org.alfresco.repo.transaction.RetryingTransactionHelper;
|
||||||
|
import org.alfresco.repo.transaction.RetryingTransactionHelper.RetryingTransactionCallback;
|
||||||
import org.alfresco.service.cmr.avm.AVMExistsException;
|
import org.alfresco.service.cmr.avm.AVMExistsException;
|
||||||
import org.alfresco.service.cmr.avm.AVMNodeDescriptor;
|
import org.alfresco.service.cmr.avm.AVMNodeDescriptor;
|
||||||
import org.alfresco.service.cmr.avm.AVMService;
|
import org.alfresco.service.cmr.avm.AVMService;
|
||||||
import org.alfresco.service.cmr.avm.locking.AVMLockingService;
|
import org.alfresco.service.cmr.avm.locking.AVMLockingService;
|
||||||
import org.alfresco.service.cmr.avmsync.AVMDifference;
|
import org.alfresco.service.cmr.avmsync.AVMDifference;
|
||||||
import org.alfresco.service.cmr.avmsync.AVMSyncService;
|
import org.alfresco.service.cmr.avmsync.AVMSyncService;
|
||||||
import org.alfresco.service.cmr.repository.ChildAssociationRef;
|
|
||||||
import org.alfresco.service.cmr.repository.NodeRef;
|
import org.alfresco.service.cmr.repository.NodeRef;
|
||||||
import org.alfresco.service.cmr.workflow.WorkflowDefinition;
|
|
||||||
import org.alfresco.service.cmr.workflow.WorkflowPath;
|
|
||||||
import org.alfresco.service.cmr.workflow.WorkflowService;
|
|
||||||
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.QName;
|
||||||
import org.alfresco.service.namespace.RegexQNamePattern;
|
|
||||||
import org.alfresco.web.app.AlfrescoNavigationHandler;
|
import org.alfresco.web.app.AlfrescoNavigationHandler;
|
||||||
import org.alfresco.web.app.Application;
|
import org.alfresco.web.app.Application;
|
||||||
import org.alfresco.web.bean.content.BaseContentWizard;
|
import org.alfresco.web.bean.content.BaseContentWizard;
|
||||||
import org.alfresco.web.bean.repository.Node;
|
|
||||||
import org.alfresco.web.bean.repository.Repository;
|
import org.alfresco.web.bean.repository.Repository;
|
||||||
import org.alfresco.web.data.IDataContainer;
|
import org.alfresco.web.data.IDataContainer;
|
||||||
import org.alfresco.web.data.QuickSort;
|
import org.alfresco.web.data.QuickSort;
|
||||||
@@ -224,9 +217,22 @@ public class CreateWebContentWizard extends BaseContentWizard
|
|||||||
// if rendering a form, then save the content now to generate the renditions
|
// if rendering a form, then save the content now to generate the renditions
|
||||||
if (MimetypeMap.MIMETYPE_XML.equals(this.mimeType))
|
if (MimetypeMap.MIMETYPE_XML.equals(this.mimeType))
|
||||||
{
|
{
|
||||||
|
FacesContext context = FacesContext.getCurrentInstance();
|
||||||
|
RetryingTransactionHelper txnHelper = Repository.getRetryingTransactionHelper(context);
|
||||||
|
RetryingTransactionCallback<String> callback = new RetryingTransactionCallback<String>()
|
||||||
|
{
|
||||||
|
public String execute() throws Throwable
|
||||||
|
{
|
||||||
|
// call the actual implementation
|
||||||
|
saveContent();
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
this.saveContent();
|
// Execute
|
||||||
|
txnHelper.doInTransaction(callback);
|
||||||
}
|
}
|
||||||
catch (Exception e)
|
catch (Exception e)
|
||||||
{
|
{
|
||||||
@@ -262,29 +268,15 @@ public class CreateWebContentWizard extends BaseContentWizard
|
|||||||
return super.back();
|
return super.back();
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
|
||||||
public String finish()
|
|
||||||
{
|
|
||||||
// if a form is not being entered, then save just html/text content
|
|
||||||
if (this.formInstanceData == null || this.renditions == null)
|
|
||||||
{
|
|
||||||
try
|
|
||||||
{
|
|
||||||
this.saveContent();
|
|
||||||
}
|
|
||||||
catch (Exception e)
|
|
||||||
{
|
|
||||||
Utils.addErrorMessage(e.getMessage(), e);
|
|
||||||
return super.getErrorOutcome(e);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
return super.finish();
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
protected String finishImpl(final FacesContext context, String outcome)
|
protected String finishImpl(final FacesContext context, String outcome)
|
||||||
throws Exception
|
throws Exception
|
||||||
{
|
{
|
||||||
|
if (this.formInstanceData == null || this.renditions == null)
|
||||||
|
{
|
||||||
|
this.saveContent();
|
||||||
|
}
|
||||||
|
|
||||||
final NodeRef[] uploadedFiles = this.filePickerBean.getUploadedFiles();
|
final NodeRef[] uploadedFiles = this.filePickerBean.getUploadedFiles();
|
||||||
final List<AVMDifference> diffList =
|
final List<AVMDifference> diffList =
|
||||||
new ArrayList<AVMDifference>(1 + this.renditions.size() + uploadedFiles.length);
|
new ArrayList<AVMDifference>(1 + this.renditions.size() + uploadedFiles.length);
|
||||||
@@ -400,6 +392,7 @@ public class CreateWebContentWizard extends BaseContentWizard
|
|||||||
/**
|
/**
|
||||||
* Save the specified content using the currently set wizard attributes
|
* Save the specified content using the currently set wizard attributes
|
||||||
*/
|
*/
|
||||||
|
@SuppressWarnings("unchecked")
|
||||||
protected void saveContent()
|
protected void saveContent()
|
||||||
throws Exception
|
throws Exception
|
||||||
{
|
{
|
||||||
@@ -474,9 +467,21 @@ public class CreateWebContentWizard extends BaseContentWizard
|
|||||||
}
|
}
|
||||||
catch (Exception e)
|
catch (Exception e)
|
||||||
{
|
{
|
||||||
Utils.addErrorMessage("Error generating rendition using " + ret.getName() +
|
// TODO - improve error handling, e.g. render could return list of errors rather than splitting on newline character
|
||||||
": " + e.getMessage(),
|
StringTokenizer st = new StringTokenizer(e.getMessage(), "\n");
|
||||||
e);
|
if (st.hasMoreElements())
|
||||||
|
{
|
||||||
|
Utils.addErrorMessage("Error generating rendition using " + ret.getName() + ": " + st.nextToken(), e);
|
||||||
|
while (st.hasMoreElements())
|
||||||
|
{
|
||||||
|
Utils.addErrorMessage(st.nextToken(), e);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
Utils.addErrorMessage("Error generating rendition using " + ret.getName() +
|
||||||
|
": " + e.getMessage(), e);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -675,6 +680,7 @@ public class CreateWebContentWizard extends BaseContentWizard
|
|||||||
/**
|
/**
|
||||||
* Returns the files uploaded using the form
|
* Returns the files uploaded using the form
|
||||||
*/
|
*/
|
||||||
|
@SuppressWarnings("unchecked")
|
||||||
public List<UIListItem> getUploadedFiles()
|
public List<UIListItem> getUploadedFiles()
|
||||||
{
|
{
|
||||||
if (this.formProcessorSession == null)
|
if (this.formProcessorSession == null)
|
||||||
|
@@ -22,11 +22,17 @@
|
|||||||
* http://www.alfresco.com/legal/licensing" */
|
* http://www.alfresco.com/legal/licensing" */
|
||||||
package org.alfresco.web.forms;
|
package org.alfresco.web.forms;
|
||||||
|
|
||||||
import java.io.*;
|
import java.io.IOException;
|
||||||
import java.net.URI;
|
import java.io.InputStream;
|
||||||
import java.net.URISyntaxException;
|
import java.io.OutputStream;
|
||||||
import java.util.*;
|
import java.util.Arrays;
|
||||||
import javax.xml.parsers.DocumentBuilder;
|
import java.util.HashMap;
|
||||||
|
import java.util.HashSet;
|
||||||
|
import java.util.LinkedList;
|
||||||
|
import java.util.List;
|
||||||
|
import java.util.Map;
|
||||||
|
import java.util.Set;
|
||||||
|
|
||||||
import javax.xml.transform.ErrorListener;
|
import javax.xml.transform.ErrorListener;
|
||||||
import javax.xml.transform.Result;
|
import javax.xml.transform.Result;
|
||||||
import javax.xml.transform.Source;
|
import javax.xml.transform.Source;
|
||||||
@@ -36,29 +42,22 @@ import javax.xml.transform.TransformerException;
|
|||||||
import javax.xml.transform.TransformerFactory;
|
import javax.xml.transform.TransformerFactory;
|
||||||
import javax.xml.transform.URIResolver;
|
import javax.xml.transform.URIResolver;
|
||||||
import javax.xml.transform.dom.DOMSource;
|
import javax.xml.transform.dom.DOMSource;
|
||||||
import javax.xml.transform.sax.TransformerHandler;
|
|
||||||
import javax.xml.transform.stream.StreamResult;
|
import javax.xml.transform.stream.StreamResult;
|
||||||
import javax.xml.transform.stream.StreamSource;
|
|
||||||
import org.alfresco.service.cmr.repository.NodeRef;
|
|
||||||
import org.alfresco.service.cmr.repository.NodeService;
|
|
||||||
import org.alfresco.service.namespace.NamespaceService;
|
|
||||||
import org.alfresco.service.namespace.QName;
|
import org.alfresco.service.namespace.QName;
|
||||||
import org.alfresco.web.bean.wcm.AVMUtil;
|
import org.apache.bsf.BSFManager;
|
||||||
import org.alfresco.web.forms.XMLUtil;
|
|
||||||
import org.apache.commons.lang.StringUtils;
|
import org.apache.commons.lang.StringUtils;
|
||||||
import org.apache.commons.logging.Log;
|
import org.apache.commons.logging.Log;
|
||||||
import org.apache.commons.logging.LogFactory;
|
import org.apache.commons.logging.LogFactory;
|
||||||
import org.apache.xalan.extensions.ExpressionContext;
|
|
||||||
import org.apache.xpath.objects.XObject;
|
|
||||||
import org.apache.xml.dtm.ref.DTMNodeProxy;
|
import org.apache.xml.dtm.ref.DTMNodeProxy;
|
||||||
import org.apache.xml.utils.Constants;
|
import org.apache.xml.utils.Constants;
|
||||||
|
import org.w3c.dom.DOMException;
|
||||||
//import org.apache.xml.utils.QName;
|
import org.w3c.dom.Document;
|
||||||
import org.w3c.dom.*;
|
import org.w3c.dom.Element;
|
||||||
|
import org.w3c.dom.Node;
|
||||||
import org.w3c.dom.traversal.NodeFilter;
|
import org.w3c.dom.traversal.NodeFilter;
|
||||||
import org.w3c.dom.traversal.NodeIterator;
|
import org.w3c.dom.traversal.NodeIterator;
|
||||||
import org.xml.sax.SAXException;
|
import org.xml.sax.SAXException;
|
||||||
import org.apache.bsf.BSFManager;
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* A rendering engine which uses xsl templates to render renditions of
|
* A rendering engine which uses xsl templates to render renditions of
|
||||||
@@ -473,7 +472,24 @@ public class XSLTRenderingEngine
|
|||||||
final TransformerFactory tf = TransformerFactory.newInstance();
|
final TransformerFactory tf = TransformerFactory.newInstance();
|
||||||
tf.setErrorListener(errorListener);
|
tf.setErrorListener(errorListener);
|
||||||
tf.setURIResolver(uriResolver);
|
tf.setURIResolver(uriResolver);
|
||||||
|
|
||||||
|
if (LOGGER.isDebugEnabled())
|
||||||
|
{
|
||||||
|
LOGGER.debug("xslTemplate: \n" + XMLUtil.toString(xslTemplate));
|
||||||
|
}
|
||||||
|
|
||||||
t = tf.newTransformer(new DOMSource(xslTemplate));
|
t = tf.newTransformer(new DOMSource(xslTemplate));
|
||||||
|
|
||||||
|
if (errors.size() != 0)
|
||||||
|
{
|
||||||
|
final StringBuilder msg = new StringBuilder("errors encountered creating tranformer ... \n");
|
||||||
|
for (TransformerException te : errors)
|
||||||
|
{
|
||||||
|
msg.append(te.getMessageAndLocation()).append("\n");
|
||||||
|
}
|
||||||
|
throw new RenderingEngine.RenderingException(msg.toString());
|
||||||
|
}
|
||||||
|
|
||||||
t.setErrorListener(errorListener);
|
t.setErrorListener(errorListener);
|
||||||
t.setURIResolver(uriResolver);
|
t.setURIResolver(uriResolver);
|
||||||
t.setParameter("versionParam", "2.0");
|
t.setParameter("versionParam", "2.0");
|
||||||
@@ -501,7 +517,7 @@ public class XSLTRenderingEngine
|
|||||||
|
|
||||||
if (errors.size() != 0)
|
if (errors.size() != 0)
|
||||||
{
|
{
|
||||||
final StringBuilder msg = new StringBuilder("errors encountered during transformation: \n");
|
final StringBuilder msg = new StringBuilder("errors encountered during transformation ... \n");
|
||||||
for (TransformerException te : errors)
|
for (TransformerException te : errors)
|
||||||
{
|
{
|
||||||
msg.append(te.getMessageAndLocation()).append("\n");
|
msg.append(te.getMessageAndLocation()).append("\n");
|
||||||
|
Reference in New Issue
Block a user