generate form instance data and renditions into a layer. when finish is pressed update the main sandbox with the changes. everything seems to work rather well other than actually previewing the content in the virtualization server. need to sort that out with jon.

still need to start the workflow but i've got all the hooks in place.

git-svn-id: https://svn.alfresco.com/repos/alfresco-enterprise/alfresco/BRANCHES/WCM-DEV2/root@4408 c4b6b30b-aa2e-2d43-bbcb-ca4b014f7261
This commit is contained in:
Ariel Backenroth
2006-11-21 02:06:06 +00:00
parent 51b546432d
commit 868cfc0f62
7 changed files with 82 additions and 4 deletions

View File

@@ -38,6 +38,8 @@ import org.alfresco.model.ContentModel;
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.service.cmr.avm.AVMService; import org.alfresco.service.cmr.avm.AVMService;
import org.alfresco.service.cmr.avmsync.AVMDifference;
import org.alfresco.service.cmr.avmsync.AVMSyncService;
import org.alfresco.service.cmr.repository.ChildAssociationRef; import org.alfresco.service.cmr.repository.ChildAssociationRef;
import org.alfresco.service.cmr.repository.NodeRef; import org.alfresco.service.cmr.repository.NodeRef;
import org.alfresco.service.namespace.QName; import org.alfresco.service.namespace.QName;
@@ -73,9 +75,13 @@ public class CreateWebContentWizard extends BaseContentWizard
protected List<Rendition> renditions = null; protected List<Rendition> renditions = null;
protected FormInstanceData formInstanceData = null; protected FormInstanceData formInstanceData = null;
protected boolean formSelectDisabled = false; protected boolean formSelectDisabled = false;
protected boolean startWorkflow = false;
/** AVM service bean reference */ /** AVM service bean reference */
protected AVMService avmService; protected AVMService avmService;
/** AVM sync service bean reference */
protected AVMSyncService avmSyncService;
/** AVM Browse Bean reference */ /** AVM Browse Bean reference */
protected AVMBrowseBean avmBrowseBean; protected AVMBrowseBean avmBrowseBean;
@@ -88,6 +94,14 @@ public class CreateWebContentWizard extends BaseContentWizard
{ {
this.avmService = avmService; this.avmService = avmService;
} }
/**
* @param avmSyncService The AVMSyncService to set.
*/
public void setAvmSyncService(final AVMSyncService avmSyncService)
{
this.avmSyncService = avmSyncService;
}
/** /**
* @param avmBrowseBean The AVMBrowseBean to set. * @param avmBrowseBean The AVMBrowseBean to set.
@@ -109,6 +123,9 @@ public class CreateWebContentWizard extends BaseContentWizard
this.inlineEdit = true; this.inlineEdit = true;
this.formName = null; this.formName = null;
this.mimeType = MimetypeMap.MIMETYPE_XML; this.mimeType = MimetypeMap.MIMETYPE_XML;
this.formInstanceData = null;
this.renditions = null;
this.startWorkflow = false;
// check for a form ID being passed in as a parameter // 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_ID) != null)
@@ -127,10 +144,32 @@ public class CreateWebContentWizard extends BaseContentWizard
} }
@Override @Override
protected String finishImpl(FacesContext context, String outcome) protected String finishImpl(final FacesContext context, final String outcome)
throws Exception throws Exception
{ {
final List<AVMDifference> diffList = new ArrayList<AVMDifference>(1 + this.renditions.size());
diffList.add(new AVMDifference(-1, this.createdPath,
-1, this.createdPath.replaceFirst(AVMConstants.STORE_PREVIEW,
AVMConstants.STORE_MAIN),
AVMDifference.NEWER));
for (Rendition rendition : this.renditions)
{
final String path = AVMNodeConverter.ToAVMVersionPath(rendition.getNodeRef()).getSecond();
diffList.add(new AVMDifference(-1, path,
-1, path.replaceFirst(AVMConstants.STORE_PREVIEW,
AVMConstants.STORE_MAIN),
AVMDifference.NEWER));
}
this.avmSyncService.update(diffList, true, true, true, true, null, null);
if (this.startWorkflow)
{
System.err.println("************* starting workflow");
}
else
{
System.err.println("************* not starting workflow");
}
// return the default outcome // return the default outcome
return outcome; return outcome;
} }
@@ -169,6 +208,7 @@ public class CreateWebContentWizard extends BaseContentWizard
logger.debug("saving file content to " + this.fileName); logger.debug("saving file content to " + this.fileName);
// get the parent path of the location to save the content // get the parent path of the location to save the content
String path = this.avmBrowseBean.getCurrentPath(); String path = this.avmBrowseBean.getCurrentPath();
path = path.replaceFirst(AVMConstants.STORE_MAIN, AVMConstants.STORE_PREVIEW);
if (MimetypeMap.MIMETYPE_XML.equals(this.mimeType) && this.formName != null) if (MimetypeMap.MIMETYPE_XML.equals(this.mimeType) && this.formName != null)
{ {
final FormsService fs = FormsService.getInstance(); final FormsService fs = FormsService.getInstance();
@@ -387,6 +427,16 @@ public class CreateWebContentWizard extends BaseContentWizard
this.formSelectDisabled = formSelectDisabled; this.formSelectDisabled = formSelectDisabled;
} }
public void setStartWorkflow(final boolean startWorkflow)
{
this.startWorkflow = startWorkflow;
}
public boolean getStartWorkflow()
{
return this.startWorkflow;
}
/** /**
* @return Returns the summary data for the wizard. * @return Returns the summary data for the wizard.
*/ */

