WCM - fix ETHREEOH-569, ETHREEOH-571, ETHREEOH-3123 (after deleting web form)

git-svn-id: https://svn.alfresco.com/repos/alfresco-enterprise/alfresco/HEAD/root@17116 c4b6b30b-aa2e-2d43-bbcb-ca4b014f7261
This commit is contained in:
Jan Vonka
2009-10-23 11:04:11 +00:00
parent ee18156073
commit 9aadc8f493
6 changed files with 211 additions and 89 deletions

View File

@@ -1261,7 +1261,9 @@ public class AVMBrowseBean implements IContextListener
results = getSearchService().query(sp); results = getSearchService().query(sp);
if (logger.isDebugEnabled()) if (logger.isDebugEnabled())
{
logger.debug("Search results returned: " + results.length()); logger.debug("Search results returned: " + results.length());
}
// filter hidden folders above the web app // filter hidden folders above the web app
boolean isStagingStore = getIsStagingStore(); boolean isStagingStore = getIsStagingStore();
@@ -1539,8 +1541,10 @@ public class AVMBrowseBean implements IContextListener
/*package*/ void setupContentAction(String path, boolean refresh) /*package*/ void setupContentAction(String path, boolean refresh)
{ {
if (logger.isDebugEnabled()) if (logger.isDebugEnabled())
{
logger.debug("Setup content action for path: " + path); logger.debug("Setup content action for path: " + path);
}
if (path == null || path.length() == 0) if (path == null || path.length() == 0)
{ {
setAvmActionNode(null); setAvmActionNode(null);
@@ -1608,28 +1612,39 @@ public class AVMBrowseBean implements IContextListener
if (getAvmService().hasAspect(-1, avmPath, WCMAppModel.ASPECT_RENDITION)) if (getAvmService().hasAspect(-1, avmPath, WCMAppModel.ASPECT_RENDITION))
{ {
if (logger.isDebugEnabled()) if (logger.isDebugEnabled())
{
logger.debug(avmPath + " is a rendition, editing primary rendition instead"); logger.debug(avmPath + " is a rendition, editing primary rendition instead");
}
try try
{ {
final FormInstanceData fid = this.getFormsService().getRendition(-1, avmPath).getPrimaryFormInstanceData(); final FormInstanceData fid = this.getFormsService().getRendition(-1, avmPath).getPrimaryFormInstanceData();
avmPath = fid.getPath(); avmPath = fid.getPath();
if (logger.isDebugEnabled()) if (logger.isDebugEnabled())
{
logger.debug("Editing primary form instance data " + avmPath); logger.debug("Editing primary form instance data " + avmPath);
}
this.setAvmActionNode(new AVMNode(getAvmService().lookup(-1, avmPath))); this.setAvmActionNode(new AVMNode(getAvmService().lookup(-1, avmPath)));
} }
catch (IllegalArgumentException iae)
{
//Utils.addErrorMessage(iae.getMessage(), iae);
logger.warn(iae);
}
catch (FileNotFoundException fnfe) catch (FileNotFoundException fnfe)
{ {
getAvmService().removeAspect(avmPath, WCMAppModel.ASPECT_RENDITION); //Utils.addErrorMessage(fnfe.getMessage(), fnfe);
getAvmService().removeAspect(avmPath, WCMAppModel.ASPECT_FORM_INSTANCE_DATA); logger.warn(fnfe);
Utils.addErrorMessage(fnfe.getMessage(), fnfe);
} }
} }
if (logger.isDebugEnabled()) if (logger.isDebugEnabled())
{
logger.debug("Editing AVM node: " + avmPath); logger.debug("Editing AVM node: " + avmPath);
}
String outcome = null; String outcome = null;
// calculate which editor screen to display // calculate which editor screen to display
if (getAvmService().hasAspect(-1, avmPath, WCMAppModel.ASPECT_FORM_INSTANCE_DATA)) if (getAvmService().hasAspect(-1, avmPath, WCMAppModel.ASPECT_FORM_INSTANCE_DATA))
@@ -1645,12 +1660,14 @@ public class AVMBrowseBean implements IContextListener
} }
catch (FormNotFoundException fnfe) catch (FormNotFoundException fnfe)
{ {
logger.debug(fnfe.getMessage(), fnfe); //Utils.addErrorMessage(fnfe.getMessage(), fnfe);
logger.warn(fnfe);
final Map<String, String> params = new HashMap<String, String>(2, 1.0f); final Map<String, String> params = new HashMap<String, String>(2, 1.0f);
params.put("finishOutcome", "wizard:editWebContent"); params.put("finishOutcome", "wizard:editWebContent");
params.put("cancelOutcome", "dialog:editAvmFile"); params.put("cancelOutcome", "dialog:editAvmFile");
Application.getDialogManager().setupParameters(params); Application.getDialogManager().setupParameters(params);
outcome = "dialog:promptForWebForm"; outcome = "dialog:promptForWebForm";
} }
} }
@@ -1663,8 +1680,11 @@ public class AVMBrowseBean implements IContextListener
this.getAvmService().forceCopy(avmPath); this.getAvmService().forceCopy(avmPath);
} }
logger.debug("outcome " + outcome + " for path " + path); if (logger.isDebugEnabled())
{
logger.debug("outcome " + outcome + " for path " + path);
}
FacesContext fc = FacesContext.getCurrentInstance(); FacesContext fc = FacesContext.getCurrentInstance();
fc.getApplication().getNavigationHandler().handleNavigation(fc, null, outcome); fc.getApplication().getNavigationHandler().handleNavigation(fc, null, outcome);
} }

