- moving generic xml parsing utilities out of FormsService and into their own class

- refactoring to generate and regenerate methods to make it easier to use project level overridden properties, and to at some point (soon) make it possible to make error handling for rendering engines more robust
- added a web project object to encapsulate web project properties and provide a central location for getting forms and rendering engines with web project level overridden properties
- made select default workflow screen match wireframes
- using the same workflowdefault type in the wcm model for web projects and forms.
- using outputpathpattern aspect consistently
- using commons.io to parse paths
- using form name rather than noderef as parameter for selected form from content forms dashlet
- fixed bug where rendition properties noderef wasn't being properly associated with renditions causing problems with regenerate
- using multivalued properties to track renditions
- remove weird registerRendition/registerFormInstanceData calls.  no longer necessary since generateRendition and regenerate are done within forminstancedata and rendition
- adding default workflow parameters as property of Form
- adding a unique name property to rendering engine templates to allow for looking one up by name


git-svn-id: https://svn.alfresco.com/repos/alfresco-enterprise/alfresco/HEAD/root@4702 c4b6b30b-aa2e-2d43-bbcb-ca4b014f7261
This commit is contained in:
Ariel Backenroth
2006-12-31 08:45:42 +00:00
parent 21a73db5bd
commit a25d85ee83
43 changed files with 1546 additions and 1103 deletions

View File

@@ -45,6 +45,7 @@ no_icons_found=No icons found
# UI Component messages
yes=Yes
no=No
no_not_now=No not now
kilobyte=KB
megabyte=MB
gigabyte=GB
@@ -667,6 +668,8 @@ create_form_configure_rendering_engine_templates_step1_desc=Select the rendering
create_form_configure_rendering_engine_templates_step2_desc=Specify details for the new rendering engine template
create_form_select_default_workflow_title=Stop Three - Select default workflow
create_form_select_default_workflow_desc=Select the workflow you want to be used by default for form {0}.
create_form_select_default_workflow_apply_default_workflow=Do you want to apply a default workflow now?
create_form_select_default_workflow_select_workflow=Select a workflow
create_web_content_summary_desc=The wizard has successfully created the content and all renditions.
create_web_content_summary_content_details=Content Details
create_web_content_summary_rendition_details=Rendition Details
@@ -839,7 +842,7 @@ website_filename_pattern=Filename pattern
website_filename_match=Filename pattern match
website_workflow=Workflow
website_workflow_info=Use the following workflow
website_form_summary=Using workflow ''{0}'', with filename pattern ''{1}'', {2,choice,0#no rendering engines|1#one rendering engine|1<{2,number} rendering engines} selected.
website_form_summary=Using workflow ''{0}'', with output path pattern ''{1}'', {2,choice,0#no rendering engines|1#one rendering engine|1<{2,number} rendering engines} selected.
website_forms=Define Forms
form_template_details=Form Details
form_template_details_desc=Edit the details of this Form Template

View File

@@ -49,9 +49,6 @@
<constructor-arg>
<ref bean="SearchService" />
</constructor-arg>
<constructor-arg>
<ref bean="AVMService" />
</constructor-arg>
</bean>
<!-- NOTE: This references a bean in the repository Spring configuration -->

View File

@@ -31,6 +31,7 @@ import org.alfresco.error.AlfrescoRuntimeException;
import org.alfresco.util.TempFileProvider;
import org.alfresco.web.app.Application;
import org.alfresco.web.bean.FileUploadBean;
import org.apache.commons.io.FilenameUtils;
import org.apache.commons.fileupload.FileItem;
import org.apache.commons.fileupload.RequestContext;
import org.apache.commons.fileupload.disk.DiskFileItemFactory;
@@ -111,19 +112,8 @@ public class UploadFileServlet extends BaseServlet
}
// workaround a bug in IE where the full path is returned
// IE is only available for Windows so only check for the Windows path separator
int idx = filename.lastIndexOf('\\');
if (idx == -1)
{
// if there is no windows path separator check for *nix
idx = filename.lastIndexOf('/');
}
if (idx != -1)
{
filename = filename.substring(idx + File.separator.length());
}
File tempFile = TempFileProvider.createTempFile("alfresco", ".upload");
filename = FilenameUtils.getName(filename);
final File tempFile = TempFileProvider.createTempFile("alfresco", ".upload");
item.write(tempFile);
bean.setFile(tempFile);
bean.setFileName(filename);
@@ -139,6 +129,10 @@ public class UploadFileServlet extends BaseServlet
session.setAttribute(FileUploadBean.getKey(uploadId), bean);
if (bean.getFile() == null)
{
logger.warn("no file uploaded for upload " + uploadId);
}
if (returnPage == null || returnPage.length() == 0)
{
throw new AlfrescoRuntimeException("return-page parameter has not been supplied");

View File

@@ -100,9 +100,6 @@ public class AVMBrowseBean implements IContextListener
/** Top-level JSF form ID */
static final String FORM_ID = "browse-website";
/** Content Manager role name */
private static final String ROLE_CONTENT_MANAGER = "ContentManager";
/** Snapshot date filter selection */
private String snapshotDateFilter = UISandboxSnapshots.FILTER_DATE_TODAY;
@@ -140,6 +137,9 @@ public class AVMBrowseBean implements IContextListener
/** The last displayed website node id */
private String lastWebsiteId = null;
/** The current webProject */
private WebProject webProject = null;
/** breadcrumb location */
private List<IBreadcrumbHandler> location = null;
@@ -158,7 +158,6 @@ public class AVMBrowseBean implements IContextListener
/** Action service bean reference */
protected ActionService actionService;
/**
* Default Constructor
*/
@@ -236,7 +235,7 @@ public class AVMBrowseBean implements IContextListener
final ResourceBundle msg = Application.getBundle(fc);
final String stagingStore = this.getStagingStore();
final AVMStoreDescriptor store = this.avmService.getStore(stagingStore);
final String storeId = (String)getWebsite().getProperties().get(WCMAppModel.PROP_AVMSTORE);
final String storeId = (String)this.getWebProject().getStoreId();
if (store != null)
{
summary.append(msg.getString(MSG_CREATED_ON)).append(": ")
@@ -245,9 +244,7 @@ public class AVMBrowseBean implements IContextListener
summary.append(msg.getString(MSG_CREATED_BY)).append(": ")
.append(store.getCreator())
.append("<p>");
final int numUsers = this.getRelatedStoreNames(storeId,
AVMConstants.PROP_SANDBOX_AUTHOR_MAIN).size();
final int numUsers = this.getRelatedStoreNames(storeId, AVMConstants.PROP_SANDBOX_AUTHOR_MAIN).size();
summary.append(MessageFormat.format(msg.getString(MSG_WORKING_USERS), numUsers));
}
@@ -288,8 +285,7 @@ public class AVMBrowseBean implements IContextListener
*/
public String getStagingStore()
{
String storeRoot = (String)getWebsite().getProperties().get(WCMAppModel.PROP_AVMSTORE);
return AVMConstants.buildStagingStoreName(storeRoot);
return this.getWebProject().getStagingStore();
}
/**
@@ -395,7 +391,7 @@ public class AVMBrowseBean implements IContextListener
{
if (this.webapp == null)
{
this.webapp = (String)getWebsite().getProperties().get(WCMAppModel.PROP_DEFAULTWEBAPP);
this.webapp = this.getWebProject().getDefaultWebapp();
}
return this.webapp;
}
@@ -481,15 +477,28 @@ public class AVMBrowseBean implements IContextListener
public Node getWebsite()
{
// check to see if the website we are browsing has changed since the last time
if (this.navigator.getCurrentNodeId().equals(this.lastWebsiteId) == false)
if (!this.navigator.getCurrentNodeId().equals(this.lastWebsiteId))
{
// clear context when we are browsing a new website
this.lastWebsiteId = this.navigator.getCurrentNodeId();
this.webapp = null;
this.webProject = null;
}
return this.navigator.getCurrentNode();
}
/**
* @return the web project the view is currently within
*/
public WebProject getWebProject()
{
if (this.webProject == null)
{
this.webProject = new WebProject(this.getWebsite().getNodeRef());
}
return this.webProject;
}
/**
* @return Returns the current AVM node action context.
*/
@@ -584,32 +593,8 @@ public class AVMBrowseBean implements IContextListener
*/
public boolean getIsManagerRole()
{
boolean isManager = false;
User user = Application.getCurrentUser(FacesContext.getCurrentInstance());
if (user.isAdmin() == false)
{
String currentUser = user.getUserName();
List<ChildAssociationRef> userInfoRefs = this.nodeService.getChildAssocs(
getWebsite().getNodeRef(), WCMAppModel.ASSOC_WEBUSER, RegexQNamePattern.MATCH_ALL);
for (ChildAssociationRef ref : userInfoRefs)
{
NodeRef userInfoRef = ref.getChildRef();
String username = (String)nodeService.getProperty(userInfoRef, WCMAppModel.PROP_WEBUSERNAME);
String userrole = (String)nodeService.getProperty(userInfoRef, WCMAppModel.PROP_WEBUSERROLE);
if (currentUser.equals(username) && ROLE_CONTENT_MANAGER.equals(userrole))
{
isManager = true;
break;
}
}
}
else
{
isManager = true;
}
return isManager;
final User user = Application.getCurrentUser(FacesContext.getCurrentInstance());
return this.getWebProject().isManager(user);
}
/**
@@ -773,8 +758,7 @@ public class AVMBrowseBean implements IContextListener
else
{
// get the staging store from the current website node
setSandbox(AVMConstants.buildStagingStoreName(
(String)getWebsite().getProperties().get(WCMAppModel.PROP_AVMSTORE)));
setSandbox(this.getStagingStore());
}
// update UI state ready for return to the previous screen
@@ -943,8 +927,6 @@ public class AVMBrowseBean implements IContextListener
public void createFormContent(ActionEvent event)
{
UIActionLink link = (UIActionLink)event.getComponent();
Map<String, String> params = link.getParameterMap();
String id = params.get(UIUserSandboxes.PARAM_FORM_ID);
// setup the correct sandbox for the create action
setupSandboxAction(event);

View File

@@ -18,6 +18,7 @@ package org.alfresco.web.bean.wcm;
import java.text.MessageFormat;
import java.util.Map;
import java.util.Stack;
import java.util.regex.Matcher;
import java.util.regex.Pattern;
@@ -25,7 +26,9 @@ import javax.faces.context.FacesContext;
import org.alfresco.config.JNDIConstants;
import org.alfresco.mbeans.VirtServerRegistry;
import org.alfresco.repo.avm.AVMNodeConverter;
import org.alfresco.repo.domain.PropertyValue;
import org.alfresco.service.cmr.avm.AVMNotFoundException;
import org.alfresco.service.cmr.avm.AVMService;
import org.alfresco.service.namespace.QName;
import org.alfresco.service.ServiceRegistry;
@@ -37,6 +40,7 @@ import org.springframework.web.context.WebApplicationContext;
import org.springframework.web.jsf.FacesContextUtils;
/**
* @author Ariel Backenroth
* @author Kevin Roast
*/
public final class AVMConstants
@@ -368,9 +372,9 @@ public final class AVMConstants
{
throw new IllegalArgumentException("Asset path is mandatory.");
}
if (assetPath.startsWith( '/' + JNDIConstants.DIR_DEFAULT_WWW + '/' + JNDIConstants.DIR_DEFAULT_APPBASE ))
if (assetPath.startsWith('/' + JNDIConstants.DIR_DEFAULT_WWW + '/' + JNDIConstants.DIR_DEFAULT_APPBASE))
{
assetPath = assetPath.substring(('/' + JNDIConstants.DIR_DEFAULT_WWW + '/' + JNDIConstants.DIR_DEFAULT_APPBASE ).length());
assetPath = assetPath.substring(('/' + JNDIConstants.DIR_DEFAULT_WWW + '/' + JNDIConstants.DIR_DEFAULT_APPBASE).length());
}
if (assetPath.startsWith('/' + DIR_ROOT))
{
@@ -516,6 +520,44 @@ public final class AVMConstants
return m.matches() && m.group(1).length() != 0 ? m.group(1) : null;
}
/**
* Creates all directories for a path if they do not already exist.
*/
public static void makeAllDirectories(final String avmDirectoryPath)
{
final ServiceRegistry serviceRegistry =
Repository.getServiceRegistry(FacesContext.getCurrentInstance());
final AVMService avmService = serviceRegistry.getAVMService();
// LOGGER.debug("mkdir -p " + avmDirectoryPath);
String s = avmDirectoryPath;
final Stack<String[]> dirNames = new Stack<String[]>();
while (s != null)
{
try
{
if (avmService.lookup(-1, s) != null)
{
// LOGGER.debug("path " + s + " exists");
break;
}
}
catch (AVMNotFoundException avmfe)
{
}
final String[] sb = AVMNodeConverter.SplitBase(s);
s = sb[0];
// LOGGER.debug("pushing " + sb[1]);
dirNames.push(sb);
}
while (!dirNames.isEmpty())
{
final String[] sb = dirNames.pop();
// LOGGER.debug("creating " + sb[1] + " in " + sb[0]);
avmService.createDirectory(sb[0], sb[1]);
}
}
/**
* @param path Path to match against
*
@@ -636,10 +678,8 @@ public final class AVMConstants
// patterns for WEB-INF files that require virtualisation server reload
private final static Pattern WEB_INF_PATH_PATTERN =
Pattern.compile( ".*:/" +
JNDIConstants.DIR_DEFAULT_WWW + "/" +
JNDIConstants.DIR_DEFAULT_APPBASE + "/" +
Pattern.compile(".*:/" + JNDIConstants.DIR_DEFAULT_WWW +
"/" + JNDIConstants.DIR_DEFAULT_APPBASE + "/" +
".*/WEB-INF/((classes/.*)|(lib/.*)|(web.xml))",
Pattern.CASE_INSENSITIVE
);
Pattern.CASE_INSENSITIVE);
}

View File