View File

@@ -35,4 +35,7 @@ public interface FormInstanceData
/** the path relative to the containing webapp */ /** the path relative to the containing webapp */
public String getWebappRelativePath(); public String getWebappRelativePath();
/** the url to the asset */
public String getUrl();
} }

View File

@@ -79,6 +79,11 @@ public class FormInstanceDataImpl
return this.nodeRef; return this.nodeRef;
} }
public String getUrl()
{
return AVMConstants.buildAVMAssetUrl(AVMNodeConverter.ToAVMVersionPath(this.nodeRef).getSecond());
}
private ServiceRegistry getServiceRegistry() private ServiceRegistry getServiceRegistry()
{ {
final FacesContext fc = FacesContext.getCurrentInstance(); final FacesContext fc = FacesContext.getCurrentInstance();

View File

@@ -41,4 +41,7 @@ public interface Rendition
/** the node ref containing the contents of this rendition */ /** the node ref containing the contents of this rendition */
public NodeRef getNodeRef(); public NodeRef getNodeRef();
/** the url to the asset */
public String getUrl();
} }

View File

@@ -93,6 +93,11 @@ public class RenditionImpl
return this.nodeRef; return this.nodeRef;
} }
public String getUrl()
{
return AVMConstants.buildAVMAssetUrl(AVMNodeConverter.ToAVMVersionPath(this.nodeRef).getSecond());
}
private ServiceRegistry getServiceRegistry() private ServiceRegistry getServiceRegistry()
{ {
final FacesContext fc = FacesContext.getCurrentInstance(); final FacesContext fc = FacesContext.getCurrentInstance();

View File

@@ -2115,6 +2115,10 @@
<property-name>avmService</property-name> <property-name>avmService</property-name>
<value>#{AVMService}</value> <value>#{AVMService}</value>
</managed-property> </managed-property>
<managed-property>
<property-name>avmSyncService</property-name>
<value>#{AVMSyncService}</value>
</managed-property>
<managed-property> <managed-property>
<property-name>avmBrowseBean</property-name> <property-name>avmBrowseBean</property-name>
<value>#{AVMBrowseBean}</value> <value>#{AVMBrowseBean}</value>

View File

@@ -24,6 +24,10 @@
window.onload = function() { document.getElementById("wizard:finish-button").focus(); } window.onload = function() { document.getElementById("wizard:finish-button").focus(); }
</script> </script>
<h:selectBooleanCheckbox id="startWorkflow"
value="#{WizardManager.bean.startWorkflow}"/>
<h:outputText value="&nbsp;#{msg.create_web_content_summary_submit_message}" escape="false" />
<h:panelGrid columns="1" cellpadding="2" style="padding-top: 4px; padding-bottom: 4px;" <h:panelGrid columns="1" cellpadding="2" style="padding-top: 4px; padding-bottom: 4px;"
width="100%" rowClasses="wizardSectionHeading"> width="100%" rowClasses="wizardSectionHeading">
<h:outputText value="&nbsp;#{msg.create_web_content_summary_content_details}" escape="false" /> <h:outputText value="&nbsp;#{msg.create_web_content_summary_content_details}" escape="false" />
@@ -46,10 +50,14 @@
<h:panelGrid columns="2" cellpadding="3" cellspacing="3" border="0"> <h:panelGrid columns="2" cellpadding="3" cellspacing="3" border="0">
<c:forEach items="${WizardManager.bean.renditions}" var="rendition"> <c:forEach items="${WizardManager.bean.renditions}" var="rendition">
<h:outputText value="#{msg.name}:"/> <h:outputText value="#{msg.name}:"/>
<f:verbatim>${rendition.name}</f:verbatim> <a:actionLink value="${rendition.name}"
image="/images/icons/preview_website.gif"
showLink="true"
href="${rendition.url}"
target="new">${rendition.name}</a:actionLink>
<h:outputText value="#{msg.location}:"/> <h:outputText value="#{msg.location}:"/>
<f:verbatim>${rendition.webappRelativePath}</f:verbatim> <f:verbatim>${rendition.webappRelativePath}</f:verbatim>
</c:forEach> </c:forEach>
</h:panelGrid> </h:panelGrid>
<h:outputText value="&nbsp;#{msg.create_web_content_summary_submit_message}" escape="false" />