- some improved error handling for editing of renditions when the form instance data has been reverted

- not caching the forms list within the web project as it is not being properly refreshed when the web project is edited
- better error handling in create web content for when the workflow has not properly been configured.
- more work on getting edit and preview working from manage tasks screen.  it should all be in place now though i am completely unable to preview right now - need to hear back from jon.  had to reduce reliance on AVMBrowseBean from actions since the current path is not necessarily properly set since it's outside of a browse context.
- some error handling in rendition if the primary form instance data is not there.
- adding a backward webproject noderef reference to the staging store to make it possible to get web project properties without an avmbrowsebean context

git-svn-id: https://svn.alfresco.com/repos/alfresco-enterprise/alfresco/HEAD/root@4708 c4b6b30b-aa2e-2d43-bbcb-ca4b014f7261
This commit is contained in:
Ariel Backenroth
2007-01-03 01:06:16 +00:00
parent 89e06d4afd
commit 7a5bb10b67
14 changed files with 225 additions and 60 deletions

View File

@@ -179,9 +179,11 @@
</action-group> </action-group>
<action-group id="edit_wcm_package_item_actions"> <action-group id="edit_wcm_package_item_actions">
<action idref="file_details" />
<action idref="edit_file" /> <action idref="edit_file" />
<action idref="update_file" /> <action idref="update_file" />
<action idref="revert" />
<action idref="preview_file" />
<action idref="file_details" />
<action idref="workflow_checkout_doc" /> <action idref="workflow_checkout_doc" />
<action idref="workflow_checkin_doc" /> <action idref="workflow_checkin_doc" />
<action idref="workflow_cancelcheckout_doc" /> <action idref="workflow_cancelcheckout_doc" />
@@ -211,9 +213,11 @@
</action-group> </action-group>
<action-group id="edit_and_remove_wcm_package_item_actions"> <action-group id="edit_and_remove_wcm_package_item_actions">
<action idref="file_details" />
<action idref="edit_file"/> <action idref="edit_file"/>
<action idref="update_file" /> <action idref="update_file" />
<action idref="revert" />
<action idref="preview_file" />
<action idref="file_details" />
<action idref="workflow_checkout_doc" /> <action idref="workflow_checkout_doc" />
<action idref="workflow_checkin_doc" /> <action idref="workflow_checkin_doc" />
<action idref="workflow_cancelcheckout_doc" /> <action idref="workflow_cancelcheckout_doc" />

View File

@@ -740,6 +740,7 @@ public final class AVMConstants
public final static String PROP_SANDBOXID = ".sandbox-id."; public final static String PROP_SANDBOXID = ".sandbox-id.";
public final static String PROP_DNS = ".dns."; public final static String PROP_DNS = ".dns.";
public final static String PROP_SANDBOX_STORE_PREFIX = ".sandbox.store."; public final static String PROP_SANDBOX_STORE_PREFIX = ".sandbox.store.";
public final static QName PROP_WEB_PROJECT_NODE_REF = QName.createQName(null, ".web_project.noderef");
public final static QName PROP_SANDBOX_STAGING_MAIN = QName.createQName(null, ".sandbox.staging.main"); public final static QName PROP_SANDBOX_STAGING_MAIN = QName.createQName(null, ".sandbox.staging.main");
public final static QName PROP_SANDBOX_STAGING_PREVIEW = QName.createQName(null, ".sandbox.staging.preview"); public final static QName PROP_SANDBOX_STAGING_PREVIEW = QName.createQName(null, ".sandbox.staging.preview");
public final static QName PROP_SANDBOX_AUTHOR_MAIN = QName.createQName(null, ".sandbox.author.main"); public final static QName PROP_SANDBOX_AUTHOR_MAIN = QName.createQName(null, ".sandbox.author.main");

View File