@@ -45,11 +45,12 @@ import org.alfresco.web.bean.CheckinCheckoutBean;
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.FormProcessor;
import org.alfresco.web.forms.FormsService;
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.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;
@@ -232,11 +233,10 @@ public class AVMEditBean
*/
public Form getForm()
{
final NodeRef ttNodeRef = (NodeRef)
final String formName = (String)
this.nodeService.getProperty(this.getAvmNode().getNodeRef(),
WCMAppModel.PROP_PARENT_FORM);
final FormsService ts = FormsService.getInstance();
return ts.getForm(ttNodeRef);
WCMAppModel.PROP_PARENT_FORM_NAME);
return this.avmBrowseBean.getWebProject().getForm(formName);
}
/**
@@ -247,18 +247,17 @@ public class AVMEditBean
{
if (this.instanceDataDocument == null)
{
final FormsService fs = FormsService.getInstance();
final String content = this.getEditorOutput();
try
{
this.instanceDataDocument = (content != null
? fs.parseXML(content)
: fs.newDocument());
? XMLUtil.parse(content)
: XMLUtil.newDocument());
}
catch (Exception e)
{
Utils.addErrorMessage("error parsing document", e);
return fs.newDocument();
return XMLUtil.newDocument();
}
}
return this.instanceDataDocument;
@@ -292,21 +291,19 @@ public class AVMEditBean
this.avmBrowseBean.setupContentAction(event);
// retrieve the content reader for this node
NodeRef avmRef = AVMNodeConverter.ToNodeRef(-1, getAvmNode().getPath());
if (this.nodeService.hasAspect(avmRef, WCMAppModel.ASPECT_RENDITION))
String avmPath = getAvmNode().getPath();
if (this.avmService.hasAspect(-1, avmPath, WCMAppModel.ASPECT_RENDITION))
{
if (LOGGER.isDebugEnabled())
LOGGER.debug(avmRef + " is a rendition, editing primary rendition instead");
avmRef = new RenditionImpl(avmRef).getPrimaryFormInstanceData().getNodeRef();
LOGGER.debug(avmPath + " is a rendition, editing primary rendition instead");
avmPath = new RenditionImpl(AVMNodeConverter.ToNodeRef(-1, avmPath)).getPrimaryFormInstanceData().getPath();
final Pair<Integer, String> p = AVMNodeConverter.ToAVMVersionPath(avmRef);
if (LOGGER.isDebugEnabled())
LOGGER.debug("Editing primary form instance data " + p.getSecond() + " version " + p.getFirst());
final AVMNode avmNode = new AVMNode(this.avmService.lookup(p.getFirst(), p.getSecond()));
this.avmBrowseBean.setAvmActionNode(avmNode);
LOGGER.debug("Editing primary form instance data " + avmPath);
this.avmBrowseBean.setAvmActionNode(new AVMNode(this.avmService.lookup(-1, avmPath)));
}
if (this.nodeService.hasAspect(avmRef, WCMAppModel.ASPECT_FORM_INSTANCE_DATA))
if (this.avmService.hasAspect(-1, avmPath, WCMAppModel.ASPECT_FORM_INSTANCE_DATA))
{
// reset the preview layer
String storeName = AVMConstants.getStoreName(this.avmBrowseBean.getCurrentPath());
@@ -318,8 +315,8 @@ public class AVMEditBean
}
if (LOGGER.isDebugEnabled())
LOGGER.debug("Editing AVM node: " + avmRef.toString());
ContentReader reader = contentService.getReader(avmRef, ContentModel.PROP_CONTENT);
LOGGER.debug("Editing AVM node: " + avmPath);
ContentReader reader = this.avmService.getContentReader(-1, avmPath);
if (reader != null)
{
String mimetype = reader.getMimetype();
@@ -335,7 +332,7 @@ public class AVMEditBean
// navigate to appropriate screen
outcome = ((MimetypeMap.MIMETYPE_XML.equals(mimetype) &&
this.nodeService.hasAspect(avmRef, WCMAppModel.ASPECT_FORM_INSTANCE_DATA))
this.avmService.hasAspect(-1, avmPath, WCMAppModel.ASPECT_FORM_INSTANCE_DATA))
? "dialog:editAvmXmlInline"
: "dialog:editAvmTextInline");
}
@@ -389,18 +386,18 @@ public class AVMEditBean
return null;
}
final FormsService formsService = FormsService.getInstance();
final NodeRef avmRef = AVMNodeConverter.ToNodeRef(-1, avmNode.getPath());
final String avmPath = avmNode.getPath();
LOGGER.debug("saving " + avmPath);
try
{
tx = Repository.getUserTransaction(FacesContext.getCurrentInstance());
tx.begin();
// get an updating writer that we can use to modify the content on the current node
ContentWriter writer = this.contentService.getWriter(avmRef, ContentModel.PROP_CONTENT, true);
if (nodeService.hasAspect(avmRef, WCMAppModel.ASPECT_FORM_INSTANCE_DATA))
final ContentWriter writer = this.avmService.getContentWriter(avmPath);
if (this.avmService.hasAspect(-1, avmPath, WCMAppModel.ASPECT_FORM_INSTANCE_DATA))
{
this.editorOutput = formsService.writeXMLToString(this.instanceDataDocument);
this.editorOutput = XMLUtil.toString(this.instanceDataDocument);
}
writer.putContent(this.editorOutput);
@@ -408,10 +405,27 @@ public class AVMEditBean
tx.commit();
// regenerate form content
if (nodeService.hasAspect(avmRef, WCMAppModel.ASPECT_FORM_INSTANCE_DATA))
if (this.avmService.hasAspect(-1, avmPath, WCMAppModel.ASPECT_FORM_INSTANCE_DATA))
{
formsService.regenerateRenditions(new FormInstanceDataImpl(avmRef));
final FormInstanceData fid = new FormInstanceDataImpl(AVMNodeConverter.ToNodeRef(-1, avmPath))
{
@Override
public Form getForm() { return AVMEditBean.this.getForm(); }
};
LOGGER.debug("regenerating renditions of " + fid);
for (Rendition rendition : fid.getRenditions())
{
try
{
rendition.regenerate(fid);
}
catch (Throwable t)
{
LOGGER.error(t, t);
}
}
final NodeRef[] uploadedFiles = this.formProcessorSession.getUploadedFiles();
LOGGER.debug("updating " + uploadedFiles.length + " uploaded files");
final List<AVMDifference> diffList = new ArrayList<AVMDifference>(uploadedFiles.length);
for (NodeRef uploadedFile : uploadedFiles)
{

View File

@@ -112,7 +112,9 @@ public class AVMWorkflowUtil extends WorkflowUtil
oos.close();
// write the serialized Map as a binary content stream - like database blob!
ContentService cs = Repository.getServiceRegistry(FacesContext.getCurrentInstance()).getContentService();
ContentWriter writer = cs.getWriter(workflowRef, WCMAppModel.PROP_WORKFLOWDEFAULTS, true);
ContentWriter writer = cs.getWriter(workflowRef,
WCMAppModel.PROP_WORKFLOW_DEFAULT_PROPERTIES,
true);
writer.setMimetype(MimetypeMap.MIMETYPE_BINARY);
writer.putContent(new ByteArrayInputStream(baos.toByteArray()));
}
@@ -136,7 +138,7 @@ public class AVMWorkflowUtil extends WorkflowUtil
// restore the serialized Map from a binary content stream - like database blob!
Serializable params = null;
ContentService cs = Repository.getServiceRegistry(FacesContext.getCurrentInstance()).getContentService();
ContentReader reader = cs.getReader(workflowRef, WCMAppModel.PROP_WORKFLOWDEFAULTS);
ContentReader reader = cs.getReader(workflowRef, WCMAppModel.PROP_WORKFLOW_DEFAULT_PROPERTIES);
if (reader != null)
{
ObjectInputStream ois = new ObjectInputStream(reader.getContentInputStream());

View File

@@ -52,6 +52,7 @@ import org.alfresco.web.ui.wcm.WebResources;
import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;
import org.apache.xerces.xs.*;
import org.apache.commons.io.FilenameUtils;
import org.w3c.dom.Document;
/**
@@ -65,8 +66,6 @@ public class CreateFormWizard
/////////////////////////////////////////////////////////////////////////////
private static final String NO_DEFAULT_WORKFLOW_SELECTED = "no_default_workflow_selected";
/**
* Simple wrapper class to represent a form data renderer
*/
@@ -76,6 +75,7 @@ public class CreateFormWizard
private final String fileName;
private final NodeRef nodeRef;
private final File file;
private final String name;
private final String title;
private final String description;
private final String mimetypeForRendition;
@@ -85,8 +85,9 @@ public class CreateFormWizard
public RenderingEngineTemplateData(final RenderingEngineTemplate ret)
{
this.file = null;
this.nodeRef = ret.getNodeRef();
this.nodeRef = ((RenderingEngineTemplateImpl)ret).getNodeRef();
this.fileName = ret.getName();
this.name = ret.getName();
this.title = ret.getTitle();
this.description = ret.getDescription();
this.outputPathPatternForRendition = ret.getOutputPathPattern();
@@ -96,6 +97,7 @@ public class CreateFormWizard
public RenderingEngineTemplateData(final String fileName,
final File file,
final String name,
final String title,
final String description,
final String outputPathPatternForRendition,
@@ -105,6 +107,7 @@ public class CreateFormWizard
this.nodeRef = null;
this.fileName = fileName;
this.file = file;
this.name = name;
this.title = title;
this.description = description;
this.outputPathPatternForRendition = outputPathPatternForRendition;
@@ -137,6 +140,11 @@ public class CreateFormWizard
return this.nodeRef;
}
public String getName()
{
return this.name;
}
public String getTitle()
{
return this.title;
@@ -176,6 +184,7 @@ public class CreateFormWizard
private final static Log LOGGER = LogFactory.getLog(CreateFormWizard.class);
protected String defaultWorkflowName = null;
protected boolean applyDefaultWorkflow = true;
protected List<RenderingEngineTemplateData> renderingEngineTemplates = null;
protected transient XSModel schema;
protected String schemaFileName;
@@ -188,6 +197,7 @@ public class CreateFormWizard
private String formTitle = null;
private String formDescription = null;
private String outputPathPatternForFormInstanceData = null;
private String renderingEngineTemplateName = null;
private String renderingEngineTemplateTitle = null;
private String renderingEngineTemplateDescription = null;
@@ -198,6 +208,7 @@ public class CreateFormWizard
private String mimetypeForRendition = null;
private transient List<SelectItem> mimetypeChoices = null;
private transient List<SelectItem> schemaRootElementNameChoices = null;
private transient List<UIListItem> defaultWorkflowChoices = null;
// ------------------------------------------------------------------------------
// Wizard implementation
@@ -211,9 +222,8 @@ public class CreateFormWizard
LOGGER.debug("creating form " + this.getFormName());
}
final FormsService ts = FormsService.getInstance();
// get the node ref of the node that will contain the content
final NodeRef contentFormsNodeRef = ts.getContentFormsNodeRef();
final NodeRef contentFormsNodeRef = FormsService.getInstance().getContentFormsNodeRef();
final FileInfo folderInfo =
this.fileFolderService.create(contentFormsNodeRef,
@@ -224,7 +234,7 @@ public class CreateFormWizard
this.getSchemaFileName(),
ContentModel.TYPE_CONTENT);
// get a writer for the content and put the file
ContentWriter writer = this.contentService.getWriter(fileInfo.getNodeRef(),
final ContentWriter writer = this.contentService.getWriter(fileInfo.getNodeRef(),
ContentModel.PROP_CONTENT,
true);
// set the mimetype and encoding
@@ -233,23 +243,32 @@ public class CreateFormWizard
writer.putContent(this.getSchemaFile());
// apply the titled aspect - title and description
Map<QName, Serializable> props = new HashMap<QName, Serializable>(2, 1.0f);
final Map<QName, Serializable> props = new HashMap<QName, Serializable>(2, 1.0f);
props.put(ContentModel.PROP_TITLE, this.getFormTitle());
props.put(ContentModel.PROP_DESCRIPTION, this.getFormDescription());
this.nodeService.addAspect(folderInfo.getNodeRef(), ContentModel.ASPECT_TITLED, props);
props = new HashMap<QName, Serializable>(3, 1.0f);
props.clear();
props.put(WCMAppModel.PROP_XML_SCHEMA, fileInfo.getNodeRef());
props.put(WCMAppModel.PROP_XML_SCHEMA_ROOT_ELEMENT_NAME,
this.getSchemaRootElementName());
props.put(WCMAppModel.PROP_OUTPUT_PATH_PATTERN_FORM_INSTANCE_DATA,
this.getOutputPathPatternForFormInstanceData());
if (this.defaultWorkflowName != null)
{
props.put(WCMAppModel.PROP_DEFAULT_WORKFLOW_NAME, this.defaultWorkflowName);
}
this.nodeService.addAspect(folderInfo.getNodeRef(), WCMAppModel.ASPECT_FORM, props);
if (this.applyDefaultWorkflow)
{
props.clear();
props.put(WCMAppModel.PROP_WORKFLOW_NAME, this.getDefaultWorkflowName());
this.nodeService.createNode(folderInfo.getNodeRef(),
WCMAppModel.ASSOC_FORM_WORKFLOW_DEFAULTS,
WCMAppModel.ASSOC_FORM_WORKFLOW_DEFAULTS,
WCMAppModel.TYPE_WORKFLOW_DEFAULTS,
props);
}
props.clear();
props.put(WCMAppModel.PROP_OUTPUT_PATH_PATTERN,
this.getOutputPathPatternForFormInstanceData());
this.nodeService.addAspect(folderInfo.getNodeRef(),
WCMAppModel.ASPECT_OUTPUT_PATH_PATTERN, props);
for (RenderingEngineTemplateData retd : this.renderingEngineTemplates)
{
this.saveRenderingEngineTemplate(retd, folderInfo.getNodeRef());
@@ -265,17 +284,17 @@ public class CreateFormWizard
" to form " + this.getFormName());
NodeRef renderingEngineTemplateNodeRef =
this.fileFolderService.searchSimple(formNodeRef, retd.getFileName());
HashMap<QName, Serializable> props;
this.fileFolderService.searchSimple(formNodeRef, retd.getName());
final HashMap<QName, Serializable> props = new HashMap<QName, Serializable>();
if (renderingEngineTemplateNodeRef == null)
{
try
{
final FileInfo fileInfo = this.fileFolderService.create(formNodeRef,
retd.getFileName(),
retd.getName(),
ContentModel.TYPE_CONTENT);
if (LOGGER.isDebugEnabled())
LOGGER.debug("Created file node for file: " + retd.getFileName());
LOGGER.debug("Created file node for file: " + retd.getName());
renderingEngineTemplateNodeRef = fileInfo.getNodeRef();
}
catch (final FileExistsException fee)
@@ -298,7 +317,7 @@ public class CreateFormWizard
this.nodeService.createAssociation(formNodeRef,
renderingEngineTemplateNodeRef,
WCMAppModel.ASSOC_RENDERING_ENGINE_TEMPLATES);
props = new HashMap<QName, Serializable>(2, 1.0f);
props.clear();
props.put(WCMAppModel.PROP_PARENT_RENDERING_ENGINE_NAME,
retd.getRenderingEngine().getName());
props.put(WCMAppModel.PROP_FORM_SOURCE, formNodeRef);
@@ -307,7 +326,7 @@ public class CreateFormWizard
props);
// apply the titled aspect - title and description
props = new HashMap<QName, Serializable>(2, 1.0f);
props.clear();
props.put(ContentModel.PROP_TITLE, retd.getTitle());
props.put(ContentModel.PROP_DESCRIPTION, retd.getDescription());
this.nodeService.addAspect(renderingEngineTemplateNodeRef,
@@ -316,16 +335,19 @@ public class CreateFormWizard
}
LOGGER.debug("adding rendition properties to " + renderingEngineTemplateNodeRef);
props = new HashMap<QName, Serializable>(2, 1.0f);
props.put(WCMAppModel.PROP_OUTPUT_PATH_PATTERN_RENDITION,
retd.getOutputPathPatternForRendition());
props.clear();
props.put(WCMAppModel.PROP_MIMETYPE_FOR_RENDITION,
retd.getMimetypeForRendition());
this.nodeService.createNode(renderingEngineTemplateNodeRef,
final NodeRef rpNodeRef = this.nodeService.createNode(renderingEngineTemplateNodeRef,
WCMAppModel.ASSOC_RENDITION_PROPERTIES,
WCMAppModel.ASSOC_RENDITION_PROPERTIES,
WCMAppModel.TYPE_RENDITION_PROPERTIES,
props);
props).getChildRef();
props.clear();
props.put(WCMAppModel.PROP_OUTPUT_PATH_PATTERN,
retd.getOutputPathPatternForRendition());
this.nodeService.addAspect(rpNodeRef, WCMAppModel.ASPECT_OUTPUT_PATH_PATTERN, props);
}
@Override
@@ -342,6 +364,7 @@ public class CreateFormWizard
this.formName = null;
this.formTitle = null;
this.formDescription = null;
this.renderingEngineTemplateName = null;
this.renderingEngineTemplateTitle = null;
this.renderingEngineTemplateDescription = null;
this.renderingEngine = null;
@@ -350,6 +373,8 @@ public class CreateFormWizard
this.outputPathPatternForRendition = null;
this.mimetypeForRendition = null;
this.defaultWorkflowName = null;
this.defaultWorkflowChoices = null;
this.applyDefaultWorkflow = true;
}
@Override
@@ -469,10 +494,17 @@ public class CreateFormWizard
*/
public void addSelectedRenderingEngineTemplate(final ActionEvent event)
{
final String name = this.getRenderingEngineTemplateName();
final String opp = this.getOutputPathPatternForRendition();
final String mimetype = this.getMimetypeForRendition();
for (RenderingEngineTemplateData retd : this.renderingEngineTemplates)
{
if (name.equals(retd.getName()))
{
Utils.addErrorMessage("A rendering engine template with the name " + name +
" already exists");
return;
}
if (opp.equals(retd.getOutputPathPatternForRendition()) &&
opp.indexOf(DEFAULT_EXTENSION_PATTERN) >= 0 &&
mimetype.equals(retd.getMimetypeForRendition()))
@@ -485,6 +517,7 @@ public class CreateFormWizard
final RenderingEngineTemplateData data =
this.new RenderingEngineTemplateData(this.getRenderingEngineTemplateFileName(),
this.getRenderingEngineTemplateFile(),
this.getRenderingEngineTemplateName(),
this.getRenderingEngineTemplateTitle(),
this.getRenderingEngineTemplateDescription(),
opp,
@@ -495,6 +528,7 @@ public class CreateFormWizard
this.renderingEngine = null;
this.outputPathPatternForRendition = null;
this.mimetypeForRendition = null;
this.renderingEngineTemplateName = null;
this.renderingEngineTemplateTitle = null;
this.renderingEngineTemplateDescription = null;
}
@@ -560,8 +594,7 @@ public class CreateFormWizard
{
try
{
final FormsService formsService = FormsService.getInstance();
final Document d = formsService.parseXML(this.getSchemaFile());
final Document d = XMLUtil.parse(this.getSchemaFile());
this.schema = SchemaUtil.parseSchema(d);
}
catch (Exception e)
@@ -809,7 +842,7 @@ public class CreateFormWizard
public String getFormName()
{
return (this.formName == null && this.getSchemaFileName() != null
? this.getSchemaFileName().replaceAll("(.+)\\..*", "$1")
? FilenameUtils.removeExtension(this.getSchemaFileName())
: this.formName);
}
/**
@@ -846,7 +879,7 @@ public class CreateFormWizard
public String getFormTitle()
{
return (this.formTitle == null && this.getSchemaFileName() != null
? this.getSchemaFileName().replaceAll("(.+)\\..*", "$1")
? FilenameUtils.removeExtension(this.getSchemaFileName())
: this.formTitle);
}
@@ -866,6 +899,23 @@ public class CreateFormWizard
return this.formDescription;
}
/**
* Sets the name for this renderingEngineTemplate.
*/
public void setRenderingEngineTemplateName(final String renderingEngineTemplateName)
{
this.renderingEngineTemplateName = renderingEngineTemplateName;
}
/**
* @return the name for this renderingEngineTemplate.
*/
public String getRenderingEngineTemplateName()
{
return (this.renderingEngineTemplateName == null && this.getRenderingEngineTemplateFileName() != null
? FilenameUtils.removeExtension(this.getRenderingEngineTemplateFileName())
: this.renderingEngineTemplateName);
}
/**
* Sets the title for this renderingEngineTemplate.
*/
@@ -880,7 +930,7 @@ public class CreateFormWizard
public String getRenderingEngineTemplateTitle()
{
return (this.renderingEngineTemplateTitle == null && this.getRenderingEngineTemplateFileName() != null
? this.getRenderingEngineTemplateFileName().replaceAll("(.+)\\..*", "$1")
? FilenameUtils.removeExtension(this.getRenderingEngineTemplateFileName())
: this.renderingEngineTemplateTitle);
}
@@ -900,56 +950,61 @@ public class CreateFormWizard
return this.renderingEngineTemplateDescription;
}
public void setDefaultWorkflowName(final String[] defaultWorkflowName)
{
assert defaultWorkflowName.length == 1;
this.defaultWorkflowName = (NO_DEFAULT_WORKFLOW_SELECTED.equals(defaultWorkflowName[0])
? null
: defaultWorkflowName[0]);
}
public WorkflowDefinition getDefaultWorkflowDefinition()
{
return (this.defaultWorkflowName == null
return (this.defaultWorkflowName == null || !this.applyDefaultWorkflow
? null
: this.workflowService.getDefinitionByName(this.defaultWorkflowName));
}
public void setDefaultWorkflowName(final String[] defaultWorkflowName)
{
assert defaultWorkflowName.length == 1;
this.defaultWorkflowName = defaultWorkflowName[0];
}
public String[] getDefaultWorkflowName()
{
return new String[] {
(this.defaultWorkflowName == null
? NO_DEFAULT_WORKFLOW_SELECTED
: this.defaultWorkflowName)
};
if (this.defaultWorkflowName == null && this.getDefaultWorkflowChoices().size() != 0)
{
this.defaultWorkflowName = (String)this.getDefaultWorkflowChoices().get(0).getValue();
}
return new String[] { this.defaultWorkflowName };
}
public void setApplyDefaultWorkflow(final boolean applyDefaultWorkflow)
{
this.applyDefaultWorkflow = applyDefaultWorkflow;
}
public boolean getApplyDefaultWorkflow()
{
return this.applyDefaultWorkflow;
}
/**
* @return List of UI items to represent the available Workflows for all websites
*/
public List<UIListItem> getDefaultWorkflowChoices()
{
if (this.defaultWorkflowChoices == null)
{
// TODO: add list of workflows from config
// @see org.alfresco.web.wcm.FormDetailsDialog#getWorkflowList()
final List<WorkflowDefinition> workflowDefs = this.workflowService.getDefinitions();
final List<UIListItem> result = new ArrayList<UIListItem>(workflowDefs.size() + 1);
UIListItem item = new UIListItem();
item.setValue(NO_DEFAULT_WORKFLOW_SELECTED);
item.setLabel("None");
item.setImage(WebResources.IMAGE_WORKFLOW_32);
result.add(item);
this.defaultWorkflowChoices = new ArrayList<UIListItem>(workflowDefs.size() + 1);
for (WorkflowDefinition workflowDef : workflowDefs)
{
item = new UIListItem();
final UIListItem item = new UIListItem();
item.setValue(workflowDef.getName());
item.setLabel(workflowDef.getTitle());
item.setDescription(workflowDef.getDescription());
item.setImage(WebResources.IMAGE_WORKFLOW_32);
result.add(item);
this.defaultWorkflowChoices.add(item);
}
return result;
}
return this.defaultWorkflowChoices;
}
// ------------------------------------------------------------------------------

View File

@@ -21,6 +21,7 @@ import java.io.Serializable;
import java.util.ArrayList;
import java.util.Collections;
import java.util.HashMap;
import java.util.LinkedList;
import java.util.List;
import java.util.Map;
import java.util.ResourceBundle;
@@ -63,7 +64,9 @@ import org.alfresco.web.forms.FormInstanceData;
import org.alfresco.web.forms.FormInstanceDataImpl;
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.XMLUtil;
import org.alfresco.web.ui.common.Utils;
import org.alfresco.web.ui.common.component.UIListItem;
import org.alfresco.web.ui.wcm.component.UIUserSandboxes;
@@ -170,13 +173,11 @@ public class CreateWebContentWizard extends BaseContentWizard
this.formSelectDisabled = false;
// check for a form ID being passed in as a parameter
if (this.parameters.get(UIUserSandboxes.PARAM_FORM_ID) != null)
if (this.parameters.get(UIUserSandboxes.PARAM_FORM_NAME) != null)
{
// it is used to init the dialog to a specific template
String webFormId = parameters.get(UIUserSandboxes.PARAM_FORM_ID);
NodeRef webFormRef = new NodeRef(Repository.getStoreRef(), webFormId);
String formName = (String)this.nodeService.getProperty(webFormRef, WCMAppModel.PROP_FORMNAME);
Form form = FormsService.getInstance().getForm(formName);
final String formName = parameters.get(UIUserSandboxes.PARAM_FORM_NAME);
final Form form = this.avmBrowseBean.getWebProject().getForm(formName);
if (form != null)
{
this.formName = form.getName();
@@ -225,17 +226,13 @@ public class CreateWebContentWizard extends BaseContentWizard
LOGGER.debug("clearing form instance data");
if (this.formInstanceData != null)
{
final NodeRef nr = this.formInstanceData.getNodeRef();
final String path = AVMNodeConverter.ToAVMVersionPath(nr).getSecond();
this.avmService.removeNode(path);
this.avmService.removeNode(this.formInstanceData.getPath());
}
if (this.renditions != null)
{
for (Rendition r : this.renditions)
{
final NodeRef nr = r.getNodeRef();
final String path = AVMNodeConverter.ToAVMVersionPath(nr).getSecond();
this.avmService.removeNode(path);
this.avmService.removeNode(r.getPath());
}
}
this.formInstanceData = null;
@@ -277,7 +274,7 @@ public class CreateWebContentWizard extends BaseContentWizard
AVMDifference.NEWER));
for (Rendition rendition : this.renditions)
{
final String path = AVMNodeConverter.ToAVMVersionPath(rendition.getNodeRef()).getSecond();
final String path = rendition.getPath();
diffList.add(new AVMDifference(-1, path,
-1, AVMConstants.getCorrespondingPathInMainStore(path),
AVMDifference.NEWER));
@@ -315,48 +312,8 @@ public class CreateWebContentWizard extends BaseContentWizard
}
if (this.startWorkflow)
{
WorkflowDefinition wd = null;
Map<QName, Serializable> parameters = null;
// get the workflow definition and parameters
final Node website = this.avmBrowseBean.getWebsite();
final List<ChildAssociationRef> webFormRefs = this.nodeService.getChildAssocs(
website.getNodeRef(), WCMAppModel.ASSOC_WEBFORM, RegexQNamePattern.MATCH_ALL);
for (ChildAssociationRef ref : webFormRefs)
{
final String formName = (String)
this.nodeService.getProperty(ref.getChildRef(), WCMAppModel.PROP_FORMNAME);
if (formName.equals(this.getForm().getName()))
{
if (LOGGER.isDebugEnabled())
LOGGER.debug("loading workflowRefs for " + formName);
final List<ChildAssociationRef> workflowRefs =
this.nodeService.getChildAssocs(ref.getChildRef(),
WCMAppModel.ASSOC_WORKFLOWDEFAULTS,
RegexQNamePattern.MATCH_ALL);
if (workflowRefs.size() == 0)
{
throw new AlfrescoRuntimeException("no workflow parameters found for form " + formName);
}
if (workflowRefs.size() > 1)
{
throw new AlfrescoRuntimeException("found more than one workflow parameters node for " + formName);
}
final NodeRef workflowRef = workflowRefs.get(0).getChildRef();
final String workflowName = (String)this.nodeService.getProperty(workflowRef, WCMAppModel.PROP_WORKFLOW_NAME);
if (LOGGER.isDebugEnabled())
LOGGER.debug("using workflow " + workflowName + " for form " + formName);
wd = this.workflowService.getDefinitionByName(workflowName);
// deserialize the workflow parameters
parameters = (Map<QName, Serializable>)AVMWorkflowUtil.deserializeWorkflowParams(workflowRef);
break;
}
}
final WorkflowDefinition wd = this.getForm().getDefaultWorkflow();
final Map<QName, Serializable> parameters = this.getForm().getDefaultWorkflowParameters();
if (LOGGER.isDebugEnabled())
LOGGER.debug("starting workflow " + wd + " with parameters " + parameters);
@@ -385,11 +342,9 @@ public class CreateWebContentWizard extends BaseContentWizard
// collect diffs for form data instance and all renditions
for (Rendition rendition : this.getRenditions())
{
final String renditionPath = AVMNodeConverter.ToAVMVersionPath(rendition.getNodeRef()).getSecond();
srcPaths.add(AVMConstants.getCorrespondingPath(renditionPath, sandboxName));
srcPaths.add(AVMConstants.getCorrespondingPath(rendition.getPath(), sandboxName));
}
final String instancePath = AVMNodeConverter.ToAVMVersionPath(this.formInstanceData.getNodeRef()).getSecond();
srcPaths.add(AVMConstants.getCorrespondingPath(instancePath, sandboxName));
srcPaths.add(AVMConstants.getCorrespondingPath(this.formInstanceData.getPath(), sandboxName));
}
else
{
@@ -454,7 +409,6 @@ public class CreateWebContentWizard extends BaseContentWizard
protected void saveContent()
throws Exception
{
final FormsService fs = FormsService.getInstance();
// get the parent path of the location to save the content
String fileName = this.fileName;
if (LOGGER.isDebugEnabled())
@@ -462,13 +416,16 @@ public class CreateWebContentWizard extends BaseContentWizard
String path = this.avmBrowseBean.getCurrentPath();
path = AVMConstants.getCorrespondingPathInPreviewStore(path);
if (MimetypeMap.MIMETYPE_XML.equals(this.mimeType) && this.formName != null)
final Form form = (MimetypeMap.MIMETYPE_XML.equals(this.mimeType)
? this.getForm()
: null);
if (form != null)
{
path = this.getForm().getOutputPathForFormInstanceData(this.instanceDataDocument,
path = form.getOutputPathForFormInstanceData(this.instanceDataDocument,
fileName,
path,
this.avmBrowseBean.getWebapp());
this.content = FormsService.getInstance().writeXMLToString(this.instanceDataDocument);
this.content = XMLUtil.toString(this.instanceDataDocument);
final String[] sb = AVMNodeConverter.SplitBase(path);
path = sb[0];
fileName = sb[1];
@@ -477,7 +434,7 @@ public class CreateWebContentWizard extends BaseContentWizard
if (LOGGER.isDebugEnabled())
LOGGER.debug("creating all directories in path " + path);
fs.makeAllDirectories(path);
AVMConstants.makeAllDirectories(path);
if (LOGGER.isDebugEnabled())
LOGGER.debug("creating file " + fileName + " in " + path);
@@ -492,15 +449,26 @@ public class CreateWebContentWizard extends BaseContentWizard
// add titled aspect for the read/edit properties screens
final NodeRef formInstanceDataNodeRef = AVMNodeConverter.ToNodeRef(-1, this.createdPath);
Map<QName, Serializable> titledProps = new HashMap<QName, Serializable>(1, 1.0f);
titledProps.put(ContentModel.PROP_TITLE, fileName);
this.nodeService.addAspect(formInstanceDataNodeRef, ContentModel.ASPECT_TITLED, titledProps);
final Map<QName, Serializable> props = new HashMap<QName, Serializable>(1, 1.0f);
props.put(ContentModel.PROP_TITLE, fileName);
this.nodeService.addAspect(formInstanceDataNodeRef, ContentModel.ASPECT_TITLED, props);
if (MimetypeMap.MIMETYPE_XML.equals(this.mimeType) && this.formName != null)
if (form != null)
{
this.formInstanceData = new FormInstanceDataImpl(formInstanceDataNodeRef);
this.getForm().registerFormInstanceData(formInstanceDataNodeRef);
this.renditions = FormsService.getInstance().generateRenditions(this.formInstanceData);
this.formInstanceData = new FormInstanceDataImpl(formInstanceDataNodeRef)
{
@Override
public Form getForm() { return form; }
};
props.clear();
props.put(WCMAppModel.PROP_PARENT_FORM_NAME, form.getName());
this.nodeService.addAspect(formInstanceDataNodeRef, WCMAppModel.ASPECT_FORM_INSTANCE_DATA, props);
this.renditions = new LinkedList<Rendition>();
for (RenderingEngineTemplate ret : form.getRenderingEngineTemplates())
{
this.renditions.add(ret.render(this.formInstanceData));
}
}
else
{
@@ -533,23 +501,11 @@ public class CreateWebContentWizard extends BaseContentWizard
*/
public List<SelectItem> getFormChoices()
{
final Node website = this.avmBrowseBean.getWebsite();
if (website == null)
final List<Form> forms = this.avmBrowseBean.getWebProject().getForms();
final List<SelectItem> items = new ArrayList<SelectItem>(forms.size());
for (final Form f : forms)
{
throw new IllegalStateException("CreateWebContentWizard must be called within a Web Project context!");
}
final List<ChildAssociationRef> webFormRefs = this.nodeService.getChildAssocs(
website.getNodeRef(), WCMAppModel.ASSOC_WEBFORM, RegexQNamePattern.MATCH_ALL);
final List<SelectItem> items = new ArrayList<SelectItem>(webFormRefs.size());
for (ChildAssociationRef ref : webFormRefs)
{
final String formName = (String)
this.nodeService.getProperty(ref.getChildRef(), WCMAppModel.PROP_FORMNAME);
final Form form = FormsService.getInstance().getForm(formName);
if (form != null)
{
items.add(new SelectItem(formName, form.getTitle()));
}
items.add(new SelectItem(f.getName(), f.getTitle()));
}
final QuickSort sorter = new QuickSort(items, "label", true, IDataContainer.SORT_CASEINSENSITIVE);
@@ -613,8 +569,9 @@ public class CreateWebContentWizard extends BaseContentWizard
public Form getForm()
{
final FormsService ts = FormsService.getInstance();
return ts.getForm(this.getFormName());
return (this.getFormName() != null
? this.avmBrowseBean.getWebProject().getForm(this.getFormName())
: null);
}
/**
@@ -633,18 +590,17 @@ public class CreateWebContentWizard extends BaseContentWizard
{
if (this.instanceDataDocument == null)
{
final FormsService fs = FormsService.getInstance();
final String content = this.getContent();
try
{
this.instanceDataDocument = (content != null
? fs.parseXML(content)
: fs.newDocument());
? XMLUtil.parse(content)
: XMLUtil.newDocument());
}
catch (Exception e)
{
Utils.addErrorMessage("error parsing document", e);
this.instanceDataDocument = fs.newDocument();
this.instanceDataDocument = XMLUtil.newDocument();
}
}
return this.instanceDataDocument;

View File

@@ -235,11 +235,11 @@ public class CreateWebsiteWizard extends BaseWizardBean
this.nodeService.addAspect(formRef, ContentModel.ASPECT_TITLED, props);
// add filename pattern aspect if a filename pattern has been applied
if (form.getFilenamePattern() != null)
if (form.getOutputPathPattern() != null)
{
props.clear();
props.put(WCMAppModel.PROP_FILENAMEPATTERN, form.getFilenamePattern());
this.nodeService.addAspect(formRef, WCMAppModel.ASPECT_FILENAMEPATTERN, props);
props.put(WCMAppModel.PROP_OUTPUT_PATH_PATTERN, form.getOutputPathPattern());
this.nodeService.addAspect(formRef, WCMAppModel.ASPECT_OUTPUT_PATH_PATTERN, props);
}
// associate to workflow defaults if any are present
@@ -251,7 +251,7 @@ public class CreateWebsiteWizard extends BaseWizardBean
NodeRef workflowRef = this.nodeService.createNode(formRef,
WCMAppModel.ASSOC_WORKFLOWDEFAULTS,
WCMAppModel.ASSOC_WORKFLOWDEFAULTS,
WCMAppModel.TYPE_WORKFLOWDEFAULTS,
WCMAppModel.TYPE_WORKFLOW_DEFAULTS,
props).getChildRef();
// persist workflow default params
@@ -265,7 +265,8 @@ public class CreateWebsiteWizard extends BaseWizardBean
for (PresentationTemplate template : form.getTemplates())
{
props.clear();
props.put(WCMAppModel.PROP_ENGINE, template.getRenderingEngineTemplate().getNodeRef());
props.put(WCMAppModel.PROP_BASE_RENDERING_ENGINE_TEMPLATE_NAME,
template.getRenderingEngineTemplate().getName());
NodeRef templateRef = this.nodeService.createNode(formRef,
WCMAppModel.ASSOC_WEBFORMTEMPLATE,
WCMAppModel.ASSOC_WEBFORMTEMPLATE,
@@ -273,11 +274,11 @@ public class CreateWebsiteWizard extends BaseWizardBean
props).getChildRef();
// add filename pattern aspect if a filename pattern has been applied
if (template.getFilenamePattern() != null)
if (template.getOutputPathPattern() != null)
{
props.clear();
props.put(WCMAppModel.PROP_FILENAMEPATTERN, template.getFilenamePattern());
this.nodeService.addAspect(templateRef, WCMAppModel.ASPECT_FILENAMEPATTERN, props);
props.put(WCMAppModel.PROP_OUTPUT_PATH_PATTERN, template.getOutputPathPattern());
this.nodeService.addAspect(templateRef, WCMAppModel.ASPECT_OUTPUT_PATH_PATTERN, props);
}
}
}
@@ -747,7 +748,7 @@ public class CreateWebsiteWizard extends BaseWizardBean
private String title;
private String description;
private WorkflowWrapper workflow;
private String filenamePattern;
private String outputPathPattern;
private List<PresentationTemplate> templates = null;
FormWrapper(Form form)
@@ -808,23 +809,23 @@ public class CreateWebsiteWizard extends BaseWizardBean
}
/**
* @return Returns the filename pattern.
* @return Returns the output path pattern.
*/
public String getFilenamePattern()
public String getOutputPathPattern()
{
if (this.filenamePattern == null)
if (this.outputPathPattern == null)
{
this.filenamePattern = this.form.getOutputPathPattern();
this.outputPathPattern = this.form.getOutputPathPattern();
}
return this.filenamePattern;
return this.outputPathPattern;
}
/**
* @param filenamePattern The filename pattern to set.
* @param outputPathPattern The output path pattern to set.
*/
public void setFilenamePattern(String filenamePattern)
public void setOutputPathPattern(String outputPathPattern)
{
this.filenamePattern = filenamePattern;
this.outputPathPattern = outputPathPattern;
}
/**
@@ -872,7 +873,7 @@ public class CreateWebsiteWizard extends BaseWizardBean
String none = '<' + Application.getMessage(FacesContext.getCurrentInstance(), MSG_NONE) + '>';
return MessageFormat.format(Application.getMessage(FacesContext.getCurrentInstance(), MSG_FORM_SUMMARY),
getWorkflow() != null ? this.workflow.title : none,
getFilenamePattern() != null ? this.filenamePattern : none,
getOutputPathPattern() != null ? this.outputPathPattern : none,
getTemplates() != null ? this.templates.size() : 0);
}
}
@@ -885,17 +886,17 @@ public class CreateWebsiteWizard extends BaseWizardBean
private RenderingEngineTemplate ret;
private String title;
private String description;
private String filenamePattern;
private String outputPathPattern;
public PresentationTemplate(RenderingEngineTemplate ret)
{
this(ret, null);
}
public PresentationTemplate(RenderingEngineTemplate ret, String filenamePattern)
public PresentationTemplate(RenderingEngineTemplate ret, String outputPathPattern)
{
this.ret = ret;
this.filenamePattern = filenamePattern;
this.outputPathPattern = outputPathPattern;
}
public RenderingEngineTemplate getRenderingEngineTemplate()
@@ -922,23 +923,23 @@ public class CreateWebsiteWizard extends BaseWizardBean
}
/**
* @return Returns the filename pattern.
* @return Returns the output path pattern.
*/
public String getFilenamePattern()
public String getOutputPathPattern()
{
if (this.filenamePattern == null)
if (this.outputPathPattern == null)
{
this.filenamePattern = ret.getOutputPathPattern();
this.outputPathPattern = ret.getOutputPathPattern();
}
return this.filenamePattern;
return this.outputPathPattern;
}
/**
* @param filenamePattern The filename pattern to set.
* @param outputPathPattern The output path pattern to set.
*/
public void setFilenamePattern(String filenamePattern)
public void setOutputPathPattern(String outputPathPattern)
{
this.filenamePattern = filenamePattern;
this.outputPathPattern = outputPathPattern;
}
}

View File

@@ -17,6 +17,7 @@
package org.alfresco.web.bean.wcm;
import java.io.Serializable;
import java.util.HashMap;
import java.util.LinkedList;
import java.util.List;
import java.util.Map;
@@ -120,7 +121,7 @@ public class EditFormWizard
this.nodeService.setProperty(formNodeRef, ContentModel.PROP_TITLE, this.getFormTitle());
this.nodeService.setProperty(formNodeRef, ContentModel.PROP_DESCRIPTION, this.getFormDescription());
this.nodeService.setProperty(formNodeRef,
WCMAppModel.PROP_OUTPUT_PATH_PATTERN_FORM_INSTANCE_DATA,
WCMAppModel.PROP_OUTPUT_PATH_PATTERN,
this.getOutputPathPatternForFormInstanceData());
this.nodeService.setProperty(formNodeRef,
WCMAppModel.PROP_XML_SCHEMA_ROOT_ELEMENT_NAME,
@@ -128,10 +129,27 @@ public class EditFormWizard
final WorkflowDefinition wd = this.getDefaultWorkflowDefinition();
if (wd != null)
{
this.nodeService.setProperty(formNodeRef,
WCMAppModel.PROP_DEFAULT_WORKFLOW_NAME,
final List<ChildAssociationRef> workflowRefs =
this.nodeService.getChildAssocs(formNodeRef,
WCMAppModel.ASSOC_FORM_WORKFLOW_DEFAULTS,
RegexQNamePattern.MATCH_ALL);
if (workflowRefs.size() == 0)
{
final Map<QName, Serializable> props = new HashMap<QName, Serializable>(1, 1.0f);
props.put(WCMAppModel.PROP_WORKFLOW_NAME, wd.getName());
this.nodeService.createNode(formNodeRef,
WCMAppModel.ASSOC_FORM_WORKFLOW_DEFAULTS,
WCMAppModel.ASSOC_FORM_WORKFLOW_DEFAULTS,
WCMAppModel.TYPE_WORKFLOW_DEFAULTS,
props);
}
else
{
this.nodeService.setProperty(workflowRefs.get(0).getChildRef(),
WCMAppModel.PROP_WORKFLOW_NAME,
wd.getName());
}
}
if (this.getSchemaFile() != null)
{

View File

@@ -90,7 +90,7 @@ public class EditWebsiteWizard extends CreateWebsiteWizard
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));
form.setFilenamePattern((String)this.nodeService.getProperty(formRef, WCMAppModel.PROP_FILENAMEPATTERN));
form.setOutputPathPattern((String)this.nodeService.getProperty(formRef, WCMAppModel.PROP_OUTPUT_PATH_PATTERN));
// the single workflow attached to the form
List<ChildAssociationRef> workflowRefs = this.nodeService.getChildAssocs(
@@ -118,18 +118,16 @@ public class EditWebsiteWizard extends CreateWebsiteWizard
formRef, WCMAppModel.ASSOC_WEBFORMTEMPLATE, RegexQNamePattern.MATCH_ALL);
for (ChildAssociationRef tChildRef : templateRefs)
{
NodeRef templateRef = tChildRef.getChildRef();
NodeRef engineRef = (NodeRef)this.nodeService.getProperty(templateRef, WCMAppModel.PROP_ENGINE);
for (RenderingEngineTemplate ret : engineTemplates)
final NodeRef templateRef = tChildRef.getChildRef();
final String renderingEngineTemplateName = (String)
this.nodeService.getProperty(templateRef,
WCMAppModel.PROP_BASE_RENDERING_ENGINE_TEMPLATE_NAME);
final RenderingEngineTemplate ret = formImpl.getRenderingEngineTemplate(renderingEngineTemplateName);
if (ret != null)
{
if (engineRef.equals(ret.getNodeRef()))
{
String filenamePattern = (String)this.nodeService.getProperty(templateRef,
WCMAppModel.PROP_FILENAMEPATTERN);
PresentationTemplate template = new PresentationTemplate(ret, filenamePattern);
form.addTemplate(template);
break;
}
final String outputPathPattern = (String)
this.nodeService.getProperty(templateRef, WCMAppModel.PROP_OUTPUT_PATH_PATTERN);
form.addTemplate(new PresentationTemplate(ret, outputPathPattern));
}
}
@@ -149,8 +147,8 @@ public class EditWebsiteWizard extends CreateWebsiteWizard
{
WorkflowWrapper wfWrapper = new WorkflowWrapper(wfName, wfDef.getTitle(), wfDef.getDescription());
wfWrapper.setParams((Map<QName, Serializable>)AVMWorkflowUtil.deserializeWorkflowParams(wfRef));
wfWrapper.setFilenamePattern((String)this.nodeService.getProperty(
wfRef, WCMAppModel.PROP_FILENAMEPATTERN));
wfWrapper.setFilenamePattern((String)this.nodeService.getProperty(wfRef,
WCMAppModel.PROP_FILENAMEPATTERN));
if (wfDef.startTaskDefinition != null)
{
wfWrapper.setType(wfDef.startTaskDefinition.metadata.getName());

View File

@@ -50,7 +50,7 @@ public class FormDetailsDialog extends BaseDialogBean
private String title;
private String description;
private String filenamePattern;
private String outputPathPattern;
private String[] workflowSelectedValue;
@@ -63,7 +63,7 @@ public class FormDetailsDialog extends BaseDialogBean
super.init(parameters);
this.title = null;
this.description = null;
this.filenamePattern = null;
this.outputPathPattern = null;
this.workflowSelectedValue = null;
}
@@ -142,21 +142,21 @@ public class FormDetailsDialog extends BaseDialogBean
/**
* @return Returns the filename pattern
*/
public String getFilenamePattern()
public String getOutputPathPattern()
{
if (this.filenamePattern == null)
if (this.outputPathPattern == null)
{
this.filenamePattern = getActionForm().getFilenamePattern();
this.outputPathPattern = getActionForm().getOutputPathPattern();
}
return this.filenamePattern;
return this.outputPathPattern;
}
/**
* @param pattern The filename pattern to set.
*/
public void setFilenamePattern(String pattern)
public void setOutputPathPattern(String pattern)
{
this.filenamePattern = pattern;
this.outputPathPattern = pattern;
}
/**
@@ -225,9 +225,9 @@ public class FormDetailsDialog extends BaseDialogBean
{
form.setDescription(this.description);
}
if (this.filenamePattern != null)
if (this.outputPathPattern != null)
{
form.setFilenamePattern(this.filenamePattern);
form.setOutputPathPattern(this.outputPathPattern);
}
if (this.workflowSelectedValue != null && this.workflowSelectedValue.length != 0)
{

View File

@@ -153,7 +153,7 @@ public class FormTemplatesDialog extends BaseDialogBean
{
PresentationTemplate template = (PresentationTemplate)this.templateList.get(index).getValue();
// clone the PresentationTemplate into one the user can modify
this.templates.add(new PresentationTemplate(template.getRenderingEngineTemplate(), template.getFilenamePattern()));
this.templates.add(new PresentationTemplate(template.getRenderingEngineTemplate(), template.getOutputPathPattern()));
}
}

View File

@@ -168,7 +168,7 @@ public class SubmitDialog extends BaseDialogBean
NodeRef webFormRef = ref.getChildRef();
String form = (String)this.nodeService.getProperty(webFormRef, WCMAppModel.PROP_FORMNAME);
List<ChildAssociationRef> wfRefs = this.nodeService.getChildAssocs(
webFormRef, WCMAppModel.TYPE_WORKFLOWDEFAULTS, RegexQNamePattern.MATCH_ALL);
webFormRef, WCMAppModel.TYPE_WORKFLOW_DEFAULTS, RegexQNamePattern.MATCH_ALL);
if (wfRefs.size() == 1)
{
NodeRef wfDefaultsRef = wfRefs.get(0).getChildRef();

View File

@@ -0,0 +1,309 @@
/*
* Copyright (C) 2005 Alfresco, Inc.
*
* Licensed under the Mozilla Public License version 1.1
* with a permitted attribution clause. You may obtain a
* copy of the License at
*
* http://www.alfresco.org/legal/license.txt
*
* Unless required by applicable law or agreed to in writing,
* software distributed under the License is distributed on an
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND,
* either express or implied. See the License for the specific
* language governing permissions and limitations under the
* License.
*/
package org.alfresco.web.bean.wcm;
import org.alfresco.web.bean.repository.User;
import java.io.Serializable;
import org.alfresco.service.cmr.repository.NodeRef;
import org.alfresco.service.cmr.workflow.WorkflowDefinition;
import org.w3c.dom.Document;
import org.xml.sax.SAXException;
import java.io.IOException;
import java.io.Serializable;
import java.util.List;
import java.util.*;
import javax.faces.context.FacesContext;
import org.alfresco.model.ContentModel;
import org.alfresco.model.WCMAppModel;
import org.alfresco.service.ServiceRegistry;
import org.alfresco.service.cmr.repository.AssociationRef;
import org.alfresco.service.cmr.repository.ChildAssociationRef;
import org.alfresco.service.cmr.repository.ContentService;
import org.alfresco.service.cmr.repository.NodeRef;
import org.alfresco.service.cmr.repository.NodeService;
import org.alfresco.service.cmr.repository.TemplateService;
import org.alfresco.service.cmr.workflow.WorkflowDefinition;
import org.alfresco.service.cmr.workflow.WorkflowService;
import org.alfresco.service.namespace.QName;
import org.alfresco.service.namespace.RegexQNamePattern;
import org.alfresco.web.bean.repository.Repository;
import org.alfresco.web.bean.wcm.AVMConstants;
import org.alfresco.web.forms.*;
import org.alfresco.web.forms.xforms.XFormsProcessor;
import org.alfresco.web.app.servlet.DownloadContentServlet;
import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;
import org.w3c.dom.*;
/**
* Provides configured data for a web project.
*
* @author Ariel Backenroth
*/
public class WebProject
implements Serializable
{
/////////////////////////////////////////////////////////////////////////////
/**
* Wraps a form object to provide overridden values at the web project level
*/
private class FormWrapper
extends FormImpl
{
private final NodeRef formNodeRef;
private Form baseForm;
private NodeRef defaultWorkflowNodeRef;
private FormWrapper(final Form form, final NodeRef formNodeRef)
{
super(((FormImpl)form).getNodeRef());
this.formNodeRef = formNodeRef;
}
@Override
public String getTitle()
{
final NodeService nodeService = this.getServiceRegistry().getNodeService();
return (String)nodeService.getProperty(this.formNodeRef,
ContentModel.PROP_TITLE);
}
@Override
public String getDescription()
{
final NodeService nodeService = this.getServiceRegistry().getNodeService();
return (String)nodeService.getProperty(this.formNodeRef,
ContentModel.PROP_DESCRIPTION);
}
@Override
public String getOutputPathPattern()
{
final NodeService nodeService = this.getServiceRegistry().getNodeService();
final String result = (String)
nodeService.getProperty(this.formNodeRef,
WCMAppModel.PROP_OUTPUT_PATH_PATTERN);
return (result != null ? result : this.baseForm.getOutputPathPattern());
}
@Override
protected NodeRef getDefaultWorkflowNodeRef()
{
if (this.defaultWorkflowNodeRef == null)
{
final NodeService nodeService = this.getServiceRegistry().getNodeService();
final List<ChildAssociationRef> workflowRefs =
nodeService.getChildAssocs(this.formNodeRef,
WCMAppModel.ASSOC_WORKFLOWDEFAULTS,
RegexQNamePattern.MATCH_ALL);
if (workflowRefs.size() == 0)
{
return null;
}
this.defaultWorkflowNodeRef = workflowRefs.get(0).getChildRef();
}
return this.defaultWorkflowNodeRef;
}
@Override
protected Map<String, RenderingEngineTemplate> loadRenderingEngineTemplates()
{
final Map<String, RenderingEngineTemplate> allRets = super.loadRenderingEngineTemplates();
final NodeService nodeService = this.getServiceRegistry().getNodeService();
final List<ChildAssociationRef> retNodeRefs =
nodeService.getChildAssocs(this.formNodeRef,
WCMAppModel.ASSOC_WEBFORMTEMPLATE,
RegexQNamePattern.MATCH_ALL);
final Map<String, RenderingEngineTemplate> result =
new HashMap<String, RenderingEngineTemplate>(retNodeRefs.size(), 1.0f);
for (ChildAssociationRef car : retNodeRefs)
{
final String renderingEngineTemplateName = (String)
nodeService.getProperty(car.getChildRef(),
WCMAppModel.PROP_BASE_RENDERING_ENGINE_TEMPLATE_NAME);
final String outputPathPattern = (String)
nodeService.getProperty(car.getChildRef(), WCMAppModel.PROP_OUTPUT_PATH_PATTERN);
final RenderingEngineTemplateImpl ret = (RenderingEngineTemplateImpl)
allRets.get(renderingEngineTemplateName);
result.put(ret.getName(),
new RenderingEngineTemplateImpl(ret.getNodeRef(),
ret.getRenditionPropertiesNodeRef())
{
@Override
public String getOutputPathPattern()
{
return outputPathPattern;
}
});
}
return result;
}
}
/////////////////////////////////////////////////////////////////////////////
/** Content Manager role name */
private static final String ROLE_CONTENT_MANAGER = "ContentManager";
private final NodeRef nodeRef;
private Map<String, Form> forms;
public WebProject(final NodeRef nodeRef)
{
this.nodeRef = nodeRef;
}
/**
* Returns the name of the web project.
*
* @return the name of the web project.
*/
public String getName()
{
final ServiceRegistry serviceRegistry = this.getServiceRegistry();
final NodeService nodeService = serviceRegistry.getNodeService();
return (String)nodeService.getProperty(this.nodeRef, ContentModel.PROP_NAME);
}
/**
* Returns the store id for this web project.
*
* @return the store id for this web project.
*/
public String getStoreId()
{
final ServiceRegistry serviceRegistry = this.getServiceRegistry();
final NodeService nodeService = serviceRegistry.getNodeService();
return (String)nodeService.getProperty(this.nodeRef, WCMAppModel.PROP_AVMSTORE);
}
/**
* Returns the staging store name.
*
* @return the staging store name.
*/
public String getStagingStore()
{
return AVMConstants.buildStagingStoreName(this.getStoreId());
}
/**
* Returns the forms configured for this web project.
*
* @return the forms configured for this web project.
*/
public List<Form> getForms()
{
return Collections.unmodifiableList(new ArrayList(this.getFormsImpl().values()));
}
/**
* Returns the form with the given name or <tt>null</tt> if not found.
*
* @param name the name of the form
* @return the form or <tt>null</tt> if not found.
* @exception NullPointerException if the name is <tt>null</tt>.
*/
public Form getForm(final String name)
{
if (name == null)
{
throw new NullPointerException();
}
return this.getFormsImpl().get(name);
}
/**
* Returns <tt>true</tt> if the user is a manager of this web project.
*
* @param user the user
* @return <tt>true</tt> if the user is a manager, <tt>false</tt> otherwise.
* @exception NullPointerException if the user is null.
*/
public boolean isManager(final User user)
{
if (user.isAdmin())
{
return true;
}
final ServiceRegistry serviceRegistry = this.getServiceRegistry();
final NodeService nodeService = serviceRegistry.getNodeService();
final String currentUser = user.getUserName();
final List<ChildAssociationRef> userInfoRefs =
nodeService.getChildAssocs(this.nodeRef,
WCMAppModel.ASSOC_WEBUSER,
RegexQNamePattern.MATCH_ALL);
for (ChildAssociationRef ref : userInfoRefs)
{
final NodeRef userInfoRef = ref.getChildRef();
final String username = (String)nodeService.getProperty(userInfoRef, WCMAppModel.PROP_WEBUSERNAME);
final String userrole = (String)nodeService.getProperty(userInfoRef, WCMAppModel.PROP_WEBUSERROLE);
if (currentUser.equals(username) && ROLE_CONTENT_MANAGER.equals(userrole))
{
return true;
}
}
return false;
}
/**
* Returns the default webapp for this web project.
*
* @return the default webapp for this web project.
*/
public String getDefaultWebapp()
{
final ServiceRegistry serviceRegistry = this.getServiceRegistry();
final NodeService nodeService = serviceRegistry.getNodeService();
return (String)
nodeService.getProperty(this.nodeRef, WCMAppModel.PROP_DEFAULTWEBAPP);
}
private Map<String, Form> getFormsImpl()
{
if (this.forms == null)
{
final ServiceRegistry serviceRegistry = this.getServiceRegistry();
final NodeService nodeService = serviceRegistry.getNodeService();
final List<ChildAssociationRef> formRefs =
nodeService.getChildAssocs(this.nodeRef,
WCMAppModel.ASSOC_WEBFORM,
RegexQNamePattern.MATCH_ALL);
this.forms = new HashMap<String, Form>(formRefs.size(), 1.0f);
for (final ChildAssociationRef ref : formRefs)
{
final String formName = (String)
nodeService.getProperty(ref.getChildRef(), WCMAppModel.PROP_FORMNAME);
final Form baseForm = FormsService.getInstance().getForm(formName);
this.forms.put(formName, new FormWrapper(baseForm, ref.getChildRef()));
}
}
return this.forms;
}
private ServiceRegistry getServiceRegistry()
{
final FacesContext fc = FacesContext.getCurrentInstance();
return Repository.getServiceRegistry(fc);
}
}

View File

@@ -16,8 +16,11 @@
*/
package org.alfresco.web.forms;
import java.util.HashMap;
import java.util.Map;
import javax.faces.context.FacesContext;
import org.alfresco.model.WCMModel;
import org.alfresco.repo.avm.AVMNodeConverter;
import org.alfresco.service.cmr.remote.AVMRemote;
import org.alfresco.service.cmr.repository.ContentService;
import org.alfresco.service.cmr.repository.NodeRef;
@@ -56,4 +59,19 @@ public abstract class AbstractRenderingEngine
{
return new FormDataFunctions(AbstractRenderingEngine.getAVMRemote());
}
protected HashMap<String, String> getStandardParameters(final FormInstanceData formInstanceData,
final Rendition rendition)
{
final String formInstanceDataAvmPath = formInstanceData.getPath();
final String renditionAvmPath = rendition.getPath();
final HashMap<String, String> parameters = new HashMap<String, String>();
parameters.put("avm_sandbox_url", AVMConstants.buildStoreUrl(formInstanceDataAvmPath));
parameters.put("form_instance_data_file_name", AVMNodeConverter.SplitBase(formInstanceDataAvmPath)[1]);
parameters.put("rendition_file_name", AVMNodeConverter.SplitBase(renditionAvmPath)[1]);
parameters.put("parent_path", AVMNodeConverter.SplitBase(formInstanceDataAvmPath)[0]);
final FacesContext fc = FacesContext.getCurrentInstance();
parameters.put("request_context_path", fc.getExternalContext().getRequestContextPath());
return parameters;
}
}

View File

@@ -16,14 +16,15 @@
*/
package org.alfresco.web.forms;
import org.alfresco.service.cmr.repository.NodeRef;
import org.alfresco.service.cmr.workflow.WorkflowDefinition;
import org.w3c.dom.Document;
import org.xml.sax.SAXException;
import java.io.IOException;
import java.io.Serializable;
import java.net.URI;
import java.util.List;
import java.util.Map;
import org.alfresco.service.cmr.repository.NodeRef;
import org.alfresco.service.cmr.workflow.WorkflowDefinition;
import org.alfresco.service.namespace.QName;
import org.w3c.dom.Document;
import org.xml.sax.SAXException;
/**
* Encapsulation of a form.
@@ -55,6 +56,12 @@ public interface Form
*/
public WorkflowDefinition getDefaultWorkflow();
/**
* @return the parameters for the default workflow or <tt>null</tt>
* if none were configured.
*/
public Map<QName, Serializable> getDefaultWorkflowParameters();
/** the xml schema for this template type */
public Document getSchema()
throws IOException, SAXException;
@@ -93,10 +100,11 @@ public interface Form
*/
public List<RenderingEngineTemplate> getRenderingEngineTemplates();
/**
* Associates properties with the form instance data registering it as
* generated by this form.
* Provides the rendering engine template by name.
*
* @param name the name of the rendering engine template.
* @return the rendering engine template or <tt>null</tt> if not found.
*/
public void registerFormInstanceData(final NodeRef formInstanceDataNodeRef);
public RenderingEngineTemplate getRenderingEngineTemplate(final String name);
}

View File

@@ -61,13 +61,10 @@ public class FormDataFunctions
throws IOException,
SAXException
{
final DocumentBuilder db = this.getDocumentBuilder();
final InputStream istream = this.avmRemote.getFileInputStream(-1, avmPath);
Document result;
try
{
return db.parse(istream);
return XMLUtil.parse(istream);
}
finally
{
@@ -89,7 +86,6 @@ public class FormDataFunctions
{
final Map<String, AVMNodeDescriptor> entries =
this.avmRemote.getDirectoryListing(-1, avmPath);
final DocumentBuilder db = this.getDocumentBuilder();
final Map<String, Document> result = new HashMap<String, Document>();
for (Map.Entry<String, AVMNodeDescriptor> entry : entries.entrySet())
{
@@ -121,7 +117,7 @@ public class FormDataFunctions
final InputStream istream = this.avmRemote.getFileInputStream(-1, avmPath + '/' + entryName);
try
{
result.put(entryName, db.parse(istream));
result.put(entryName, XMLUtil.parse(istream));
}
finally
{
@@ -131,23 +127,4 @@ public class FormDataFunctions
}
return result;
}
private static DocumentBuilder getDocumentBuilder()
{
if (FormDataFunctions.documentBuilder == null)
{
try
{
final DocumentBuilderFactory dbf = DocumentBuilderFactory.newInstance();
dbf.setNamespaceAware(true);
dbf.setValidating(false);
FormDataFunctions.documentBuilder = dbf.newDocumentBuilder();
}
catch (ParserConfigurationException pce)
{
LOGGER.error(pce);
}
}
return FormDataFunctions.documentBuilder;
}
}

View File

@@ -25,7 +25,6 @@ import freemarker.template.TemplateModel;
import freemarker.template.TemplateModelException;
import java.io.*;
import java.net.URI;
import java.io.Serializable;
import java.util.*;
import javax.faces.context.FacesContext;
import org.alfresco.model.ContentModel;
@@ -43,19 +42,20 @@ import org.alfresco.service.namespace.QName;
import org.alfresco.service.namespace.RegexQNamePattern;
import org.alfresco.web.bean.repository.Repository;
import org.alfresco.web.bean.wcm.AVMConstants;
import org.alfresco.web.bean.wcm.AVMWorkflowUtil;
import org.alfresco.web.forms.xforms.XFormsProcessor;
import org.alfresco.web.app.servlet.DownloadContentServlet;
import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;
import org.w3c.dom.*;
import org.xml.sax.SAXException;
class FormImpl
public class FormImpl
implements Form
{
private static final Log LOGGER = LogFactory.getLog(FormImpl.class);
private final NodeRef folderNodeRef;
private transient Map<String, RenderingEngineTemplate> renderingEngineTemplates;
private final static LinkedList<FormProcessor> PROCESSORS =
new LinkedList<FormProcessor>();
@@ -94,18 +94,47 @@ class FormImpl
{
final NodeService nodeService = this.getServiceRegistry().getNodeService();
return (String)nodeService.getProperty(this.folderNodeRef,
WCMAppModel.PROP_OUTPUT_PATH_PATTERN_FORM_INSTANCE_DATA);
WCMAppModel.PROP_OUTPUT_PATH_PATTERN);
}
public WorkflowDefinition getDefaultWorkflow()
{
final NodeService nodeService = this.getServiceRegistry().getNodeService();
final String defaultWorkflowName = (String)nodeService.getProperty(this.folderNodeRef,
WCMAppModel.PROP_DEFAULT_WORKFLOW_NAME);
final WorkflowService workflowService = this.getServiceRegistry().getWorkflowService();
return (defaultWorkflowName != null
? workflowService.getDefinitionByName(defaultWorkflowName)
final NodeRef workflowRef = this.getDefaultWorkflowNodeRef();
final String workflowName =
(workflowRef != null
? (String)nodeService.getProperty(workflowRef, WCMAppModel.PROP_WORKFLOW_NAME)
: null);
if (LOGGER.isDebugEnabled())
LOGGER.debug("using workflow " + workflowName + " for form " + this.getName());
return workflowName != null ? workflowService.getDefinitionByName(workflowName) : null;
}
public Map<QName, Serializable> getDefaultWorkflowParameters()
{
final NodeRef workflowRef = this.getDefaultWorkflowNodeRef();
return (Map<QName, Serializable>)AVMWorkflowUtil.deserializeWorkflowParams(workflowRef);
}
protected NodeRef getDefaultWorkflowNodeRef()
{
final NodeService nodeService = this.getServiceRegistry().getNodeService();
final List<ChildAssociationRef> workflowRefs =
nodeService.getChildAssocs(this.folderNodeRef,
WCMAppModel.ASSOC_FORM_WORKFLOW_DEFAULTS,
RegexQNamePattern.MATCH_ALL);
if (workflowRefs.size() == 0)
{
return null;
}
assert workflowRefs.size() == 1 : "found more than one workflow parameters node for " + this.getName();
return workflowRefs.get(0).getChildRef();
}
public String getOutputPathForFormInstanceData(final Document formInstanceData,
@@ -144,11 +173,11 @@ class FormImpl
throws IOException,
SAXException
{
final FormsService ts = FormsService.getInstance();
final NodeService nodeService = this.getServiceRegistry().getNodeService();
final NodeRef schemaNodeRef = (NodeRef)nodeService.getProperty(folderNodeRef,
WCMAppModel.PROP_XML_SCHEMA);
return ts.parseXML(schemaNodeRef);
final NodeRef schemaNodeRef = (NodeRef)
nodeService.getProperty(folderNodeRef, WCMAppModel.PROP_XML_SCHEMA);
return XMLUtil.parse(schemaNodeRef,
this.getServiceRegistry().getContentService());
}
public List<FormProcessor> getFormProcessors()
@@ -158,41 +187,30 @@ class FormImpl
public void addRenderingEngineTemplate(final RenderingEngineTemplate ret)
{
// this.renderingEngineTemplates.add(ret);
throw new UnsupportedOperationException();
}
public List<RenderingEngineTemplate> getRenderingEngineTemplates()
{
final NodeService nodeService = this.getServiceRegistry().getNodeService();
final List<AssociationRef> refs = nodeService.getTargetAssocs(this.folderNodeRef,
WCMAppModel.ASSOC_RENDERING_ENGINE_TEMPLATES);
final List<RenderingEngineTemplate> result = new ArrayList<RenderingEngineTemplate>(refs.size());
for (AssociationRef assoc : refs)
if (this.renderingEngineTemplates == null)
{
final NodeRef retNodeRef = assoc.getTargetRef();
for (ChildAssociationRef assoc2 : nodeService.getChildAssocs(retNodeRef,
WCMAppModel.ASSOC_RENDITION_PROPERTIES,
RegexQNamePattern.MATCH_ALL))
{
final NodeRef renditionPropertiesNodeRef = assoc2.getChildRef();
final RenderingEngineTemplate ret =
new RenderingEngineTemplateImpl(retNodeRef, renditionPropertiesNodeRef);
LOGGER.debug("loaded rendering engine template " + ret);
result.add(ret);
this.renderingEngineTemplates = this.loadRenderingEngineTemplates();
}
}
return result;
return Collections.unmodifiableList(new ArrayList(this.renderingEngineTemplates.values()));
}
public void registerFormInstanceData(final NodeRef formInstanceDataNodeRef)
public RenderingEngineTemplate getRenderingEngineTemplate(final String name)
{
final NodeService nodeService = this.getServiceRegistry().getNodeService();
final Map<QName, Serializable> props = new HashMap<QName, Serializable>(2, 1.0f);
props.put(WCMAppModel.PROP_PARENT_FORM, this.folderNodeRef);
props.put(WCMAppModel.PROP_PARENT_FORM_NAME, this.getName());
nodeService.addAspect(formInstanceDataNodeRef, WCMAppModel.ASPECT_FORM_INSTANCE_DATA, props);
if (this.renderingEngineTemplates == null)
{
this.renderingEngineTemplates = this.loadRenderingEngineTemplates();
}
return this.renderingEngineTemplates.get(name);
}
public NodeRef getNodeRef()
{
return this.folderNodeRef;
}
public int hashCode()
@@ -209,9 +227,33 @@ class FormImpl
"}");
}
private ServiceRegistry getServiceRegistry()
protected ServiceRegistry getServiceRegistry()
{
final FacesContext fc = FacesContext.getCurrentInstance();
return Repository.getServiceRegistry(fc);
}
protected Map<String, RenderingEngineTemplate> loadRenderingEngineTemplates()
{
final NodeService nodeService = this.getServiceRegistry().getNodeService();
final List<AssociationRef> refs = nodeService.getTargetAssocs(this.folderNodeRef,
WCMAppModel.ASSOC_RENDERING_ENGINE_TEMPLATES);
final Map<String, RenderingEngineTemplate> result = new HashMap<String, RenderingEngineTemplate>(refs.size(), 1.0f);
for (AssociationRef assoc : refs)
{
final NodeRef retNodeRef = assoc.getTargetRef();
for (ChildAssociationRef assoc2 : nodeService.getChildAssocs(retNodeRef,
WCMAppModel.ASSOC_RENDITION_PROPERTIES,
RegexQNamePattern.MATCH_ALL))
{
final NodeRef renditionPropertiesNodeRef = assoc2.getChildRef();
final RenderingEngineTemplate ret =
new RenderingEngineTemplateImpl(retNodeRef, renditionPropertiesNodeRef);
LOGGER.debug("loaded rendering engine template " + ret);
result.put(ret.getName(), ret);
}
}
return result;
}
}

View File

@@ -16,9 +16,12 @@
*/
package org.alfresco.web.forms;
import java.io.IOException;
import java.io.Serializable;
import java.util.List;
import org.alfresco.service.cmr.repository.NodeRef;
import org.w3c.dom.Document;
import org.xml.sax.SAXException;
/**
* Encapsulation of form instance data.
@@ -47,8 +50,9 @@ public interface FormInstanceData
/** the url to the asset */
public String getUrl();
/** the noderef containing the form instance data */
public NodeRef getNodeRef();
/** returns the parsed form instance data */
public Document getDocument()
throws IOException, SAXException;
/** returns all renditions of this form instance data */
public List<Rendition> getRenditions();

View File

@@ -16,27 +16,25 @@
*/
package org.alfresco.web.forms;
import java.util.LinkedList;
import java.util.List;
import java.io.*;
import java.util.*;
import javax.faces.context.FacesContext;
import org.alfresco.model.ContentModel;
import org.alfresco.model.WCMAppModel;
import org.alfresco.service.cmr.avm.AVMService;
import org.alfresco.service.cmr.repository.NodeRef;
import org.alfresco.repo.avm.AVMNodeConverter;
import org.alfresco.repo.domain.PropertyValue;
import org.alfresco.service.ServiceRegistry;
import org.alfresco.service.cmr.repository.ContentReader;
import org.alfresco.service.cmr.repository.ContentService;
import org.alfresco.service.cmr.repository.MimetypeService;
import org.alfresco.service.cmr.repository.NodeRef;
import org.alfresco.service.cmr.repository.NodeService;
import org.alfresco.service.cmr.repository.TemplateNode;
import org.alfresco.service.cmr.repository.TemplateService;
import org.alfresco.service.cmr.avm.AVMNotFoundException;
import org.alfresco.service.cmr.avm.AVMService;
import org.alfresco.service.cmr.dictionary.DataTypeDefinition;
import org.alfresco.service.cmr.repository.*;
import org.alfresco.service.namespace.QName;
import org.alfresco.web.bean.repository.Repository;
import org.alfresco.web.bean.wcm.AVMConstants;
import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;
import org.w3c.dom.*;
import org.xml.sax.SAXException;
/**
* Encapsulation of a rendition.
@@ -53,6 +51,10 @@ public class FormInstanceDataImpl
public FormInstanceDataImpl(final NodeRef nodeRef)
{
if (nodeRef == null)
{
throw new NullPointerException();
}
this.nodeRef = nodeRef;
}
@@ -79,13 +81,20 @@ public class FormInstanceDataImpl
return AVMNodeConverter.ToAVMVersionPath(this.nodeRef).getSecond();
}
public Document getDocument()
throws IOException, SAXException
{
return XMLUtil.parse(this.getNodeRef(),
this.getServiceRegistry().getContentService());
}
public Form getForm()
{
final NodeService nodeService = this.getServiceRegistry().getNodeService();
final NodeRef formNodeRef = (NodeRef)
final String parentFormName = (String)
nodeService.getProperty(this.nodeRef,
WCMAppModel.PROP_PARENT_FORM);
return new FormImpl(formNodeRef);
WCMAppModel.PROP_PARENT_FORM_NAME);
return FormsService.getInstance().getForm(parentFormName);
}
/** the node ref containing the contents of this rendition */
@@ -102,21 +111,17 @@ public class FormInstanceDataImpl
public List<Rendition> getRenditions()
{
final AVMService avmService = this.getServiceRegistry().getAVMService();
final List<Rendition> result = new LinkedList<Rendition>();
for (RenderingEngineTemplate ret : this.getForm().getRenderingEngineTemplates())
final PropertyValue pv =
avmService.getNodeProperty(-1, this.getPath(), WCMAppModel.PROP_RENDITIONS);
final Collection<Serializable> renditionPaths = (pv == null
? Collections.EMPTY_LIST
: pv.getCollection(DataTypeDefinition.TEXT));
final String storeName = AVMConstants.getStoreName(this.getPath());
final List<Rendition> result = new ArrayList<Rendition>(renditionPaths.size());
for (Serializable path : renditionPaths)
{
final String renditionAvmPath = ret.getOutputPathForRendition(this);
if (avmService.lookup(-1, renditionAvmPath) == null)
{
LOGGER.warn("unable to locate rendition " + renditionAvmPath +
" for form instance data " + this.getName());
}
else
{
final NodeRef renditionNodeRef =
AVMNodeConverter.ToNodeRef(-1, renditionAvmPath);
result.add(new RenditionImpl(renditionNodeRef));
}
result.add(new RenditionImpl(AVMNodeConverter.ToNodeRef(-1, storeName + ':' + (String)path)));
}
return result;
}

View File

@@ -16,35 +16,15 @@
*/
package org.alfresco.web.forms;
import java.io.ByteArrayInputStream;
import java.io.File;
import java.io.FileInputStream;
import java.io.FileWriter;
import java.io.IOException;
import java.io.InputStream;
import java.io.OutputStream;
import java.io.Serializable;
import java.io.StringWriter;
import java.io.Writer;
import java.text.MessageFormat;
import java.io.*;
import java.util.Collection;
import java.util.HashMap;
import java.util.LinkedList;
import java.util.List;
import java.util.Map;
import java.util.ResourceBundle;
import java.util.Stack;
import javax.faces.context.FacesContext;
import javax.xml.parsers.DocumentBuilder;
import javax.xml.parsers.DocumentBuilderFactory;
import javax.xml.parsers.ParserConfigurationException;
import javax.xml.transform.OutputKeys;
import javax.xml.transform.Transformer;
import javax.xml.transform.TransformerException;
import javax.xml.transform.TransformerFactory;
import javax.xml.transform.dom.DOMSource;
import javax.xml.transform.stream.StreamResult;
import org.alfresco.error.AlfrescoRuntimeException;
import org.alfresco.model.ContentModel;
@@ -89,7 +69,7 @@ public final class FormsService
/** the single instance initialized using spring */
private static FormsService INSTANCE;
private static DocumentBuilder documentBuilder;
private static final RenderingEngine[] RENDERING_ENGINES = new RenderingEngine[]
{
@@ -102,7 +82,6 @@ public final class FormsService
private final NodeService nodeService;
private final NamespaceService namespaceService;
private final SearchService searchService;
private final AVMService avmService;
private NodeRef contentFormsNodeRef;
@@ -110,14 +89,12 @@ public final class FormsService
public FormsService(final ContentService contentService,
final NodeService nodeService,
final NamespaceService namespaceService,
final SearchService searchService,
final AVMService avmService)
final SearchService searchService)
{
this.contentService = contentService;
this.nodeService = nodeService;
this.namespaceService = namespaceService;
this.searchService = searchService;
this.avmService = avmService;
if (INSTANCE == null)
INSTANCE = this;
}
@@ -180,7 +157,7 @@ public final class FormsService
Application.getContentFormsFolderName(fc));
LOGGER.debug("locating content forms at " + xpath);
final List<NodeRef> results =
searchService.selectNodes(nodeService.getRootNode(Repository.getStoreRef()),
searchService.selectNodes(this.nodeService.getRootNode(Repository.getStoreRef()),
xpath,
null,
namespaceService,
@@ -262,273 +239,4 @@ public final class FormsService
LOGGER.debug("loaded form " + result);
return result;
}
/**
* Generates renditions for the provided formInstanceData.
*
* @param formInstanceDataNodeRef the noderef containing the form instance data
*/
public List<Rendition> generateRenditions(final FormInstanceData formInstanceData)
throws IOException,
SAXException,
RenderingEngine.RenderingException
{
final Form form = formInstanceData.getForm();
final Document formInstanceDataDocument = this.parseXML(formInstanceData.getNodeRef());
final String formInstanceDataFileName = formInstanceData.getName();
final String formInstanceDataAvmPath = formInstanceData.getPath();
LOGGER.debug("generating renditions for " + formInstanceDataAvmPath);
final List<Rendition> result = new LinkedList<Rendition>();
for (RenderingEngineTemplate ret : form.getRenderingEngineTemplates())
{
// get the node ref of the node that will contain the content
final String renditionAvmPath = ret.getOutputPathForRendition(formInstanceData);
final String parentAVMPath = AVMNodeConverter.SplitBase(renditionAvmPath)[0];
this.makeAllDirectories(parentAVMPath);
final OutputStream out = this.avmService.createFile(parentAVMPath,
AVMNodeConverter.SplitBase(renditionAvmPath)[1]);
if (LOGGER.isDebugEnabled())
LOGGER.debug("Created file node for file: " + renditionAvmPath);
final HashMap<String, String> parameters =
this.getRenderingEngineParameters(formInstanceDataAvmPath,
renditionAvmPath);
ret.getRenderingEngine().render(formInstanceDataDocument, ret, parameters, out);
out.close();
final NodeRef renditionNodeRef = AVMNodeConverter.ToNodeRef(-1, renditionAvmPath);
final Rendition rendition = new RenditionImpl(renditionNodeRef);
form.registerFormInstanceData(renditionNodeRef);
ret.registerRendition(rendition, formInstanceData);
Map<QName, Serializable> props = new HashMap<QName, Serializable>(1, 1.0f);
props.put(ContentModel.PROP_TITLE, AVMNodeConverter.SplitBase(renditionAvmPath)[1]);
final ResourceBundle bundle = Application.getBundle(FacesContext.getCurrentInstance());
props.put(ContentModel.PROP_DESCRIPTION,
MessageFormat.format(bundle.getString("default_rendition_description"),
ret.getTitle(),
AVMConstants.getSandboxRelativePath(renditionAvmPath)));
nodeService.addAspect(renditionNodeRef, ContentModel.ASPECT_TITLED, props);
result.add(rendition);
if (LOGGER.isDebugEnabled())
LOGGER.debug("generated " + renditionAvmPath + " using " + ret);
}
return result;
}
/**
* Regenerates all renditions of the provided form instance data.
*
* @param formInstanceDataNodeRef the node ref containing the form instance data.
*/
public List<Rendition> regenerateRenditions(final FormInstanceData formInstanceData)
throws IOException,
SAXException,
RenderingEngine.RenderingException
{
final Form form = formInstanceData.getForm();
final Document formInstanceDataDocument = this.parseXML(formInstanceData.getNodeRef());
final String formInstanceDataFileName = formInstanceData.getName();
// other parameter values passed to rendering engine
final String formInstanceDataAvmPath = formInstanceData.getPath();
LOGGER.debug("regenerating renditions for " + formInstanceDataAvmPath);
final List<Rendition> result = new LinkedList<Rendition>();
for (RenderingEngineTemplate ret : form.getRenderingEngineTemplates())
{
final String renditionAvmPath = ret.getOutputPathForRendition(formInstanceData);
if (LOGGER.isDebugEnabled())
LOGGER.debug("regenerating file node for : " + formInstanceDataFileName +
" (" + formInstanceData.toString() +
") to " + renditionAvmPath);
// get a writer for the content and put the file
OutputStream out = null;
try
{
out = this.avmService.getFileOutputStream(renditionAvmPath);
}
catch (AVMNotFoundException e)
{
out = this.avmService.createFile(AVMNodeConverter.SplitBase(renditionAvmPath)[0],
AVMNodeConverter.SplitBase(renditionAvmPath)[1]);
}
final HashMap<String, String> parameters =
this.getRenderingEngineParameters(formInstanceDataAvmPath, renditionAvmPath);
ret.getRenderingEngine().render(formInstanceDataDocument, ret, parameters, out);
out.close();
final NodeRef renditionNodeRef = AVMNodeConverter.ToNodeRef(-1, renditionAvmPath);
result.add(new RenditionImpl(renditionNodeRef));
if (LOGGER.isDebugEnabled())
LOGGER.debug("regenerated " + renditionAvmPath + " using " + ret);
}
return result;
}
private static HashMap<String, String> getRenderingEngineParameters(final String formInstanceDataAvmPath,
final String renditionAvmPath)
{
final HashMap<String, String> parameters = new HashMap<String, String>();
parameters.put("avm_sandbox_url", AVMConstants.buildStoreUrl(formInstanceDataAvmPath));
parameters.put("form_instance_data_file_name", AVMNodeConverter.SplitBase(formInstanceDataAvmPath)[1]);
parameters.put("rendition_file_name", AVMNodeConverter.SplitBase(renditionAvmPath)[1]);
parameters.put("parent_path", AVMNodeConverter.SplitBase(formInstanceDataAvmPath)[0]);
final FacesContext fc = FacesContext.getCurrentInstance();
parameters.put("request_context_path", fc.getExternalContext().getRequestContextPath());
return parameters;
}
// XXXarielb relocate
public void makeAllDirectories(final String avmDirectoryPath)
{
LOGGER.debug("mkdir -p " + avmDirectoryPath);
String s = avmDirectoryPath;
final Stack<String[]> dirNames = new Stack<String[]>();
while (s != null)
{
try
{
if (this.avmService.lookup(-1, s) != null)
{
LOGGER.debug("path " + s + " exists");
break;
}
}
catch (AVMNotFoundException avmfe)
{
}
final String[] sb = AVMNodeConverter.SplitBase(s);
s = sb[0];
LOGGER.debug("pushing " + sb[1]);
dirNames.push(sb);
}
while (!dirNames.isEmpty())
{
final String[] sb = dirNames.pop();
LOGGER.debug("creating " + sb[1] + " in " + sb[0]);
this.avmService.createDirectory(sb[0], sb[1]);
}
}
/** utility function for creating a document */
public Document newDocument()
{
return this.getDocumentBuilder().newDocument();
}
/** utility function for serializing a node */
public void writeXML(final Node n, final Writer output)
{
try
{
final TransformerFactory tf = TransformerFactory.newInstance();
final Transformer t = tf.newTransformer();
t.setOutputProperty(OutputKeys.INDENT, "yes");
if (LOGGER.isDebugEnabled())
{
LOGGER.debug("writing out a document for " +
(n instanceof Document
? ((Document)n).getDocumentElement()
: n).getNodeName() +
" to " + (output instanceof StringWriter
? "string"
: output));
}
t.transform(new DOMSource(n), new StreamResult(output));
}
catch (TransformerException te)
{
te.printStackTrace();
assert false : te.getMessage();
}
}
/** utility function for serializing a node */
public void writeXML(final Node n, final File output)
throws IOException
{
this.writeXML(n, new FileWriter(output));
}
/** utility function for serializing a node */
public String writeXMLToString(final Node n)
{
final StringWriter result = new StringWriter();
this.writeXML(n, result);
return result.toString();
}
/** utility function for parsing xml */
public Document parseXML(final String source)
throws SAXException,
IOException
{
return this.parseXML(new ByteArrayInputStream(source.getBytes()));
}
/** utility function for parsing xml */
public Document parseXML(final NodeRef nodeRef)
throws SAXException,
IOException
{
final ContentReader contentReader =
this.contentService.getReader(nodeRef, ContentModel.TYPE_CONTENT);
final InputStream in = contentReader.getContentInputStream();
return this.parseXML(in);
}
/** utility function for parsing xml */
public Document parseXML(final File source)
throws SAXException,
IOException
{
return this.parseXML(new FileInputStream(source));
}
/** utility function for parsing xml */
public Document parseXML(final InputStream source)
throws SAXException,
IOException
{
final DocumentBuilder db = this.getDocumentBuilder();
final Document result = db.parse(source);
source.close();
return result;
}
private static String stripExtension(final String s)
{
return s.replaceAll("(.+)\\..*", "$1");
}
public DocumentBuilder getDocumentBuilder()
{
if (FormsService.documentBuilder == null)
{
try
{
final DocumentBuilderFactory dbf = DocumentBuilderFactory.newInstance();
dbf.setNamespaceAware(true);
dbf.setValidating(false);
FormsService.documentBuilder = dbf.newDocumentBuilder();
}
catch (ParserConfigurationException pce)
{
LOGGER.error(pce);
}
}
return FormsService.documentBuilder;
}
}

View File

@@ -35,6 +35,7 @@ import org.apache.commons.logging.LogFactory;
import org.w3c.dom.Document;
import org.w3c.dom.Element;
import org.w3c.dom.Node;
import org.xml.sax.SAXException;
/**
* Implementation of a form data renderer for processing xml instance data
@@ -69,13 +70,15 @@ public class FreeMarkerRenderingEngine
* a variable named alfresco at the root. the alfresco variable contains a hash of
* all parameters and all extension functions.
*/
public void render(final Document xmlContent,
public void render(final FormInstanceData formInstanceData,
final RenderingEngineTemplate ret,
final Map<String, String> parameters,
final OutputStream out)
final Rendition rendition)
throws IOException,
RenderingEngine.RenderingException
RenderingEngine.RenderingException,
SAXException
{
final Map<String, String> parameters =
this.getStandardParameters(formInstanceData, rendition);
final Configuration cfg = new Configuration();
cfg.setTemplateExceptionHandler(TemplateExceptionHandler.RETHROW_HANDLER);
@@ -85,11 +88,12 @@ public class FreeMarkerRenderingEngine
cfg);
// wrap the xml instance in a model
final TemplateHashModel instanceDataModel = NodeModel.wrap(xmlContent);
final TemplateHashModel instanceDataModel = NodeModel.wrap(formInstanceData.getDocument());
// build models for each of the extension functions
final HashMap<String, TemplateMethodModel> methodModels =
new HashMap<String, TemplateMethodModel>(3, 1.0f);
methodModels.put("parseXMLDocument", new TemplateMethodModel()
{
public Object exec(final List args)
@@ -130,9 +134,7 @@ public class FreeMarkerRenderingEngine
// create a root document for rooting all the results. we do this
// so that each document root element has a common parent node
// and so that xpath axes work properly
final FormsService fs = FormsService.getInstance();
final DocumentBuilder documentBuilder = fs.getDocumentBuilder();
final Document rootNodeDocument = documentBuilder.newDocument();
final Document rootNodeDocument = XMLUtil.newDocument();
final Element rootNodeDocumentEl =
rootNodeDocument.createElementNS(ALFRESCO_NS,
ALFRESCO_NS_PREFIX + ":file_list");
@@ -213,7 +215,7 @@ public class FreeMarkerRenderingEngine
};
// process the form
final Writer writer = new OutputStreamWriter(out);
final Writer writer = new OutputStreamWriter(rendition.getOutputStream());
try
{
t.process(rootModel, writer);
@@ -226,6 +228,7 @@ public class FreeMarkerRenderingEngine
finally
{
writer.flush();
writer.close();
}
}
}

View File

@@ -22,6 +22,7 @@ import java.io.OutputStream;
import java.io.Serializable;
import java.util.Map;
import org.w3c.dom.Document;
import org.xml.sax.SAXException;
/**
* Serializes the xml instance data collected by a form to a writer.
@@ -78,12 +79,10 @@ public interface RenderingEngine
* @param formInstanceData the xml content to serialize.
* @param ret the rendering engine template
* @param form the form that collected the xml content.
* @param parameters the set of parameters to the rendering engine
* @param out the output stream to serialize to.
* @param rendition the rendition to serialize to.
*/
public void render(final Document formInstanceData,
public void render(final FormInstanceData formInstanceData,
final RenderingEngineTemplate ret,
final Map<String, String> parameters,
final OutputStream out)
throws IOException, RenderingException;
final Rendition rendition)
throws IOException, RenderingException, SAXException;
}

View File

@@ -23,6 +23,7 @@ import java.io.OutputStream;
import java.io.Serializable;
import java.util.Map;
import org.w3c.dom.Document;
import org.xml.sax.SAXException;
/**
* Describes a template that is used for rendering form instance data.
@@ -51,13 +52,6 @@ public interface RenderingEngineTemplate
*/
public RenderingEngine getRenderingEngine();
/**
* Provides the noderef for this template.
*
* @return the noderef for this template.
*/
public NodeRef getNodeRef();
/**
* Provides an input stream to the rendering engine template.
*
@@ -82,6 +76,11 @@ public interface RenderingEngineTemplate
*/
public String getMimetypeForRendition();
public void registerRendition(final Rendition rendition,
final FormInstanceData primaryFormInstanceData);
/**
* Produces a rendition of the provided formInstanceData.
*/
public Rendition render(final FormInstanceData formInstanceData)
throws IOException,
SAXException,
RenderingEngine.RenderingException;
}

View File

@@ -17,32 +17,21 @@
package org.alfresco.web.forms;
import freemarker.ext.dom.NodeModel;
import freemarker.template.SimpleDate;
import freemarker.template.SimpleHash;
import freemarker.template.SimpleScalar;
import freemarker.template.TemplateHashModel;
import freemarker.template.TemplateModel;
import freemarker.template.TemplateModelException;
import java.io.IOException;
import java.io.InputStream;
import java.io.Serializable;
import java.util.Date;
import java.util.HashMap;
import java.util.Map;
import freemarker.template.*;
import java.io.*;
import java.text.MessageFormat;
import java.util.*;
import javax.faces.context.FacesContext;
import org.alfresco.model.ContentModel;
import org.alfresco.model.WCMAppModel;
import org.alfresco.repo.avm.AVMNodeConverter;
import org.alfresco.repo.domain.PropertyValue;
import org.alfresco.service.ServiceRegistry;
import org.alfresco.service.cmr.avm.AVMService;
import org.alfresco.service.cmr.repository.ContentReader;
import org.alfresco.service.cmr.repository.ContentService;
import org.alfresco.service.cmr.repository.MimetypeService;
import org.alfresco.service.cmr.repository.NodeRef;
import org.alfresco.service.cmr.repository.NodeService;
import org.alfresco.service.cmr.repository.TemplateNode;
import org.alfresco.service.cmr.repository.TemplateService;
import org.alfresco.service.cmr.dictionary.DataTypeDefinition;
import org.alfresco.service.cmr.repository.*;
import org.alfresco.service.namespace.QName;
import org.alfresco.web.app.Application;
import org.alfresco.web.bean.repository.Repository;
import org.alfresco.web.bean.wcm.AVMConstants;
import org.apache.commons.logging.Log;
@@ -64,6 +53,14 @@ public class RenderingEngineTemplateImpl
protected RenderingEngineTemplateImpl(final NodeRef nodeRef,
final NodeRef renditionPropertiesNodeRef)
{
if (nodeRef == null)
{
throw new NullPointerException();
}
if (renditionPropertiesNodeRef == null)
{
throw new NullPointerException();
}
this.nodeRef = nodeRef;
this.renditionPropertiesNodeRef = renditionPropertiesNodeRef;
}
@@ -91,7 +88,7 @@ public class RenderingEngineTemplateImpl
{
final NodeService nodeService = this.getServiceRegistry().getNodeService();
return (String)nodeService.getProperty(this.renditionPropertiesNodeRef,
WCMAppModel.PROP_OUTPUT_PATH_PATTERN_RENDITION);
WCMAppModel.PROP_OUTPUT_PATH_PATTERN);
}
public NodeRef getNodeRef()
@@ -99,6 +96,11 @@ public class RenderingEngineTemplateImpl
return this.nodeRef;
}
public NodeRef getRenditionPropertiesNodeRef()
{
return this.renditionPropertiesNodeRef;
}
/**
* Provides an input stream to the rendering engine template.
*
@@ -133,15 +135,12 @@ public class RenderingEngineTemplateImpl
*
* @return the output path to use for renditions.
*/
public String getOutputPathForRendition(final FormInstanceData formInstanceData)
public String getOutputPathForRendition(final FormInstanceData formInstanceData /*,final String parentAVMPath */)
{
final ServiceRegistry sr = this.getServiceRegistry();
final NodeService nodeService = sr.getNodeService();
final AVMService avmService = sr.getAVMService();
final String outputPathPattern = (String)
nodeService.getProperty(this.renditionPropertiesNodeRef,
WCMAppModel.PROP_OUTPUT_PATH_PATTERN_RENDITION);
final String formInstanceDataAVMPath = formInstanceData.getPath();
final Map<String, Object> root = new HashMap<String, Object>();
@@ -161,18 +160,18 @@ public class RenderingEngineTemplateImpl
try
{
final FormsService fs = FormsService.getInstance();
root.put("xml", NodeModel.wrap(fs.parseXML(formInstanceData.getNodeRef())));
root.put("xml", NodeModel.wrap(formInstanceData.getDocument()));
}
catch (Exception e)
{
LOGGER.error(e);
}
root.put("node", new TemplateNode(formInstanceData.getNodeRef(), sr, null));
root.put("node", new TemplateNode(((FormInstanceDataImpl)formInstanceData).getNodeRef(), sr, null));
root.put("date", new SimpleDate(new Date(), SimpleDate.DATETIME));
final TemplateService templateService = sr.getTemplateService();
final String outputPathPattern = this.getOutputPathPattern();
String result = templateService.processTemplateString(null,
outputPathPattern,
new SimpleHash(root));
@@ -196,19 +195,70 @@ public class RenderingEngineTemplateImpl
WCMAppModel.PROP_MIMETYPE_FOR_RENDITION);
}
public void registerRendition(final Rendition rendition,
final FormInstanceData primaryFormInstanceData)
/**
* Produces a rendition of the provided formInstanceData.
*/
public Rendition render(final FormInstanceData formInstanceData)
throws IOException,
SAXException,
RenderingEngine.RenderingException
{
final NodeService nodeService = this.getServiceRegistry().getNodeService();
final Map<QName, Serializable> props = new HashMap<QName, Serializable>(2, 1.0f);
props.put(WCMAppModel.PROP_PARENT_RENDERING_ENGINE_TEMPLATE, this.nodeRef);
final AVMService avmService = this.getServiceRegistry().getAVMService();
final String renditionAvmPath = this.getOutputPathForRendition(formInstanceData);
if (avmService.lookup(-1, renditionAvmPath) == null)
{
final String parentAVMPath = AVMNodeConverter.SplitBase(renditionAvmPath)[0];
AVMConstants.makeAllDirectories(parentAVMPath);
avmService.createFile(parentAVMPath,
AVMNodeConverter.SplitBase(renditionAvmPath)[1]);
if (LOGGER.isDebugEnabled())
LOGGER.debug("Created file node for file: " + renditionAvmPath);
}
final Rendition result = new RenditionImpl(AVMNodeConverter.ToNodeRef(-1, renditionAvmPath));
this.getRenderingEngine().render(formInstanceData, this, result);
avmService.addAspect(renditionAvmPath, WCMAppModel.ASPECT_FORM_INSTANCE_DATA);
avmService.addAspect(renditionAvmPath, ContentModel.ASPECT_TITLED);
avmService.addAspect(renditionAvmPath, WCMAppModel.ASPECT_RENDITION);
final Map<QName, PropertyValue> props = new HashMap<QName, PropertyValue>(5, 1.0f);
props.put(WCMAppModel.PROP_PARENT_FORM_NAME,
new PropertyValue(DataTypeDefinition.TEXT,
formInstanceData.getForm().getName()));
props.put(ContentModel.PROP_TITLE,
new PropertyValue(DataTypeDefinition.TEXT,
AVMNodeConverter.SplitBase(renditionAvmPath)[1]));
final ResourceBundle bundle = Application.getBundle(FacesContext.getCurrentInstance());
props.put(ContentModel.PROP_DESCRIPTION,
new PropertyValue(DataTypeDefinition.TEXT,
MessageFormat.format(bundle.getString("default_rendition_description"),
this.getTitle(),
AVMConstants.getSandboxRelativePath(renditionAvmPath))));
props.put(WCMAppModel.PROP_PARENT_RENDERING_ENGINE_TEMPLATE,
new PropertyValue(DataTypeDefinition.NODE_REF,
this.nodeRef));
props.put(WCMAppModel.PROP_PARENT_RENDITION_PROPERTIES,
new PropertyValue(DataTypeDefinition.NODE_REF,
this.renditionPropertiesNodeRef));
// extract a store relative path for the primary form instance data
String path = primaryFormInstanceData.getPath();
path = path.substring(path.indexOf(':') + 1);
props.put(WCMAppModel.PROP_PRIMARY_FORM_INSTANCE_DATA, path);
props.put(WCMAppModel.PROP_PRIMARY_FORM_INSTANCE_DATA,
new PropertyValue(DataTypeDefinition.TEXT,
AVMConstants.getStoreRelativePath(formInstanceData.getPath())));
nodeService.addAspect(rendition.getNodeRef(), WCMAppModel.ASPECT_RENDITION, props);
avmService.setNodeProperties(renditionAvmPath, props);
final PropertyValue pv =
avmService.getNodeProperty(-1, formInstanceData.getPath(), WCMAppModel.PROP_RENDITIONS);
Collection<Serializable> renditions = (pv == null
? new LinkedList<Serializable>()
: pv.getCollection(DataTypeDefinition.TEXT));
renditions.add(AVMConstants.getStoreRelativePath(renditionAvmPath));
avmService.setNodeProperty(formInstanceData.getPath(),
WCMAppModel.PROP_RENDITIONS,
new PropertyValue(DataTypeDefinition.TEXT,
(Serializable)renditions));
return result;
}
private ServiceRegistry getServiceRegistry()

View File

@@ -16,8 +16,11 @@
*/
package org.alfresco.web.forms;
import org.alfresco.service.cmr.repository.NodeRef;
import java.io.IOException;
import java.io.OutputStream;
import java.io.Serializable;
import org.alfresco.service.cmr.repository.NodeRef;
import org.xml.sax.SAXException;
/**
* Encapsulation of a rendition.
@@ -45,9 +48,6 @@ public interface Rendition
/** the rendering engine template that generated this rendition */
public RenderingEngineTemplate getRenderingEngineTemplate();
/** the node ref containing the contents of this rendition */
public NodeRef getNodeRef();
/** the path to the contents of this rendition */
public String getPath();
@@ -56,4 +56,19 @@ public interface Rendition
/** the file type image for the rendition */
public String getFileTypeImage();
/** the output stream for the rendition */
public OutputStream getOutputStream();
/** regenerates the contents of this rendition using the primary form instance data */
public void regenerate()
throws IOException,
RenderingEngine.RenderingException,
SAXException;
/** regenerates the contents of this rendition using the provided form instance data*/
public void regenerate(final FormInstanceData formInstanceData)
throws IOException,
RenderingEngine.RenderingException,
SAXException;
}

View File

@@ -16,6 +16,8 @@
*/
package org.alfresco.web.forms;
import java.io.IOException;
import java.io.OutputStream;
import javax.faces.context.FacesContext;
import org.alfresco.model.ContentModel;
import org.alfresco.model.WCMAppModel;
@@ -35,6 +37,7 @@ import org.alfresco.web.bean.wcm.AVMConstants;
import org.alfresco.web.ui.common.Utils;
import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;
import org.xml.sax.SAXException;
/**
* Encapsulation of a rendition.
@@ -48,9 +51,14 @@ public class RenditionImpl
private static final Log LOGGER = LogFactory.getLog(RenditionImpl.class);
private final NodeRef nodeRef;
private transient RenderingEngineTemplate renderingEngineTemplate;
public RenditionImpl(final NodeRef nodeRef)
{
if (nodeRef == null)
{
throw new NullPointerException();
}
this.nodeRef = nodeRef;
}
@@ -96,6 +104,8 @@ public class RenditionImpl
/** the rendering engine template that generated this rendition */
public RenderingEngineTemplate getRenderingEngineTemplate()
{
if (this.renderingEngineTemplate == null)
{
final NodeService nodeService = this.getServiceRegistry().getNodeService();
final NodeRef retNodeRef = (NodeRef)
@@ -104,7 +114,9 @@ public class RenditionImpl
final NodeRef rpNodeRef = (NodeRef)
nodeService.getProperty(this.nodeRef,
WCMAppModel.PROP_PARENT_RENDITION_PROPERTIES);
return new RenderingEngineTemplateImpl(retNodeRef, rpNodeRef);
this.renderingEngineTemplate = new RenderingEngineTemplateImpl(retNodeRef, rpNodeRef);
}
return this.renderingEngineTemplate;
}
/** the node ref containing the contents of this rendition */
@@ -128,6 +140,29 @@ public class RenditionImpl
return Utils.getFileTypeImage(this.getName(), false);
}
public OutputStream getOutputStream()
{
return this.getServiceRegistry().getAVMService().getFileOutputStream(this.getPath());
}
public void regenerate()
throws IOException,
RenderingEngine.RenderingException,
SAXException
{
this.regenerate(this.getPrimaryFormInstanceData());
}
public void regenerate(final FormInstanceData formInstanceData)
throws IOException,
RenderingEngine.RenderingException,
SAXException
{
final RenderingEngineTemplate ret = this.getRenderingEngineTemplate();
final RenderingEngine engine = ret.getRenderingEngine();
engine.render(formInstanceData, ret, this);
}
private ServiceRegistry getServiceRegistry()
{
final FacesContext fc = FacesContext.getCurrentInstance();

View File

@@ -0,0 +1,165 @@
/*
* Copyright (C) 2005 Alfresco, Inc.
*
* Licensed under the Mozilla Public License version 1.1
* with a permitted attribution clause. You may obtain a
* copy of the License at
*
* http://www.alfresco.org/legal/license.txt
*
* Unless required by applicable law or agreed to in writing,
* software distributed under the License is distributed on an
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND,
* either express or implied. See the License for the specific
* language governing permissions and limitations under the
* License.
*/
package org.alfresco.web.forms;
import java.io.*;
import javax.xml.parsers.DocumentBuilder;
import javax.xml.parsers.DocumentBuilderFactory;
import javax.xml.parsers.ParserConfigurationException;
import javax.xml.transform.OutputKeys;
import javax.xml.transform.Transformer;
import javax.xml.transform.TransformerException;
import javax.xml.transform.TransformerFactory;
import javax.xml.transform.dom.DOMSource;
import javax.xml.transform.stream.StreamResult;
import org.alfresco.model.ContentModel;
import org.alfresco.service.cmr.repository.ContentReader;
import org.alfresco.service.cmr.repository.ContentService;
import org.alfresco.service.cmr.repository.NodeRef;
import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;
import org.w3c.dom.Document;
import org.w3c.dom.Node;
import org.xml.sax.SAXException;
/**
* XML utility functions.
*
* @author Ariel Backenroth
*/
public class XMLUtil
{
private static final Log LOGGER = LogFactory.getLog(XMLUtil.class);
private static DocumentBuilder documentBuilder;
/** utility function for creating a document */
public static Document newDocument()
{
return XMLUtil.getDocumentBuilder().newDocument();
}
/** utility function for serializing a node */
public static void print(final Node n, final Writer output)
{
try
{
final TransformerFactory tf = TransformerFactory.newInstance();
final Transformer t = tf.newTransformer();
t.setOutputProperty(OutputKeys.INDENT, "yes");
if (LOGGER.isDebugEnabled())
{
LOGGER.debug("writing out a document for " +
(n instanceof Document
? ((Document)n).getDocumentElement()
: n).getNodeName() +
" to " + (output instanceof StringWriter
? "string"
: output));
}
t.transform(new DOMSource(n), new StreamResult(output));
}
catch (TransformerException te)
{
te.printStackTrace();
assert false : te.getMessage();
}
}
/** utility function for serializing a node */
public static void print(final Node n, final File output)
throws IOException
{
XMLUtil.print(n, new FileWriter(output));
}
/** utility function for serializing a node */
public static String toString(final Node n)
{
final StringWriter result = new StringWriter();
XMLUtil.print(n, result);
return result.toString();
}
/** utility function for parsing xml */
public static Document parse(final String source)
throws SAXException,
IOException
{
return XMLUtil.parse(new ByteArrayInputStream(source.getBytes()));
}
/** utility function for parsing xml */
public static Document parse(final NodeRef nodeRef,
final ContentService contentService)
throws SAXException,
IOException
{
final ContentReader contentReader =
contentService.getReader(nodeRef, ContentModel.TYPE_CONTENT);
final InputStream in = contentReader.getContentInputStream();
return XMLUtil.parse(in);
}
/** utility function for parsing xml */
public static Document parse(final File source)
throws SAXException,
IOException
{
return XMLUtil.parse(new FileInputStream(source));
}
/** utility function for parsing xml */
public static Document parse(final InputStream source)
throws SAXException,
IOException
{
final DocumentBuilder db = XMLUtil.getDocumentBuilder();
final Document result = db.parse(source);
source.close();
return result;
}
/** provides a document builder that is namespace aware but not validating by default */
public static DocumentBuilder getDocumentBuilder()
{
if (XMLUtil.documentBuilder == null)
{
XMLUtil.documentBuilder = XMLUtil.getDocumentBuilder(true, false);
}
return XMLUtil.documentBuilder;
}
public static DocumentBuilder getDocumentBuilder(final boolean namespaceAware,
final boolean validating)
try
{
final DocumentBuilderFactory dbf = DocumentBuilderFactory.newInstance();
dbf.setNamespaceAware(namespaceAware);
dbf.setValidating(validating);
XMLUtil.documentBuilder = dbf.newDocumentBuilder();
}
catch (ParserConfigurationException pce)
{
LOGGER.error(pce);
}
}
return XMLUtil.documentBuilder;
}
}