View File

@@ -181,6 +181,15 @@ public class PromptForWebFormDialog extends BaseDialogBean
} }
} }
@Override
public String cancel()
{
getAvmService().removeAspect(this.getAvmNode().getPath(), WCMAppModel.ASPECT_RENDITION);
getAvmService().removeAspect(this.getAvmNode().getPath(), WCMAppModel.ASPECT_FORM_INSTANCE_DATA);
return super.cancel();
}
@Override @Override
protected String finishImpl(final FacesContext context, String outcome) protected String finishImpl(final FacesContext context, String outcome)
throws Exception throws Exception

View File

@@ -1,5 +1,5 @@
/* /*
* Copyright (C) 2005-2007 Alfresco Software Limited. * Copyright (C) 2005-2009 Alfresco Software Limited.
* *
* This program is free software; you can redistribute it and/or * This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License * modify it under the terms of the GNU General Public License
@@ -62,6 +62,7 @@ import org.alfresco.web.forms.FormsService;
import org.alfresco.web.forms.RenderingEngineTemplate; import org.alfresco.web.forms.RenderingEngineTemplate;
import org.alfresco.web.forms.RenderingEngineTemplateImpl; import org.alfresco.web.forms.RenderingEngineTemplateImpl;
import org.alfresco.web.forms.Rendition; import org.alfresco.web.forms.Rendition;
import org.alfresco.web.forms.RenderingEngine.TemplateNotFoundException;
import org.alfresco.web.ui.common.Utils; import org.alfresco.web.ui.common.Utils;
import org.alfresco.web.ui.common.component.UIListItem; import org.alfresco.web.ui.common.component.UIListItem;
import org.alfresco.web.ui.common.component.UIListItems; import org.alfresco.web.ui.common.component.UIListItems;
@@ -82,7 +83,7 @@ public class RegenerateRenditionsWizard
public final String REGENERATE_SCOPE_FORM = "form"; public final String REGENERATE_SCOPE_FORM = "form";
public final String REGENERATE_SCOPE_RENDERING_ENGINE_TEMPLATE = "rendering_engine_template"; public final String REGENERATE_SCOPE_RENDERING_ENGINE_TEMPLATE = "rendering_engine_template";
private final static Log LOGGER = LogFactory.getLog(RegenerateRenditionsWizard.class); private final static Log logger = LogFactory.getLog(RegenerateRenditionsWizard.class);
transient protected WebProjectService wpService; transient protected WebProjectService wpService;
transient private AVMLockingService avmLockingService; transient private AVMLockingService avmLockingService;
@@ -114,8 +115,12 @@ public class RegenerateRenditionsWizard
-1, AVMUtil.getCorrespondingPathInMainStore(r.getPath()), -1, AVMUtil.getCorrespondingPathInMainStore(r.getPath()),
AVMDifference.NEWER)); AVMDifference.NEWER));
} }
if (LOGGER.isDebugEnabled())
LOGGER.debug("updating " + diffList.size() + " renditions in staging"); if (logger.isDebugEnabled())
{
logger.debug("updating " + diffList.size() + " renditions in staging");
}
getAvmSyncService().update(diffList, null, true, true, true, true, null, null); getAvmSyncService().update(diffList, null, true, true, true, true, null, null);
String description = null; String description = null;
final ResourceBundle bundle = Application.getBundle(FacesContext.getCurrentInstance()); final ResourceBundle bundle = Application.getBundle(FacesContext.getCurrentInstance());
@@ -488,8 +493,11 @@ public class RegenerateRenditionsWizard
query.append(" +@" + Repository.escapeQName(WCMAppModel.PROP_PARENT_FORM_NAME) + query.append(" +@" + Repository.escapeQName(WCMAppModel.PROP_PARENT_FORM_NAME) +
":\"" + f.getName() + "\""); ":\"" + f.getName() + "\"");
if (LOGGER.isDebugEnabled()) if (logger.isDebugEnabled())
LOGGER.debug("running query " + query); {
logger.debug("running query " + query);
}
sp.setQuery(query.toString()); sp.setQuery(query.toString());
final ResultSet rs = getSearchService().query(sp); final ResultSet rs = getSearchService().query(sp);
try try
@@ -520,8 +528,12 @@ public class RegenerateRenditionsWizard
query.append("+ASPECT:\"" + WCMAppModel.ASPECT_RENDITION + "\""); query.append("+ASPECT:\"" + WCMAppModel.ASPECT_RENDITION + "\"");
query.append(" +@" + Repository.escapeQName(WCMAppModel.PROP_PARENT_RENDERING_ENGINE_TEMPLATE) + query.append(" +@" + Repository.escapeQName(WCMAppModel.PROP_PARENT_RENDERING_ENGINE_TEMPLATE) +
":\"" + ((RenderingEngineTemplateImpl)ret).getNodeRef() + "\""); ":\"" + ((RenderingEngineTemplateImpl)ret).getNodeRef() + "\"");
if (LOGGER.isDebugEnabled())
LOGGER.debug("running query " + query); if (logger.isDebugEnabled())
{
logger.debug("running query " + query);
}
sp.setQuery(query.toString()); sp.setQuery(query.toString());
final ResultSet rs = getSearchService().query(sp); final ResultSet rs = getSearchService().query(sp);
try try
@@ -585,14 +597,17 @@ public class RegenerateRenditionsWizard
query.append(" +("); query.append(" +(");
for (int i = 0; i < this.selectedRenderingEngineTemplates.length; i++) for (int i = 0; i < this.selectedRenderingEngineTemplates.length; i++)
{ {
String[] parts = this.selectedRenderingEngineTemplates[i].split(":");
String formName = parts[0];
String templateName = parts[1];
try try
{ {
final String formName = this.selectedRenderingEngineTemplates[i].split(":")[0]; Form f = this.selectedWebProject.getForm(formName);
final Form f = this.selectedWebProject.getForm(formName); RenderingEngineTemplate ret =
final RenderingEngineTemplate ret = f.getRenderingEngineTemplate(templateName);
f.getRenderingEngineTemplate((String)this.selectedRenderingEngineTemplates[i].split(":")[1]);
query.append("@" + Repository.escapeQName(WCMAppModel.PROP_PARENT_RENDERING_ENGINE_TEMPLATE) + query.append("@" + Repository.escapeQName(WCMAppModel.PROP_PARENT_RENDERING_ENGINE_TEMPLATE) +
":\"" + ((RenderingEngineTemplateImpl)ret).getNodeRef() + "\""); ":\"" + ((RenderingEngineTemplateImpl)ret).getNodeRef() + "\"");
if (i != this.selectedRenderingEngineTemplates.length - 1) if (i != this.selectedRenderingEngineTemplates.length - 1)
{ {
query.append(" OR "); query.append(" OR ");
@@ -600,22 +615,26 @@ public class RegenerateRenditionsWizard
} }
catch (FormNotFoundException fnfe) catch (FormNotFoundException fnfe)
{ {
if (LOGGER.isDebugEnabled()) logger.warn("regenerating renditions of template " + templateName + ": " + fnfe.getMessage(), fnfe);
LOGGER.debug(fnfe);
} }
} }
query.append(") "); query.append(") ");
} }
if (LOGGER.isDebugEnabled()) if (logger.isDebugEnabled())
LOGGER.debug("running query " + query); {
logger.debug("running query " + query);
}
sp.setQuery(query.toString()); sp.setQuery(query.toString());
final ResultSet rs = getSearchService().query(sp); final ResultSet rs = getSearchService().query(sp);
try try
{ {
if (LOGGER.isDebugEnabled()) if (logger.isDebugEnabled())
LOGGER.debug("received " + rs.length() + " results"); {
logger.debug("received " + rs.length() + " results");
}
final List<Rendition> result = new ArrayList<Rendition>(rs.length()); final List<Rendition> result = new ArrayList<Rendition>(rs.length());
for (final ResultSetRow row : rs) for (final ResultSetRow row : rs)
{ {
@@ -650,9 +669,7 @@ public class RegenerateRenditionsWizard
} }
catch (FormNotFoundException fnfe) catch (FormNotFoundException fnfe)
{ {
Utils.addErrorMessage("error regenerating renditions of " + fid.getPath() + logger.warn("regenerating renditions of " + fid.getPath() + ": " + fnfe.getMessage(), fnfe);
": " + fnfe.getMessage(),
fnfe);
} }
} }
else else
@@ -663,6 +680,14 @@ public class RegenerateRenditionsWizard
r.regenerate(); r.regenerate();
result.add(r); result.add(r);
} }
catch (TemplateNotFoundException tnfe)
{
logger.warn("regenerating renditions of " + previewAvmPath + ": " + tnfe.getMessage(), tnfe);
}
catch (IllegalArgumentException iae)
{
logger.warn("regenerating renditions of " + previewAvmPath + ": " + iae.getMessage(), iae);
}
catch (Exception e) catch (Exception e)
{ {
Utils.addErrorMessage("error regenerating rendition using " + Utils.addErrorMessage("error regenerating rendition using " +

View File

@@ -66,7 +66,9 @@ import org.alfresco.web.app.servlet.FacesHelper;
import org.alfresco.web.bean.BrowseBean; import org.alfresco.web.bean.BrowseBean;
import org.alfresco.web.bean.dialog.BaseDialogBean; import org.alfresco.web.bean.dialog.BaseDialogBean;
import org.alfresco.web.bean.repository.Repository; import org.alfresco.web.bean.repository.Repository;
import org.alfresco.web.forms.Form;
import org.alfresco.web.forms.FormInstanceData; import org.alfresco.web.forms.FormInstanceData;
import org.alfresco.web.forms.FormNotFoundException;
import org.alfresco.web.forms.FormsService; import org.alfresco.web.forms.FormsService;
import org.alfresco.web.forms.Rendition; import org.alfresco.web.forms.Rendition;
import org.alfresco.web.ui.common.Utils; import org.alfresco.web.ui.common.Utils;
@@ -751,6 +753,7 @@ public class SubmitDialog extends BaseDialogBean
this.submitItems.add(new ItemWrapper(node)); this.submitItems.add(new ItemWrapper(node));
submittedPaths.add(node.getPath()); submittedPaths.add(node.getPath());
} }
// lookup if this item was created via a form - then lookup the workflow defaults // lookup if this item was created via a form - then lookup the workflow defaults
// for that form and store into the list of available workflows // for that form and store into the list of available workflows
else if (!getNodeService().hasAspect(ref, WCMAppModel.ASPECT_FORM_INSTANCE_DATA)) else if (!getNodeService().hasAspect(ref, WCMAppModel.ASPECT_FORM_INSTANCE_DATA))
@@ -773,14 +776,27 @@ public class SubmitDialog extends BaseDialogBean
{ {
fid = getFormsService().getFormInstanceData(ref); fid = getFormsService().getFormInstanceData(ref);
} }
// check form's default workflow (if any)
Form f = null;
try
{
f = fid.getForm();
}
catch (FormNotFoundException fnfe)
{
String formName = (String)getNodeService().getProperty(ref, WCMAppModel.PROP_PARENT_FORM_NAME);
logger.warn("Cannot check default workflow (if any) for missing form '"+formName+"' (may have been deleted) - when submitting '"+node.getPath()+"'");
//Utils.addErrorMessage(fnfe.getMessage(), fnfe);
}
// add the form instance data file to the list for submission // add the form instance data file to the list for submission
if (!submittedPaths.contains(fid.getPath())) if (!submittedPaths.contains(fid.getPath()))
{ {
this.submitItems.add(new ItemWrapper(getAvmService().lookup(-1, fid.getPath()))); this.submitItems.add(new ItemWrapper(getAvmService().lookup(-1, fid.getPath())));
submittedPaths.add(fid.getPath()); submittedPaths.add(fid.getPath());
} }
// locate renditions for this form instance data file and add to list for submission // locate renditions for this form instance data file and add to list for submission
for (final Rendition rendition : fid.getRenditions()) for (final Rendition rendition : fid.getRenditions())
{ {
@@ -791,11 +807,15 @@ public class SubmitDialog extends BaseDialogBean
submittedPaths.add(renditionPath); submittedPaths.add(renditionPath);
} }
} }
WorkflowDefinition defaultWfDef = fid.getForm().getDefaultWorkflow();
if (defaultWfDef != null) if (f != null)
{ {
this.workflows.add(new FormWorkflowWrapper(defaultWfDef.getName(), WorkflowDefinition defaultWfDef = f.getDefaultWorkflow();
fid.getForm().getDefaultWorkflowParameters())); if (defaultWfDef != null)
{
this.workflows.add(new FormWorkflowWrapper(defaultWfDef.getName(),
f.getDefaultWorkflowParameters()));
}
} }
// See WCM-1090 ACT-1551 // See WCM-1090 ACT-1551

View File

@@ -1,5 +1,5 @@
/* /*
* Copyright (C) 2005-2007 Alfresco Software Limited. * Copyright (C) 2005-2009 Alfresco Software Limited.
* *
* This program is free software; you can redistribute it and/or * This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License * modify it under the terms of the GNU General Public License
@@ -22,14 +22,14 @@
* http://www.alfresco.com/legal/licensing" */ * http://www.alfresco.com/legal/licensing" */
package org.alfresco.web.forms; package org.alfresco.web.forms;
import org.alfresco.service.cmr.repository.NodeRef;
import org.alfresco.service.namespace.QName;
import java.io.InputStream;
import java.io.IOException; import java.io.IOException;
import java.io.InputStream;
import java.io.OutputStream; import java.io.OutputStream;
import java.io.Serializable; import java.io.Serializable;
import java.util.Map; import java.util.Map;
import org.w3c.dom.Document;
import org.alfresco.error.AlfrescoRuntimeException;
import org.alfresco.service.namespace.QName;
import org.xml.sax.SAXException; import org.xml.sax.SAXException;
/** /**
@@ -42,25 +42,40 @@ public interface RenderingEngine
{ {
///////////////////////////////////////////////////////////////////////////// /////////////////////////////////////////////////////////////////////////////
public static class RenderingException public static class RenderingException extends Exception
extends Exception
{ {
private static final long serialVersionUID = 6831222399250770060L;
public RenderingException(final String msg) public RenderingException(final String msg)
{ {
super(msg); super(msg);
} }
public RenderingException(final Exception cause) public RenderingException(final Exception cause)
{ {
super(cause); super(cause);
} }
public RenderingException(final String msg, final Exception cause) public RenderingException(final String msg, final Exception cause)
{ {
super(msg, cause); super(msg, cause);
} }
} }
public static class TemplateNotFoundException extends AlfrescoRuntimeException
{
private static final long serialVersionUID = 3232973289475043471L;
public TemplateNotFoundException(final String msg)
{
super(msg);
}
public TemplateNotFoundException(final String msg, final Exception cause)
{
super(msg, cause);
}
}
///////////////////////////////////////////////////////////////////////////// /////////////////////////////////////////////////////////////////////////////

View File

@@ -54,6 +54,7 @@ import org.alfresco.service.cmr.dictionary.DataTypeDefinition;
import org.alfresco.service.cmr.remote.AVMRemote; import org.alfresco.service.cmr.remote.AVMRemote;
import org.alfresco.service.cmr.repository.ContentReader; import org.alfresco.service.cmr.repository.ContentReader;
import org.alfresco.service.cmr.repository.ContentService; import org.alfresco.service.cmr.repository.ContentService;
import org.alfresco.service.cmr.repository.InvalidNodeRefException;
import org.alfresco.service.cmr.repository.NodeRef; import org.alfresco.service.cmr.repository.NodeRef;
import org.alfresco.service.cmr.repository.NodeService; import org.alfresco.service.cmr.repository.NodeService;
import org.alfresco.service.cmr.repository.TemplateException; import org.alfresco.service.cmr.repository.TemplateException;
@@ -68,6 +69,7 @@ import org.alfresco.web.app.Application;
import org.alfresco.web.app.servlet.FacesHelper; import org.alfresco.web.app.servlet.FacesHelper;
import org.alfresco.web.bean.repository.Repository; import org.alfresco.web.bean.repository.Repository;
import org.alfresco.web.bean.wcm.AVMUtil; import org.alfresco.web.bean.wcm.AVMUtil;
import org.alfresco.web.forms.RenderingEngine.TemplateNotFoundException;
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;
@@ -91,7 +93,7 @@ public class RenderingEngineTemplateImpl
{ {
private static final long serialVersionUID = -1656812676972437532L; private static final long serialVersionUID = -1656812676972437532L;
private static final Log LOGGER = LogFactory.getLog(RenderingEngineTemplateImpl.class); private static final Log logger = LogFactory.getLog(RenderingEngineTemplateImpl.class);
private static final DynamicNamespacePrefixResolver namespacePrefixResolver = private static final DynamicNamespacePrefixResolver namespacePrefixResolver =
new DynamicNamespacePrefixResolver(); new DynamicNamespacePrefixResolver();
@@ -192,10 +194,17 @@ public class RenderingEngineTemplateImpl
*/ */
public RenderingEngine getRenderingEngine() public RenderingEngine getRenderingEngine()
{ {
final NodeService nodeService = this.getServiceRegistry().getNodeService(); NodeService nodeService = this.getServiceRegistry().getNodeService();
final String renderingEngineName = (String) String renderingEngineName = null;
nodeService.getProperty(this.nodeRef, try
WCMAppModel.PROP_PARENT_RENDERING_ENGINE_NAME); {
renderingEngineName = (String)nodeService.getProperty(this.nodeRef, WCMAppModel.PROP_PARENT_RENDERING_ENGINE_NAME);
}
catch (InvalidNodeRefException e)
{
logger.warn("RenderingEngineTemplate not found: "+e);
throw new TemplateNotFoundException("RenderingEngineTemplate not found", e);
}
return this.getFormsService().getRenderingEngine(renderingEngineName); return this.getFormsService().getRenderingEngine(renderingEngineName);
} }
@@ -236,7 +245,7 @@ public class RenderingEngineTemplateImpl
} }
catch (Exception e) catch (Exception e)
{ {
LOGGER.error(e); logger.error(e);
throw new AlfrescoRuntimeException(e.getMessage(), e); throw new AlfrescoRuntimeException(e.getMessage(), e);
} }
final String parentAVMPath = AVMNodeConverter.SplitBase(formInstanceDataAVMPath)[0]; final String parentAVMPath = AVMNodeConverter.SplitBase(formInstanceDataAVMPath)[0];
@@ -257,7 +266,7 @@ public class RenderingEngineTemplateImpl
} }
catch (final TemplateException te) catch (final TemplateException te)
{ {
LOGGER.error(te.getMessage(), te); logger.error(te.getMessage(), te);
throw new AlfrescoRuntimeException("Error processing output path pattern " + outputPathPattern + throw new AlfrescoRuntimeException("Error processing output path pattern " + outputPathPattern +
" for " + formInstanceDataName + " for " + formInstanceDataName +
" in webapp " + webappName + " in webapp " + webappName +
@@ -268,8 +277,11 @@ public class RenderingEngineTemplateImpl
result = AVMUtil.buildPath(parentAVMPath, result = AVMUtil.buildPath(parentAVMPath,
result, result,
AVMUtil.PathRelation.SANDBOX_RELATIVE); AVMUtil.PathRelation.SANDBOX_RELATIVE);
if (LOGGER.isDebugEnabled())
LOGGER.debug("processed pattern " + outputPathPattern + " as " + result); if (logger.isDebugEnabled())
{
logger.debug("processed pattern " + outputPathPattern + " as " + result);
}
return result; return result;
} }
@@ -299,9 +311,9 @@ public class RenderingEngineTemplateImpl
avmService.createFile(parentAVMPath, avmService.createFile(parentAVMPath,
AVMNodeConverter.SplitBase(renditionAvmPath)[1]); AVMNodeConverter.SplitBase(renditionAvmPath)[1]);
if (LOGGER.isDebugEnabled()) if (logger.isDebugEnabled())
{ {
LOGGER.debug("Created file node for file: " + renditionAvmPath); logger.debug("Created file node for file: " + renditionAvmPath);
} }
avmService.addAspect(renditionAvmPath, ContentModel.ASPECT_TITLED); avmService.addAspect(renditionAvmPath, ContentModel.ASPECT_TITLED);
@@ -346,10 +358,16 @@ public class RenderingEngineTemplateImpl
SAXException, SAXException,
RenderingEngine.RenderingException RenderingEngine.RenderingException
{ {
RenderingEngine re = this.getRenderingEngine();
if (re == null)
{
return;
}
final OutputStream out = rendition.getOutputStream(); final OutputStream out = rendition.getOutputStream();
try try
{ {
this.getRenderingEngine().render(this.buildModel(formInstanceData, rendition), re.render(this.buildModel(formInstanceData, rendition),
this, this,
out); out);
} }
@@ -418,12 +436,14 @@ public class RenderingEngineTemplateImpl
RenderingEngineTemplateImpl.this.getServiceRegistry().getNodeService(); RenderingEngineTemplateImpl.this.getServiceRegistry().getNodeService();
final NodeRef parentNodeRef = final NodeRef parentNodeRef =
nodeService.getPrimaryParent(RenderingEngineTemplateImpl.this.getNodeRef()).getParentRef(); nodeService.getPrimaryParent(RenderingEngineTemplateImpl.this.getNodeRef()).getParentRef();
if (LOGGER.isDebugEnabled())
if (logger.isDebugEnabled())
{ {
LOGGER.debug("request to resolve resource " + name + logger.debug("request to resolve resource " + name +
" webapp url is " + webappUrl + " webapp url is " + webappUrl +
" and data dictionary workspace is " + parentNodeRef); " and data dictionary workspace is " + parentNodeRef);
} }
final NodeRef result = nodeService.getChildByName(parentNodeRef, ContentModel.ASSOC_CONTAINS, name); final NodeRef result = nodeService.getChildByName(parentNodeRef, ContentModel.ASSOC_CONTAINS, name);
if (result != null) if (result != null)
{ {
@@ -431,14 +451,16 @@ public class RenderingEngineTemplateImpl
RenderingEngineTemplateImpl.this.getServiceRegistry().getContentService(); RenderingEngineTemplateImpl.this.getServiceRegistry().getContentService();
try try
{ {
if (LOGGER.isDebugEnabled()) if (logger.isDebugEnabled())
LOGGER.debug("found " + name + " in data dictonary: " + result); {
logger.debug("found " + name + " in data dictonary: " + result);
}
return contentService.getReader(result, ContentModel.PROP_CONTENT).getContentInputStream(); return contentService.getReader(result, ContentModel.PROP_CONTENT).getContentInputStream();
} }
catch (Exception e) catch (Exception e)
{ {
LOGGER.debug(e); logger.warn(e);
} }
} }
@@ -487,19 +509,20 @@ public class RenderingEngineTemplateImpl
request.getContextPath() + "/wcservice/" + request.getContextPath() + "/wcservice/" +
rewrittenName); rewrittenName);
if (LOGGER.isDebugEnabled()) if (logger.isDebugEnabled())
LOGGER.debug("loading webscript: " + webscriptURI); {
logger.debug("loading webscript: " + webscriptURI);
}
final URI uri = new URI(webscriptURI); final URI uri = new URI(webscriptURI);
return uri.toURL().openStream(); return uri.toURL().openStream();
} }
catch (Exception e) catch (Exception e)
{ {
if (LOGGER.isDebugEnabled()) logger.warn(e);
LOGGER.debug(e);
} }
} }
try try
{ {
final String[] path = (name.startsWith("/") ? name.substring(1) : name).split("/"); final String[] path = (name.startsWith("/") ? name.substring(1) : name).split("/");
@@ -510,16 +533,16 @@ public class RenderingEngineTemplateImpl
final URI uri = new URI(webappUrl + '/' + StringUtils.join(path, '/')); final URI uri = new URI(webappUrl + '/' + StringUtils.join(path, '/'));
if (LOGGER.isDebugEnabled()) if (logger.isDebugEnabled())
LOGGER.debug("loading " + uri); {
logger.debug("loading " + uri);
}
return uri.toURL().openStream(); return uri.toURL().openStream();
} }
catch (Exception e) catch (Exception e)
{ {
if (LOGGER.isDebugEnabled()) logger.warn(e);
LOGGER.debug(e);
return null; return null;
} }
} }
@@ -567,8 +590,10 @@ public class RenderingEngineTemplateImpl
} }
String text = (String)arguments[0]; String text = (String)arguments[0];
if (LOGGER.isDebugEnabled()) if (logger.isDebugEnabled())
LOGGER.debug("tpm_encodeQuotes('" + text + "'), parentPath = " + parentPath); {
logger.debug("tpm_encodeQuotes('" + text + "'), parentPath = " + parentPath);
}
final String result = fdf.encodeQuotes(text); final String result = fdf.encodeQuotes(text);
return result; return result;
@@ -601,8 +626,10 @@ public class RenderingEngineTemplateImpl
path, path,
AVMUtil.PathRelation.WEBAPP_RELATIVE); AVMUtil.PathRelation.WEBAPP_RELATIVE);
if (LOGGER.isDebugEnabled()) if (logger.isDebugEnabled())
LOGGER.debug("tpm_parseXMLDocument('" + path + "'), parentPath = " + parentPath); {
logger.debug("tpm_parseXMLDocument('" + path + "'), parentPath = " + parentPath);
}
final Document d = fdf.parseXMLDocument(path); final Document d = fdf.parseXMLDocument(path);
return d != null ? d.getDocumentElement() : null; return d != null ? d.getDocumentElement() : null;
@@ -640,17 +667,21 @@ public class RenderingEngineTemplateImpl
AVMUtil.PathRelation.WEBAPP_RELATIVE); AVMUtil.PathRelation.WEBAPP_RELATIVE);
final String formName = (String)arguments[0]; final String formName = (String)arguments[0];
if (LOGGER.isDebugEnabled()) if (logger.isDebugEnabled())
LOGGER.debug("tpm_parseXMLDocuments('" + formName + "','" + path + {
logger.debug("tpm_parseXMLDocuments('" + formName + "','" + path +
"'), parentPath = " + parentPath); "'), parentPath = " + parentPath);
}
final Map<String, Document> resultMap = fdf.parseXMLDocuments(formName, path); final Map<String, Document> resultMap = fdf.parseXMLDocuments(formName, path);
if (LOGGER.isDebugEnabled()) if (logger.isDebugEnabled())
LOGGER.debug("received " + resultMap.size() + {
logger.debug("received " + resultMap.size() +
" documents in " + path + " documents in " + path +
" with form name " + formName); " with form name " + formName);
}
// create a root document for rooting all the results. we do this // create a root document for rooting all the results. we do this
// so that each document root element has a common parent node // so that each document root element has a common parent node
// and so that xpath axes work properly // and so that xpath axes work properly
@@ -698,8 +729,10 @@ public class RenderingEngineTemplateImpl
final String path = (String)arguments[0]; final String path = (String)arguments[0];
if (LOGGER.isDebugEnabled()) if (logger.isDebugEnabled())
LOGGER.debug("tpm_getAVMPAth('" + path + "'), parentPath = " + parentPath); {
logger.debug("tpm_getAVMPAth('" + path + "'), parentPath = " + parentPath);
}
return AVMUtil.buildPath(parentPath, return AVMUtil.buildPath(parentPath,
path, path,