@@ -17,6 +17,7 @@
package org.alfresco.web.bean.wcm; package org.alfresco.web.bean.wcm;
import java.io.File; import java.io.File;
import java.io.FileNotFoundException;
import java.text.MessageFormat; import java.text.MessageFormat;
import java.util.ArrayList; import java.util.ArrayList;
import java.util.List; import java.util.List;
@@ -29,9 +30,11 @@ import org.alfresco.model.ContentModel;
import org.alfresco.model.WCMAppModel; import org.alfresco.model.WCMAppModel;
import org.alfresco.repo.avm.AVMNodeConverter; import org.alfresco.repo.avm.AVMNodeConverter;
import org.alfresco.repo.content.MimetypeMap; import org.alfresco.repo.content.MimetypeMap;
import org.alfresco.repo.domain.PropertyValue;
import org.alfresco.service.cmr.avm.AVMService; import org.alfresco.service.cmr.avm.AVMService;
import org.alfresco.service.cmr.avmsync.AVMDifference; import org.alfresco.service.cmr.avmsync.AVMDifference;
import org.alfresco.service.cmr.avmsync.AVMSyncService; import org.alfresco.service.cmr.avmsync.AVMSyncService;
import org.alfresco.service.cmr.dictionary.DataTypeDefinition;
import org.alfresco.service.cmr.repository.ContentReader; import org.alfresco.service.cmr.repository.ContentReader;
import org.alfresco.service.cmr.repository.ContentService; import org.alfresco.service.cmr.repository.ContentService;
import org.alfresco.service.cmr.repository.ContentWriter; import org.alfresco.service.cmr.repository.ContentWriter;
@@ -75,7 +78,8 @@ public class AVMEditBean
private File file = null; private File file = null;
private String fileName = null; private String fileName = null;
protected FormProcessor.Session formProcessorSession = null; protected FormProcessor.Session formProcessorSession = null;
private Form form = null;
/** AVM service bean reference */ /** AVM service bean reference */
protected AVMService avmService; protected AVMService avmService;
@@ -233,10 +237,15 @@ public class AVMEditBean
*/ */
public Form getForm() public Form getForm()
{ {
final String formName = (String) if (this.form == null)
this.nodeService.getProperty(this.getAvmNode().getNodeRef(), {
WCMAppModel.PROP_PARENT_FORM_NAME); final String formName = (String)
return this.avmBrowseBean.getWebProject().getForm(formName); this.nodeService.getProperty(this.getAvmNode().getNodeRef(),
WCMAppModel.PROP_PARENT_FORM_NAME);
final WebProject wp = new WebProject(this.getAvmNode().getPath());
this.form = wp.getForm(formName);
}
return this.form;
} }
/** /**
@@ -296,17 +305,27 @@ public class AVMEditBean
{ {
if (LOGGER.isDebugEnabled()) if (LOGGER.isDebugEnabled())
LOGGER.debug(avmPath + " is a rendition, editing primary rendition instead"); LOGGER.debug(avmPath + " is a rendition, editing primary rendition instead");
avmPath = new RenditionImpl(AVMNodeConverter.ToNodeRef(-1, avmPath)).getPrimaryFormInstanceData().getPath(); try
{
if (LOGGER.isDebugEnabled()) final FormInstanceData fid =
LOGGER.debug("Editing primary form instance data " + avmPath); new RenditionImpl(AVMNodeConverter.ToNodeRef(-1, avmPath)).getPrimaryFormInstanceData();
this.avmBrowseBean.setAvmActionNode(new AVMNode(this.avmService.lookup(-1, avmPath))); avmPath = fid.getPath();
if (LOGGER.isDebugEnabled())
LOGGER.debug("Editing primary form instance data " + avmPath);
this.avmBrowseBean.setAvmActionNode(new AVMNode(this.avmService.lookup(-1, avmPath)));
}
catch (FileNotFoundException fnfe)
{
this.avmService.removeAspect(avmPath, WCMAppModel.ASPECT_RENDITION);
this.avmService.removeAspect(avmPath, WCMAppModel.ASPECT_FORM_INSTANCE_DATA);
Utils.addErrorMessage(fnfe.getMessage(), fnfe);
}
} }
if (this.avmService.hasAspect(-1, avmPath, WCMAppModel.ASPECT_FORM_INSTANCE_DATA)) if (this.avmService.hasAspect(-1, avmPath, WCMAppModel.ASPECT_FORM_INSTANCE_DATA))
{ {
// reset the preview layer // reset the preview layer
String storeName = AVMConstants.getStoreName(this.avmBrowseBean.getCurrentPath()); String storeName = AVMConstants.getStoreName(avmPath);
storeName = AVMConstants.getCorrespondingPreviewStoreName(storeName); storeName = AVMConstants.getCorrespondingPreviewStoreName(storeName);
final String path = AVMConstants.buildStoreRootPath(storeName); final String path = AVMConstants.buildStoreRootPath(storeName);
if (LOGGER.isDebugEnabled()) if (LOGGER.isDebugEnabled())

View File

@@ -588,7 +588,8 @@ public class CreateFormWizard
{ {
if (LOGGER.isDebugEnabled()) if (LOGGER.isDebugEnabled())
{ {
LOGGER.debug("schemaFileValueChanged(" + this.getSchemaFile() + ")"); LOGGER.debug("schemaFileValueChanged(" + this.getFileName(FILE_SCHEMA) + "[" +
this.getSchemaFile() + "])");
} }
if (this.getSchemaFile() != null) if (this.getSchemaFile() != null)
{ {
@@ -599,9 +600,9 @@ public class CreateFormWizard
} }
catch (Exception e) catch (Exception e)
{ {
final String msg = "unable to parse " + this.getSchemaFileName(); final String msg = "unable to parse " + this.getFileName(FILE_SCHEMA);
this.removeUploadedSchemaFile(); this.removeUploadedSchemaFile();
Utils.addErrorMessage(msg, e); Utils.addErrorMessage(msg + ": " + e.getMessage(), e);
} }
} }
return null; return null;
@@ -822,8 +823,7 @@ public class CreateFormWizard
} }
if (LOGGER.isDebugEnabled()) if (LOGGER.isDebugEnabled())
{ {
LOGGER.debug("getSchemaRootElementNameChoices(" + this.schema + LOGGER.debug("getSchemaRootElementNameChoices(" + this.schema + ") = " + result.size());
") = " + result.size());
} }
return result; return result;
} }

View File

@@ -317,6 +317,12 @@ public class CreateWebContentWizard extends BaseContentWizard
if (LOGGER.isDebugEnabled()) if (LOGGER.isDebugEnabled())
LOGGER.debug("starting workflow " + wd + " with parameters " + parameters); LOGGER.debug("starting workflow " + wd + " with parameters " + parameters);
if (parameters == null)
{
Utils.addErrorMessage(Application.getMessage(context, "submit_workflow_config_error"));
return null;
}
// start the workflow to get access to the start task // start the workflow to get access to the start task
WorkflowPath path = this.workflowService.startWorkflow(wd.id, null); WorkflowPath path = this.workflowService.startWorkflow(wd.id, null);

View File

@@ -184,7 +184,7 @@ public class CreateWebsiteWizard extends BaseWizardBean
if (outcome != null) if (outcome != null)
{ {
// create the AVM staging store to represent the newly created location website // create the AVM staging store to represent the newly created location website
SandboxFactory.createStagingSandbox(avmStore, wiz.getManagers()); SandboxFactory.createStagingSandbox(avmStore, nodeRef, wiz.getManagers());
// create the default webapp folder under the hidden system folders // create the default webapp folder under the hidden system folders
final String stagingStore = AVMConstants.buildStagingStoreName(avmStore); final String stagingStore = AVMConstants.buildStagingStoreName(avmStore);

View File

@@ -65,9 +65,12 @@ public final class SandboxFactory
* Website Name: .website.name = website name * Website Name: .website.name = website name
* *
* @param storeId The store name to create the sandbox for * @param storeId The store name to create the sandbox for
* @param webProjectNodeRef The noderef for the webproject.
* @param managers The list of authorities who have ContentManager role in the website * @param managers The list of authorities who have ContentManager role in the website
*/ */
public static SandboxInfo createStagingSandbox(final String storeId, final List<String> managers) public static SandboxInfo createStagingSandbox(final String storeId,
final NodeRef webProjectNodeRef,
final List<String> managers)
{ {
final ServiceRegistry services = Repository.getServiceRegistry(FacesContext.getCurrentInstance()); final ServiceRegistry services = Repository.getServiceRegistry(FacesContext.getCurrentInstance());
final AVMService avmService = services.getAVMService(); final AVMService avmService = services.getAVMService();
@@ -93,6 +96,9 @@ public final class SandboxFactory
avmService.setStoreProperty(stagingStoreName, avmService.setStoreProperty(stagingStoreName,
AVMConstants.PROP_SANDBOX_STAGING_MAIN, AVMConstants.PROP_SANDBOX_STAGING_MAIN,
new PropertyValue(DataTypeDefinition.TEXT, null)); new PropertyValue(DataTypeDefinition.TEXT, null));
avmService.setStoreProperty(stagingStoreName,
AVMConstants.PROP_WEB_PROJECT_NODE_REF,
new PropertyValue(DataTypeDefinition.NODE_REF, webProjectNodeRef));
// tag the store with the DNS name property // tag the store with the DNS name property
tagStoreDNSPath(avmService, stagingStoreName, storeId); tagStoreDNSPath(avmService, stagingStoreName, storeId);

View File

@@ -16,38 +16,40 @@
*/ */
package org.alfresco.web.bean.wcm; 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.IOException;
import java.io.Serializable; import java.io.Serializable;
import java.util.List; import java.io.Serializable;
import java.util.*; import java.util.*;
import java.util.List;
import javax.faces.context.FacesContext; import javax.faces.context.FacesContext;
import org.alfresco.model.ContentModel; import org.alfresco.model.ContentModel;
import org.alfresco.model.WCMAppModel; import org.alfresco.model.WCMAppModel;
import org.alfresco.service.ServiceRegistry; import org.alfresco.service.ServiceRegistry;
import org.alfresco.service.cmr.avm.AVMService;
import org.alfresco.service.cmr.dictionary.DataTypeDefinition;
import org.alfresco.service.cmr.repository.AssociationRef; import org.alfresco.service.cmr.repository.AssociationRef;
import org.alfresco.service.cmr.repository.ChildAssociationRef; import org.alfresco.service.cmr.repository.ChildAssociationRef;
import org.alfresco.service.cmr.repository.ContentService; import org.alfresco.service.cmr.repository.ContentService;
import org.alfresco.service.cmr.repository.NodeRef; import org.alfresco.service.cmr.repository.NodeRef;
import org.alfresco.service.cmr.repository.NodeRef;
import org.alfresco.service.cmr.repository.NodeService; import org.alfresco.service.cmr.repository.NodeService;
import org.alfresco.service.cmr.repository.TemplateService; import org.alfresco.service.cmr.repository.TemplateService;
import org.alfresco.service.cmr.workflow.WorkflowDefinition; import org.alfresco.service.cmr.workflow.WorkflowDefinition;
import org.alfresco.service.cmr.workflow.WorkflowDefinition;
import org.alfresco.service.cmr.workflow.WorkflowService; import org.alfresco.service.cmr.workflow.WorkflowService;
import org.alfresco.service.namespace.QName; import org.alfresco.service.namespace.QName;
import org.alfresco.service.namespace.RegexQNamePattern; import org.alfresco.service.namespace.RegexQNamePattern;
import org.alfresco.web.app.servlet.DownloadContentServlet;
import org.alfresco.web.bean.repository.Repository; 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.AVMConstants;
import org.alfresco.web.forms.*; import org.alfresco.web.forms.*;
import org.alfresco.web.forms.xforms.XFormsProcessor; 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.Log;
import org.apache.commons.logging.LogFactory; import org.apache.commons.logging.LogFactory;
import org.w3c.dom.*; import org.w3c.dom.*;
import org.w3c.dom.Document;
import org.xml.sax.SAXException;
/** /**
* Provides configured data for a web project. * Provides configured data for a web project.
@@ -165,13 +167,21 @@ public class WebProject
private static final String ROLE_CONTENT_MANAGER = "ContentManager"; private static final String ROLE_CONTENT_MANAGER = "ContentManager";
private final NodeRef nodeRef; private final NodeRef nodeRef;
private Map<String, Form> forms;
public WebProject(final NodeRef nodeRef) public WebProject(final NodeRef nodeRef)
{ {
this.nodeRef = nodeRef; this.nodeRef = nodeRef;
} }
public WebProject(final String avmPath)
{
String stagingStore = AVMConstants.buildStagingStoreName(AVMConstants.getStoreId(AVMConstants.getStoreName(avmPath)));
final AVMService avmService = this.getServiceRegistry().getAVMService();
this.nodeRef = (NodeRef)
avmService.getStoreProperty(stagingStore,
AVMConstants.PROP_WEB_PROJECT_NODE_REF).getValue(DataTypeDefinition.NODE_REF);
}
/** /**
* Returns the name of the web project. * Returns the name of the web project.
* *
@@ -281,24 +291,21 @@ public class WebProject
private Map<String, Form> getFormsImpl() 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);
Map<String, Form> result = new HashMap<String, Form>(formRefs.size(), 1.0f);
for (final ChildAssociationRef ref : formRefs)
{ {
final ServiceRegistry serviceRegistry = this.getServiceRegistry(); final String formName = (String)
final NodeService nodeService = serviceRegistry.getNodeService(); nodeService.getProperty(ref.getChildRef(), WCMAppModel.PROP_FORMNAME);
final List<ChildAssociationRef> formRefs = final Form baseForm = FormsService.getInstance().getForm(formName);
nodeService.getChildAssocs(this.nodeRef, result.put(formName, new FormWrapper(baseForm, ref.getChildRef()));
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; return result;
} }
private ServiceRegistry getServiceRegistry() private ServiceRegistry getServiceRegistry()

View File

@@ -36,6 +36,7 @@ import org.alfresco.web.bean.repository.Repository;
import org.alfresco.web.bean.repository.TransientNode; import org.alfresco.web.bean.repository.TransientNode;
import org.alfresco.web.bean.wcm.AVMConstants; import org.alfresco.web.bean.wcm.AVMConstants;
import org.alfresco.web.bean.wcm.AVMNode; import org.alfresco.web.bean.wcm.AVMNode;
import org.alfresco.web.config.ClientConfigElement;
import org.alfresco.web.config.DialogsConfigElement.DialogButtonConfig; import org.alfresco.web.config.DialogsConfigElement.DialogButtonConfig;
import org.alfresco.web.ui.common.Utils; import org.alfresco.web.ui.common.Utils;
import org.alfresco.web.ui.common.component.UIActionLink; import org.alfresco.web.ui.common.component.UIActionLink;
@@ -544,8 +545,7 @@ public class ManageTaskDialog extends BaseDialogBean
WCMModel.PROP_AVM_DIR_INDIRECTION); WCMModel.PROP_AVM_DIR_INDIRECTION);
final String stagingAvmPath = AVMNodeConverter.ToAVMVersionPath(stagingNodeRef).getSecond(); final String stagingAvmPath = AVMNodeConverter.ToAVMVersionPath(stagingNodeRef).getSecond();
final String packageAvmPath = AVMNodeConverter.ToAVMVersionPath(this.workflowPackage).getSecond(); final String packageAvmPath = AVMNodeConverter.ToAVMVersionPath(this.workflowPackage).getSecond();
LOGGER.debug("comparing " + packageAvmPath + LOGGER.debug("comparing " + packageAvmPath + " with " + stagingAvmPath);
" with " + stagingAvmPath);
for (AVMDifference d : this.avmSyncService.compare(-1, packageAvmPath, for (AVMDifference d : this.avmSyncService.compare(-1, packageAvmPath,
-1, stagingAvmPath, -1, stagingAvmPath,
null)) null))
@@ -685,10 +685,18 @@ public class ManageTaskDialog extends BaseDialogBean
// ------------------------------------------------------------------------------ // ------------------------------------------------------------------------------
// Helper methods // Helper methods
protected void addAVMNode(AVMNode node) protected void addAVMNode(final AVMNode node)
{ {
LOGGER.debug("adding node " + node); LOGGER.debug("adding node " + node);
node.getProperties().put("taskId", this.task.id); node.getProperties().put("taskId", this.task.id);
final ClientConfigElement config = Application.getClientConfig(FacesContext.getCurrentInstance());
final String dns = AVMConstants.lookupStoreDNS(AVMConstants.getStoreName(node.getPath()));
node.getProperties().put("previewUrl",
AVMConstants.buildAssetUrl(AVMConstants.getSandboxRelativePath(node.getPath()),
config.getWCMDomain(),
config.getWCMPort(),
dns));
this.browseBean.setupCommonBindingProperties(node); this.browseBean.setupCommonBindingProperties(node);
final String packagePath = AVMNodeConverter.ToAVMVersionPath(this.workflowPackage).getSecond(); final String packagePath = AVMNodeConverter.ToAVMVersionPath(this.workflowPackage).getSecond();
NodePropertyResolver resolverPath = new NodePropertyResolver() NodePropertyResolver resolverPath = new NodePropertyResolver()
@@ -714,9 +722,6 @@ public class ManageTaskDialog extends BaseDialogBean
// node.remove("path"); // node.remove("path");
// node.addPropertyResolver("path", resolverPath); // node.addPropertyResolver("path", resolverPath);
// node.addPropertyResolver("displayPath", resolverPath); // node.addPropertyResolver("displayPath", resolverPath);
LOGGER.debug("created mapnode " + node);
this.resources.add(node); this.resources.add(node);
} }

View File

@@ -108,9 +108,6 @@ public class FormImpl
? (String)nodeService.getProperty(workflowRef, WCMAppModel.PROP_WORKFLOW_NAME) ? (String)nodeService.getProperty(workflowRef, WCMAppModel.PROP_WORKFLOW_NAME)
: null); : null);
if (LOGGER.isDebugEnabled())
LOGGER.debug("using workflow " + workflowName + " for form " + this.getName());
return workflowName != null ? workflowService.getDefinitionByName(workflowName) : null; return workflowName != null ? workflowService.getDefinitionByName(workflowName) : null;
} }

View File

@@ -16,10 +16,10 @@
*/ */
package org.alfresco.web.forms; package org.alfresco.web.forms;
import java.io.FileNotFoundException;
import java.io.IOException; import java.io.IOException;
import java.io.OutputStream; import java.io.OutputStream;
import java.io.Serializable; import java.io.Serializable;
import org.alfresco.service.cmr.repository.NodeRef;
import org.xml.sax.SAXException; import org.xml.sax.SAXException;
/** /**
@@ -43,7 +43,8 @@ public interface Rendition
public String getSandboxRelativePath(); public String getSandboxRelativePath();
/** the primary form instance data used to generate this rendition */ /** the primary form instance data used to generate this rendition */
public FormInstanceData getPrimaryFormInstanceData(); public FormInstanceData getPrimaryFormInstanceData()
throws FileNotFoundException;
/** the rendering engine template that generated this rendition */ /** the rendering engine template that generated this rendition */
public RenderingEngineTemplate getRenderingEngineTemplate(); public RenderingEngineTemplate getRenderingEngineTemplate();

View File

@@ -16,6 +16,7 @@
*/ */
package org.alfresco.web.forms; package org.alfresco.web.forms;
import java.io.FileNotFoundException;
import java.io.IOException; import java.io.IOException;
import java.io.OutputStream; import java.io.OutputStream;
import javax.faces.context.FacesContext; import javax.faces.context.FacesContext;
@@ -23,7 +24,10 @@ import org.alfresco.model.ContentModel;
import org.alfresco.model.WCMAppModel; import org.alfresco.model.WCMAppModel;
import org.alfresco.service.cmr.repository.NodeRef; import org.alfresco.service.cmr.repository.NodeRef;
import org.alfresco.repo.avm.AVMNodeConverter; import org.alfresco.repo.avm.AVMNodeConverter;
import org.alfresco.repo.domain.PropertyValue;
import org.alfresco.service.ServiceRegistry; import org.alfresco.service.ServiceRegistry;
import org.alfresco.service.cmr.avm.AVMService;
import org.alfresco.service.cmr.dictionary.DataTypeDefinition;
import org.alfresco.service.cmr.repository.ContentReader; import org.alfresco.service.cmr.repository.ContentReader;
import org.alfresco.service.cmr.repository.ContentService; import org.alfresco.service.cmr.repository.ContentService;
import org.alfresco.service.cmr.repository.MimetypeService; import org.alfresco.service.cmr.repository.MimetypeService;
@@ -89,17 +93,21 @@ public class RenditionImpl
} }
public FormInstanceData getPrimaryFormInstanceData() public FormInstanceData getPrimaryFormInstanceData()
throws FileNotFoundException
{ {
final AVMService avmService = this.getServiceRegistry().getAVMService();
final NodeService nodeService = this.getServiceRegistry().getNodeService(); final NodeService nodeService = this.getServiceRegistry().getNodeService();
final String fidAVMStoreRelativePath = (String) final String fidAVMStoreRelativePath = (String)
nodeService.getProperty(this.nodeRef, nodeService.getProperty(this.nodeRef,
WCMAppModel.PROP_PRIMARY_FORM_INSTANCE_DATA); WCMAppModel.PROP_PRIMARY_FORM_INSTANCE_DATA);
String avmStore = AVMNodeConverter.ToAVMVersionPath(this.nodeRef).getSecond(); String avmStore = AVMNodeConverter.ToAVMVersionPath(this.nodeRef).getSecond();
avmStore = avmStore.substring(0, avmStore.indexOf(':')); avmStore = avmStore.substring(0, avmStore.indexOf(':'));
final String path = avmStore + ':' + fidAVMStoreRelativePath;
final NodeRef fidNodeRef = if (avmService.lookup(-1, path) == null)
AVMNodeConverter.ToNodeRef(-1, avmStore + ':' + fidAVMStoreRelativePath); {
return new FormInstanceDataImpl(fidNodeRef); throw new FileNotFoundException("unable to find primary form instance data " + path);
}
return new FormInstanceDataImpl(AVMNodeConverter.ToNodeRef(-1, path));
} }
/** the rendering engine template that generated this rendition */ /** the rendering engine template that generated this rendition */