View File

@@ -24,13 +24,13 @@ import javax.xml.transform.dom.DOMSource;
import javax.xml.transform.sax.SAXResult;
import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;
import org.w3c.dom.*;
import org.xml.sax.SAXException;
import org.apache.fop.apps.FOPException;
import org.apache.fop.apps.FOUserAgent;
import org.apache.fop.apps.Fop;
import org.apache.fop.apps.FOPException;
import org.apache.fop.apps.FopFactory;
import org.apache.fop.apps.MimeConstants;
import org.w3c.dom.*;
import org.xml.sax.SAXException;
/**
* A rendering engine which uses xsl-fo templates to generate renditions of
@@ -86,35 +86,40 @@ public class XSLFORenderingEngine
return "fo";
}
public void render(final Document xmlContent,
public void render(final FormInstanceData formInstanceData,
final RenderingEngineTemplate ret,
final Map<String, String> parameters,
final OutputStream out)
final Rendition rendition)
throws IOException,
RenderingEngine.RenderingException
RenderingEngine.RenderingException,
SAXException
{
Result result = null;
String mimetype = MIME_TYPES.get(ret.getMimetypeForRendition());
if (mimetype == null)
{
throw new RenderingEngine.RenderingException("mimetype " + ret.getMimetypeForRendition() +
" is not supported by " + this.getName());
}
final OutputStream out = rendition.getOutputStream();
try
{
final FopFactory fopFactory = FopFactory.newInstance();
final FOUserAgent foUserAgent = fopFactory.newFOUserAgent();
final Fop fop = fopFactory.newFop(mimetype,
foUserAgent,
out);
final Fop fop = fopFactory.newFop(mimetype, foUserAgent, out);
// Resulting SAX events (the generated FO) must be piped through to FOP
result = new SAXResult(fop.getDefaultHandler());
super.render(new DOMSource(formInstanceData.getDocument()),
ret,
this.getStandardParameters(formInstanceData, rendition),
new SAXResult(fop.getDefaultHandler()));
}
catch (FOPException fope)
{
throw new RenderingEngine.RenderingException(fope);
}
super.render(new DOMSource(xmlContent), ret, parameters, result);
finally
{
out.close();
}
}
}

View File

@@ -36,7 +36,7 @@ import org.alfresco.service.cmr.repository.ContentService;
import org.alfresco.service.cmr.repository.NodeRef;
import org.alfresco.service.cmr.repository.NodeService;
import org.alfresco.web.bean.wcm.AVMConstants;
import org.alfresco.web.forms.FormsService;
import org.alfresco.web.forms.XMLUtil;
import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;
import org.apache.xalan.extensions.ExpressionContext;
@@ -138,9 +138,7 @@ public class XSLTRenderingEngine
// create a root document for rooting all the results. we do this
// so that each document root element has a common parent node
// and so that xpath axes work properly
final FormsService fs = FormsService.getInstance();
final DocumentBuilder documentBuilder = fs.getDocumentBuilder();
final Document rootNodeDocument = documentBuilder.newDocument();
final Document rootNodeDocument = XMLUtil.newDocument();
final Element rootNodeDocumentEl =
rootNodeDocument.createElementNS(ALFRESCO_NS,
ALFRESCO_NS_PREFIX + ":file_list");
@@ -286,14 +284,25 @@ public class XSLTRenderingEngine
}
}
public void render(final Document formInstanceData,
public void render(final FormInstanceData formInstanceData,
final RenderingEngineTemplate ret,
final Map<String, String> parameters,
final OutputStream out)
final Rendition rendition)
throws IOException,
RenderingEngine.RenderingException
RenderingEngine.RenderingException,
SAXException
{
this.render(new DOMSource(formInstanceData), ret, parameters, new StreamResult(out));
final OutputStream out = rendition.getOutputStream();
try
{
this.render(new DOMSource(formInstanceData.getDocument()),
ret,
this.getStandardParameters(formInstanceData, rendition),
new StreamResult(out));
}
finally
{
out.close();
}
}
protected void render(final Source formInstanceDataSource,
@@ -301,15 +310,15 @@ public class XSLTRenderingEngine
final Map<String, String> parameters,
final Result result)
throws IOException,
RenderingEngine.RenderingException
RenderingEngine.RenderingException,
SAXException
{
System.setProperty("org.apache.xalan.extensions.bsf.BSFManager",
BSFManager.class.getName());
final FormsService ts = FormsService.getInstance();
Document xslTemplate = null;
try
{
xslTemplate = ts.parseXML(ret.getInputStream());
xslTemplate = XMLUtil.parse(ret.getInputStream());
}
catch (final SAXException sax)
{
@@ -356,9 +365,9 @@ public class XSLTRenderingEngine
{
if (LOGGER.isDebugEnabled())
LOGGER.debug("loading " + uri);
final Document d = ts.parseXML(uri.toURL().openStream());
final Document d = XMLUtil.parse(uri.toURL().openStream());
if (LOGGER.isDebugEnabled())
LOGGER.debug("loaded " + ts.writeXMLToString(d));
LOGGER.debug("loaded " + XMLUtil.toString(d));
return new DOMSource(d);
}
catch (Exception e)

View File

@@ -21,7 +21,7 @@ import java.io.IOException;
import java.io.StringWriter;
import java.util.*;
import javax.xml.transform.*;
import org.alfresco.web.forms.FormsService;
import org.alfresco.web.forms.XMLUtil;
import org.apache.commons.jxpath.JXPathContext;
import org.apache.commons.jxpath.Pointer;
import org.apache.commons.logging.Log;
@@ -73,9 +73,6 @@ public class SchemaFormBuilder
public final static Log LOGGER =
LogFactory.getLog(SchemaFormBuilder.class);
/** XMLNS Namespace declaration. */
public static final String XMLNS_NAMESPACE_URI =
"http://www.w3.org/2000/xmlns/";
/** Alfresco namespace declaration. */
private static final String ALFRESCO_NS =
@@ -288,7 +285,7 @@ public class SchemaFormBuilder
//if target namespace & we use the schema types: add it to form ns declarations
// if (this.targetNamespace != null && this.targetNamespace.length() != 0)
// envelopeElement.setAttributeNS(XMLNS_NAMESPACE_URI,
// envelopeElement.setAttributeNS(XMLConstants.XMLNS_ATTRIBUTE_NS_URI,
// "xmlns:schema",
// this.targetNamespace);
@@ -706,7 +703,7 @@ public class SchemaFormBuilder
if (annotation == null)
return null;
// write annotation to empty doc
final Document doc = FormsService.getInstance().newDocument();
final Document doc = XMLUtil.newDocument();
annotation.writeAnnotation(doc, XSAnnotation.W3C_DOM_DOCUMENT);
final NodeList d = doc.getElementsByTagNameNS(namespace, elementName);
@@ -788,7 +785,7 @@ public class SchemaFormBuilder
if (LOGGER.isDebugEnabled())
{
LOGGER.debug("This attribute comes from an extension: recopy form controls. \n Model section: ");
LOGGER.debug(FormsService.getInstance().writeXMLToString(modelSection));
LOGGER.debug(XMLUtil.toString(modelSection));
}
//find the existing bind Id
@@ -1396,7 +1393,7 @@ public class SchemaFormBuilder
//
if (LOGGER.isDebugEnabled())
{
LOGGER.debug(FormsService.getInstance().writeXMLToString(bindElement2));
LOGGER.debug(XMLUtil.toString(bindElement2));
}
NodeList binds = bindElement2.getElementsByTagNameNS(NamespaceConstants.XFORMS_NS, "bind");
Element thisBind = null;
@@ -1605,7 +1602,7 @@ public class SchemaFormBuilder
if (LOGGER.isDebugEnabled())
{
LOGGER.debug("This element comes from an extension: recopy form controls.\n Model Section=");
LOGGER.debug(FormsService.getInstance().writeXMLToString(modelSection));
LOGGER.debug(XMLUtil.toString(modelSection));
}
//find the existing bind Id
@@ -2072,7 +2069,7 @@ public class SchemaFormBuilder
private Document createFormTemplate(final String formId)
{
final Document xformsDocument = FormsService.getInstance().newDocument();
final Document xformsDocument = XMLUtil.newDocument();
final Element envelopeElement = this.wrapper.createEnvelope(xformsDocument);
this.addNamespace(envelopeElement,

View File

@@ -20,7 +20,7 @@ import java.util.*;
import javax.xml.parsers.DocumentBuilder;
import javax.xml.parsers.DocumentBuilderFactory;
import javax.xml.parsers.ParserConfigurationException;
import org.alfresco.web.forms.FormsService;
import org.alfresco.web.forms.XMLUtil;
import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;
import org.apache.xerces.xs.*;
@@ -216,9 +216,8 @@ public class SchemaUtil
final DOMImplementationLS lsImpl = (DOMImplementationLS)
registry.getDOMImplementation("XML 1.0 LS 3.0");
final FormsService ts = FormsService.getInstance();
final LSInput in = lsImpl.createLSInput();
in.setStringData(ts.writeXMLToString(schemaDocument));
in.setStringData(XMLUtil.toString(schemaDocument));
final XSImplementation xsImpl = (XSImplementation)
registry.getDOMImplementation("XS-Loader");

View File

@@ -278,7 +278,7 @@ public class XFormsBean
final ResponseWriter out = context.getResponseWriter();
final ChibaBean chibaBean = this.xformsSession.chibaBean;
final Node xformsDocument = chibaBean.getXMLContainer();
FormsService.getInstance().writeXML(xformsDocument, out);
XMLUtil.print(xformsDocument, out);
}
/**
@@ -308,7 +308,7 @@ public class XFormsBean
}
final ResponseWriter out = context.getResponseWriter();
FormsService.getInstance().writeXML(this.getEventLog(), out);
XMLUtil.print(this.getEventLog(), out);
out.close();
}
@@ -332,7 +332,7 @@ public class XFormsBean
chibaBean.updateRepeatIndex(id, index);
final ResponseWriter out = context.getResponseWriter();
FormsService.getInstance().writeXML(this.getEventLog(), out);
XMLUtil.print(this.getEventLog(), out);
out.close();
}
@@ -353,7 +353,7 @@ public class XFormsBean
chibaBean.dispatch(id, DOMEventNames.ACTIVATE);
final ResponseWriter out = context.getResponseWriter();
FormsService.getInstance().writeXML(this.getEventLog(), out);
XMLUtil.print(this.getEventLog(), out);
out.close();
}
@@ -368,8 +368,7 @@ public class XFormsBean
final FacesContext context = FacesContext.getCurrentInstance();
final HttpServletRequest request = (HttpServletRequest)
context.getExternalContext().getRequest();
final FormsService formsService = FormsService.getInstance();
final Document result = formsService.parseXML(request.getInputStream());
final Document result = XMLUtil.parse(request.getInputStream());
final Document instanceData = this.xformsSession.getFormInstanceData();
Element documentElement = instanceData.getDocumentElement();
if (documentElement != null)
@@ -383,7 +382,7 @@ public class XFormsBean
instanceData.appendChild(documentElement);
final ResponseWriter out = context.getResponseWriter();
formsService.writeXML(instanceData, out);
XMLUtil.print(instanceData, out);
out.close();
}
catch (Throwable t)
@@ -409,7 +408,7 @@ public class XFormsBean
chibaBean.getContainer().lookup(toItemId));
final ResponseWriter out = context.getResponseWriter();
FormsService.getInstance().writeXML(this.getEventLog(), out);
XMLUtil.print(this.getEventLog(), out);
out.close();
}
@@ -439,8 +438,7 @@ public class XFormsBean
}
LOGGER.debug(this + ".getFilePickerData(" + currentPath + ")");
final FormsService formsService = FormsService.getInstance();
final Document result = formsService.newDocument();
final Document result = XMLUtil.newDocument();
final Element filePickerDataElement = result.createElement("file-picker-data");
result.appendChild(filePickerDataElement);
@@ -483,7 +481,7 @@ public class XFormsBean
}
final ResponseWriter out = facesContext.getResponseWriter();
FormsService.getInstance().writeXML(result, out);
XMLUtil.print(result, out);
out.close();
}
@@ -558,8 +556,7 @@ public class XFormsBean
this.xformsSession.uploads.put(uploadId, uploadNodeRef);
LOGGER.debug("upload complete. sending response");
final FormsService formsService = FormsService.getInstance();
final Document result = formsService.newDocument();
final Document result = XMLUtil.newDocument();
final Element htmlEl = result.createElement("html");
result.appendChild(htmlEl);
final Element bodyEl = result.createElement("body");
@@ -574,7 +571,7 @@ public class XFormsBean
scriptEl.appendChild(scriptText);
final ResponseWriter out = facesContext.getResponseWriter();
formsService.writeXML(result, out);
XMLUtil.print(result, out);
out.close();
}
@@ -638,8 +635,7 @@ public class XFormsBean
private Node getEventLog()
{
final FormsService formsService = FormsService.getInstance();
final Document result = formsService.newDocument();
final Document result = XMLUtil.newDocument();
final Element eventsElement = result.createElement("events");
result.appendChild(eventsElement);
for (XMLEvent xfe : this.xformsSession.eventLog)
@@ -680,8 +676,7 @@ public class XFormsBean
if (LOGGER.isDebugEnabled())
{
LOGGER.debug("generated event log:\n" +
formsService.writeXMLToString(result));
LOGGER.debug("generated event log:\n" + XMLUtil.toString(result));
}
return result;
}
@@ -740,8 +735,7 @@ public class XFormsBean
resourceBundle);
if (LOGGER.isDebugEnabled())
{
LOGGER.debug("generated xform: " +
FormsService.getInstance().writeXMLToString(result));
LOGGER.debug("generated xform: " + XMLUtil.toString(result));
}
return result;
}

View File

@@ -58,7 +58,6 @@ public class XFormsProcessor
public void process(final Session session, final Writer out)
throws FormProcessor.ProcessingException
{
final FormsService ts = FormsService.getInstance();
final FacesContext fc = FacesContext.getCurrentInstance();
//make the XFormsBean available for this session
final XFormsBean xforms = (XFormsBean)
@@ -79,7 +78,7 @@ public class XFormsProcessor
}
final String cp = fc.getExternalContext().getRequestContextPath();
final Document result = ts.newDocument();
final Document result = XMLUtil.newDocument();
// this div is where the ui will write to
final Element div = result.createElement("div");
@@ -120,6 +119,6 @@ public class XFormsProcessor
div.appendChild(e);
}
ts.writeXML(result, out);
XMLUtil.print(result, out);
}
}

View File

@@ -55,7 +55,9 @@ import org.alfresco.web.bean.repository.Repository;
import org.alfresco.web.bean.repository.User;
import org.alfresco.web.bean.wcm.AVMConstants;
import org.alfresco.web.bean.wcm.AVMNode;
import org.alfresco.web.bean.wcm.WebProject;
import org.alfresco.web.config.ClientConfigElement;
import org.alfresco.web.forms.Form;
import org.alfresco.web.ui.common.ComponentConstants;
import org.alfresco.web.ui.common.ConstantMethodBinding;
import org.alfresco.web.ui.common.PanelGenerator;
@@ -115,7 +117,7 @@ public class UIUserSandboxes extends SelfRenderingComponent
private static final String SPACE_ICON = "/images/icons/" + BrowseBean.SPACE_SMALL_DEFAULT + ".gif";
public static final String PARAM_FORM_ID = "form-id";
public static final String PARAM_FORM_NAME = "form-name";
private static final String SCRIPT_MULTISELECT =
"<script>function _sb_select(obj) {" +
@@ -148,7 +150,7 @@ public class UIUserSandboxes extends SelfRenderingComponent
private String[] checkedItems = null;
/** transient list of available web forms */
private List<NodeRef> forms = null;
private List<Form> forms = null;
// ------------------------------------------------------------------------------
@@ -177,16 +179,17 @@ public class UIUserSandboxes extends SelfRenderingComponent
public Object saveState(FacesContext context)
{
Object values[] = new Object[7];
return new Object[]
{
// standard component attributes are saved by the super class
values[0] = super.saveState(context);
values[1] = this.value;
values[2] = this.expandedPanels;
values[3] = this.userToRowLookup;
values[4] = this.rowToUserLookup;
values[5] = this.userNodes;
values[6] = this.checkedItems;
return values;
super.saveState(context),
this.value,
this.expandedPanels,
this.userToRowLookup,
this.rowToUserLookup,
this.userNodes,
this.checkedItems
};
}
/**
@@ -710,13 +713,7 @@ public class UIUserSandboxes extends SelfRenderingComponent
// TODO: execute permission evaluations on a per user basis against each form?
if (this.forms == null)
{
List<ChildAssociationRef> webFormRefs = nodeService.getChildAssocs(
websiteRef, WCMAppModel.ASSOC_WEBFORM, RegexQNamePattern.MATCH_ALL);
this.forms = new ArrayList<NodeRef>(webFormRefs.size());
for (ChildAssociationRef ref : webFormRefs)
{
this.forms.add(ref.getChildRef());
}
this.forms = new WebProject(websiteRef).getForms();
}
if (this.forms.size() != 0)
{
@@ -724,10 +721,10 @@ public class UIUserSandboxes extends SelfRenderingComponent
// output the table of available forms
// TODO: apply tag style - removed hardcoded
out.write("<table class='modifiedItemsList' cellspacing=2 cellpadding=1 border=0 width=100%>");
out.write("<table class='modifiedItemsList' cellspacing='2' cellpadding='1' border='0' width='100%'>");
// header row
out.write("<tr align=left><th>");
out.write("<tr align='left'><th>");
out.write(bundle.getString(MSG_NAME));
out.write("</th><th>");
out.write(bundle.getString(MSG_DESCRIPTION));
@@ -735,13 +732,13 @@ public class UIUserSandboxes extends SelfRenderingComponent
out.write(bundle.getString(MSG_ACTIONS));
out.write("</th></tr>");
for (NodeRef formRef : this.forms)
for (Form f : this.forms)
{
out.write("<tr><td>");
String title = (String)nodeService.getProperty(formRef, ContentModel.PROP_TITLE);
String title = (String)f.getTitle();
out.write(title != null ? title : "");
out.write("</td><td>");
String desc = (String)nodeService.getProperty(formRef, ContentModel.PROP_DESCRIPTION);
String desc = (String)f.getDescription();
out.write(desc != null ? desc : "");
out.write("</td><td>");
// actions
@@ -751,14 +748,21 @@ public class UIUserSandboxes extends SelfRenderingComponent
// create content action passes the ID of the Form to uses
Map<String, String> params = new HashMap<String, String>(3, 1.0f);
// setup a data-binding param for the Form ID
params.put(PARAM_FORM_ID, "#{" + REQUEST_FORM_REF + ".id}");
params.put(PARAM_FORM_NAME, "#{" + REQUEST_FORM_REF + ".name}");
params.put("username", username);
params.put("store", userStorePrefix);
action = createAction(fc, userStorePrefix, username, ACT_CREATE_FORM_CONTENT,
"/images/icons/new_content.gif", "#{AVMBrowseBean.createFormContent}", null, null, params);
action = createAction(fc,
userStorePrefix,
username,
ACT_CREATE_FORM_CONTENT,
"/images/icons/new_content.gif",
"#{AVMBrowseBean.createFormContent}",
null,
null,
params);
}
// set the form-id into the request scope for data binding
requestMap.put(REQUEST_FORM_REF, formRef);
requestMap.put(REQUEST_FORM_REF, f);
Utils.encodeRecursive(fc, action);
requestMap.remove(REQUEST_FORM_REF);
out.write("</td></tr>");

View File

@@ -105,6 +105,15 @@ else
value="#{WizardManager.bean.renderingEngineChoices}"/>
</h:selectOneRadio>
<h:graphicImage id="required-image-name"
value="/images/icons/required_field.gif" alt="Required Field" />
<h:outputText id="name-output-text"
value="#{msg.name}:"/>
<h:inputText id="name"
value="#{WizardManager.bean.renderingEngineTemplateName}"
maxlength="1024"
size="35"/>
<h:outputText id="no_graphic_image_title" value=""/>
<h:outputText id="title-output-text"
value="#{msg.title}:"/>
@@ -161,24 +170,28 @@ else
<h:outputText id="data-table-name-0" value="#{msg.selected_rendering_engine_templates}" />
</f:facet>
<f:verbatim>
<span style="float:left">
<img src="<%= request.getContextPath() %>/images/icons/template_large.gif"/>
</span>
<img style="float: left" src="<%= request.getContextPath() %>/images/icons/template_large.gif"/>
</f:verbatim>
<h:panelGrid id="panel_grid_row"
columns="2" cellpadding="0" cellspacing="1" border="0">
<h:outputText id="data-table-name-0-type" value="#{msg.type}: " />
<h:outputText id="data-table-value-0-type" value="#{row.renderingEngine.name}" />
<f:verbatim><br></f:verbatim>
<h:outputText id="data-table-name-0-name" value="#{msg.file_name}: " />
<h:outputText id="data-table-value-0-name" value="#{row.fileName}" />
<f:verbatim><br></f:verbatim>
<h:outputText id="data-table-name-0-filename" value="#{msg.file_name}: " />
<h:outputText id="data-table-value-0-filename" value="#{row.fileName}" />
<h:outputText id="data-table-name-0-name" value="#{msg.name}: " />
<h:outputText id="data-table-value-0-name" value="#{row.name}" />
<h:outputText id="data-table-name-0-title" value="#{msg.title}: " />
<h:outputText id="data-table-value-0-title" value="#{row.title}" />
<f:verbatim><br clear="all"></f:verbatim>
<h:outputText id="data-table-name-0-mimetype" value="#{msg.mimetype_for_renditions}: " />
<h:outputText id="data-table-value-0-mimetype" value="#{row.mimetypeForRendition}" />
<f:verbatim><br clear="all"></f:verbatim>
<h:outputText id="data-table-name-0-opp" value="#{msg.output_path_pattern}: " />
<h:outputText id="data-table-value-0-opp" value="#{row.outputPathPatternForRendition}" />
</h:panelGrid>
</h:column>
<h:column id="data-table-column-5">
<a:actionLink id="remove-select-rendering-engine-action-link"

View File

@@ -18,12 +18,38 @@
<%@ taglib uri="http://java.sun.com/jsf/core" prefix="f" %>
<%@ taglib uri="/WEB-INF/alfresco.tld" prefix="a" %>
<%@ taglib uri="/WEB-INF/repo.tld" prefix="r" %>
<h:panelGroup>
<f:verbatim><div style="height:108px;*height:112px;width:300px;overflow:auto" class="selectListTable"></f:verbatim>
<a:selectList id="workflow-list" multiSelect="false" style="width:276px" itemStyleClass="selectListItem"
<script type="text/javascript">
function apply_default_workflow_changed(value)
{
document.getElementById("wizard:wizard-body:sdw-pg-2").style.display = value == 'true' ? "block" : "none";
}
</script>
<h:panelGroup id="sdw-pg-1">
<h:outputText id="sdw-question"
value="#{msg.create_form_select_default_workflow_apply_default_workflow}"
escape="false" />
<h:selectOneRadio id="sdw-apply-default-workflow-yes"
required="false"
onchange="apply_default_workflow_changed(this.value)"
value="#{WizardManager.bean.applyDefaultWorkflow}">
<f:selectItem id="sdw-apply-default-workflow-yes-item"
itemLabel="#{msg.yes}" itemValue="true"/>
<f:selectItem id="sdw-apply-defalt-workflow-no-item"
itemLabel="#{msg.no_not_now}" itemValue="false" value="false"/>
</h:selectOneRadio>
<h:panelGroup id="sdw-pg-2" style="#{WizardManager.bean.applyDefaultWorkflow?'display:block':'display:none'}">
<h:outputText id="sdw-select-workflow"
value="#{msg.create_form_select_default_workflow_select_workflow}:"
escape="false" />
<f:verbatim><div id="workflow-list-div"
style="margin:5px 0px;height:108px;*height:112px;width:100%;overflow:auto" class="selectListTable"></f:verbatim>
<a:selectList id="workflow-list"
multiSelect="false"
style="width:100%"
itemStyleClass="selectListItem"
value="#{WizardManager.bean.defaultWorkflowName}">
<a:listItems value="#{WizardManager.bean.defaultWorkflowChoices}" />
</a:selectList>
<f:verbatim></div></f:verbatim>
</h:panelGroup>
</h:panelGroup>

View File

@@ -39,7 +39,7 @@
value="${WizardManager.bean.formInstanceData.name}"
image="/images/filetypes32/xml.gif">
<jsp:attribute name="description">
<div>${msg.form}: ${WizardManager.bean.formInstanceData.form.name}</div>
<div>${msg.form}: ${WizardManager.bean.form.title}</div>
<div>${msg.location}: ${WizardManager.bean.formInstanceData.sandboxRelativePath}</div>
</jsp:attribute>
</a:listItem>

View File

@@ -114,12 +114,12 @@
<tr>
<td>
</f:verbatim>
<h:outputText value="#{msg.website_filename_pattern}:"/>
<h:outputText value="#{msg.output_path_pattern}:"/>
<f:verbatim>
</td>
<td>
</f:verbatim>
<h:inputText id="filepattern" value="#{DialogManager.bean.filenamePattern}" size="35" maxlength="1024" />
<h:inputText id="filepattern" value="#{DialogManager.bean.outputPathPattern}" size="35" maxlength="1024" />
<f:verbatim>
</td>
</tr>

View File

@@ -49,8 +49,8 @@
<f:facet name="header">
<h:outputText value="#{msg.configure}" />
</f:facet>
<h:outputText value="#{msg.website_filename_pattern}:" style="padding-right:4px" />
<h:inputText value="#{row.filenamePattern}" />
<h:outputText value="#{msg.output_path_pattern}:" style="padding-right:4px" />
<h:inputText value="#{row.outputPathPattern}" />
</h:column>
<h:column>
<a:actionLink actionListener="#{DialogManager.bean.removeTemplate}" image="/images/icons/delete.gif"

View File

@@ -54,8 +54,8 @@
<f:verbatim>${r.name}</f:verbatim>
<h:outputText value="#{msg.title}:" styleClass="mainSubTitle" />
<f:verbatim>${r.title}</f:verbatim>
<h:outputText value="#{msg.website_filename_pattern}:" styleClass="mainSubTitle" />
<f:verbatim>${r.filenamePattern}</f:verbatim>
<h:outputText value="#{msg.output_path_pattern}:" styleClass="mainSubTitle" />
<f:verbatim>${r.outputPathPattern}</f:verbatim>
<h:outputText value="#{msg.workflow}:" styleClass="mainSubTitle" />
<c:if test="${r.workflow != null}">
<f:verbatim>${r.workflow.title}</f:verbatim>