View File

@@ -0,0 +1,80 @@
<?xml version="1.0"?>
<xs:schema xmlns:xs="http://www.w3.org/2001/XMLSchema"
xmlns:alfresco="http://www.alfresco.org/alfresco"
targetNamespace="http://www.alfresco.org/alfresco"
elementFormDefault="qualified">
<xs:element name="ist-topic">
<xs:complexType>
<xs:sequence>
<xs:element name="page_title" type="xs:string"/>
<xs:element name="image" type="xs:string"/>
<xs:element name="page_intro" type="xs:anyType"/>
<!-- announcements section title is an image. not text
<xs:element name="announcement_title" type="xs:string" default="Announcements" minOccurs="0"/>
-->
<xs:element name="announcement" minOccurs="1" maxOccurs="3">
<xs:complexType>
<xs:sequence>
<xs:element name="title" type="xs:string" minOccurs="0"/>
<xs:element name="title_link" type="xs:string" minOccurs="0"/>
<xs:element name="content" type="xs:anyType" minOccurs="0"/>
</xs:sequence>
</xs:complexType>
</xs:element>
<xs:element name="left_column_title" type="xs:string" default="About this Topic"/>
<xs:element name="left_column" minOccurs="1" maxOccurs="unbounded">
<xs:complexType>
<xs:sequence>
<xs:element name="title" type="xs:string" minOccurs="0"/>
<xs:element name="subtitle" type="xs:string" minOccurs="0"/>
<xs:element name="subtitle_link" type="xs:string" minOccurs="0"/>
<xs:element name="content" type="xs:anyType" minOccurs="0"/>
</xs:sequence>
</xs:complexType>
</xs:element>
<xs:element name="right_column_section_1_title" type="xs:string" default="Documentation"/>
<xs:element name="right_column_section_1" minOccurs="1" maxOccurs="unbounded">
<xs:complexType>
<xs:sequence>
<xs:element name="title" type="xs:string" minOccurs="0"/>
<xs:element name="subtitle" type="xs:string" minOccurs="0"/>
<xs:element name="subtitle_link" type="xs:string" minOccurs="0"/>
<xs:element name="content" type="xs:anyType" minOccurs="0"/>
</xs:sequence>
</xs:complexType>
</xs:element>
<xs:element name="right_column_section_2_title" type="xs:string" default="Related Services"/>
<xs:element name="right_column_section_2" minOccurs="1" maxOccurs="unbounded">
<xs:complexType>
<xs:sequence>
<xs:element name="title" type="xs:string" minOccurs="0"/>
<xs:element name="subtitle" type="xs:string" minOccurs="0"/>
<xs:element name="subtitle_link" type="xs:string" minOccurs="0"/>
<xs:element name="content" type="xs:anyType" minOccurs="0"/>
</xs:sequence>
</xs:complexType>
</xs:element>
<xs:element name="right_column_section_3_title" type="xs:string" default="Support Resources"/>
<xs:element name="right_column_section_3" minOccurs="1" maxOccurs="unbounded">
<xs:complexType>
<xs:sequence>
<xs:element name="title" type="xs:string" minOccurs="0"/>
<xs:element name="subtitle" type="xs:string" minOccurs="0"/>
<xs:element name="subtitle_link" type="xs:string" minOccurs="0"/>
<xs:element name="content" type="xs:anyType" minOccurs="0"/>
</xs:sequence>
</xs:complexType>
</xs:element>
</xs:sequence>
</xs:complexType>
</xs:element>
</xs:schema>

View File

@@ -0,0 +1,31 @@
<?xml version="1.0" encoding="ISO-8859-1" ?>
<xs:schema xmlns:xs="http://www.w3.org/2001/XMLSchema">
<xs:element name="shiporder">
<xs:complexType>
<xs:sequence>
<xs:element name="orderperson" type="xs:string"/>
<xs:element name="shipto">
<xs:complexType>
<xs:sequence>
<xs:element name="name" type="xs:string"/>
<xs:element name="address" type="xs:string"/>
<xs:element name="city" type="xs:string"/>
<xs:element name="country" type="xs:string"/>
</xs:sequence>
</xs:complexType>
</xs:element>
<xs:element name="item" maxOccurs="unbounded">
<xs:complexType>
<xs:sequence>
<xs:element name="title" type="xs:string"/>
<xs:element name="note" type="xs:string" minOccurs="0"/>
<xs:element name="quantity" type="xs:positiveInteger"/>
<xs:element name="price" type="xs:decimal"/>
</xs:sequence>
</xs:complexType>
</xs:element>
</xs:sequence>
<xs:attribute name="orderid" type="xs:string" use="required"/>
</xs:complexType>
</xs:element>
</xs:schema>