mirror of
https://github.com/Alfresco/alfresco-community-repo.git
synced 2025-08-07 17:49:17 +00:00
fixed bug with checkboxes
partially removed need for sample instance xml - i'm doing a bunch of hacks at the moment to get around it - basically using xmlbeans to generate the sample xml, and then cleaning it up. ended up not needing to do insane things in javascript with this approach. emailed joern at chiba to see if he has suggestions for how others deal with this issue. serializing the template configuration using object serialization for now. it'll work good for the demo and we'll do something more robust/human readable post demo. this required a bunch of refactoring and springifying the TemplateService, but we're now reading back xsds and xsls from the repository which is sorta a nice thing i think. remove the preview form wizard step from create xml content type flow. tried getting rid of a temporary file in generating the xform but failed. need to find a way to get an url to a noderef that the xform can use to reference the xsd. emailed london people about that. but still did some refactoring along those lines. git-svn-id: https://svn.alfresco.com/repos/alfresco-enterprise/alfresco/BRANCHES/WCM-DEV2/root@3558 c4b6b30b-aa2e-2d43-bbcb-ca4b014f7261
This commit is contained in:
@@ -60,8 +60,6 @@ public class CreateContentWizard extends BaseContentWizard
|
||||
private static final Log LOGGER =
|
||||
LogFactory.getLog(CreateContentWizard.class);
|
||||
|
||||
public static final org.alfresco.service.namespace.QName TT_QNAME =
|
||||
org.alfresco.service.namespace.QName.createQName(org.alfresco.service.namespace.NamespaceService.CONTENT_MODEL_1_0_URI, "tt");
|
||||
|
||||
// ------------------------------------------------------------------------------
|
||||
// Wizard implementation
|
||||
@@ -75,45 +73,20 @@ public class CreateContentWizard extends BaseContentWizard
|
||||
if (this.templateTypeName != null)
|
||||
{
|
||||
LOGGER.debug("generating template output for " + this.templateTypeName);
|
||||
this.nodeService.setProperty(this.createdNode, TT_QNAME, this.templateTypeName);
|
||||
this.nodeService.setProperty(this.createdNode,
|
||||
TemplatingService.TT_QNAME,
|
||||
this.templateTypeName);
|
||||
TemplatingService ts = TemplatingService.getInstance();
|
||||
TemplateType tt = this.getTemplateType();
|
||||
if (tt.getOutputMethods().size() != 0)
|
||||
{
|
||||
try {
|
||||
// get the node ref of the node that will contain the content
|
||||
NodeRef containerNodeRef = this.getContainerNodeRef();
|
||||
final String fileName = this.fileName + "-generated.html";
|
||||
FileInfo fileInfo =
|
||||
this.fileFolderService.create(containerNodeRef,
|
||||
fileName,
|
||||
ContentModel.TYPE_CONTENT);
|
||||
NodeRef fileNodeRef = fileInfo.getNodeRef();
|
||||
|
||||
if (LOGGER.isDebugEnabled())
|
||||
LOGGER.debug("Created file node for file: " +
|
||||
fileName);
|
||||
|
||||
// get a writer for the content and put the file
|
||||
ContentWriter writer = contentService.getWriter(fileNodeRef,
|
||||
ContentModel.PROP_CONTENT, true);
|
||||
// set the mimetype and encoding
|
||||
writer.setMimetype("text/html");
|
||||
writer.setEncoding("UTF-8");
|
||||
TemplateOutputMethod tom = tt.getOutputMethods().get(0);
|
||||
OutputStreamWriter out =
|
||||
new OutputStreamWriter(writer.getContentOutputStream());
|
||||
tom.generate(ts.parseXML(this.content), tt, out);
|
||||
out.close();
|
||||
this.nodeService.setProperty(fileNodeRef, TT_QNAME, this.templateTypeName);
|
||||
|
||||
LOGGER.debug("generated " + fileName + " using " + tom);
|
||||
}
|
||||
catch (Exception e)
|
||||
{
|
||||
e.printStackTrace();
|
||||
throw e;
|
||||
}
|
||||
OutputUtil.generate(ts.parseXML(this.content),
|
||||
tt,
|
||||
this.fileName,
|
||||
this.getContainerNodeRef(),
|
||||
this.fileFolderService,
|
||||
this.contentService,
|
||||
this.nodeService);
|
||||
}
|
||||
}
|
||||
|
||||
|
@@ -78,14 +78,14 @@ public class CreateXmlContentTypeWizard extends BaseWizardBean
|
||||
this.fileFolderService.create(containerNodeRef,
|
||||
this.getSchemaFileName(),
|
||||
ContentModel.TYPE_CONTENT);
|
||||
NodeRef fileNodeRef = fileInfo.getNodeRef();
|
||||
|
||||
final NodeRef schemaFileNodeRef = fileInfo.getNodeRef();
|
||||
|
||||
if (LOGGER.isDebugEnabled())
|
||||
LOGGER.debug("Created file node for file: " +
|
||||
this.getSchemaFileName());
|
||||
|
||||
// get a writer for the content and put the file
|
||||
ContentWriter writer = contentService.getWriter(fileNodeRef,
|
||||
ContentWriter writer = contentService.getWriter(schemaFileNodeRef,
|
||||
ContentModel.PROP_CONTENT, true);
|
||||
// set the mimetype and encoding
|
||||
writer.setMimetype("text/xml");
|
||||
@@ -95,14 +95,14 @@ public class CreateXmlContentTypeWizard extends BaseWizardBean
|
||||
fileInfo = this.fileFolderService.create(containerNodeRef,
|
||||
this.getPresentationTemplateFileName(),
|
||||
ContentModel.TYPE_CONTENT);
|
||||
fileNodeRef = fileInfo.getNodeRef();
|
||||
final NodeRef presentationTemplateFileNodeRef = fileInfo.getNodeRef();
|
||||
|
||||
if (LOGGER.isDebugEnabled())
|
||||
LOGGER.debug("Created file node for file: " +
|
||||
this.getPresentationTemplateFileName());
|
||||
|
||||
// get a writer for the content and put the file
|
||||
writer = contentService.getWriter(fileNodeRef,
|
||||
writer = contentService.getWriter(presentationTemplateFileNodeRef,
|
||||
ContentModel.PROP_CONTENT, true);
|
||||
// set the mimetype and encoding
|
||||
writer.setMimetype("text/xml");
|
||||
@@ -110,7 +110,14 @@ public class CreateXmlContentTypeWizard extends BaseWizardBean
|
||||
writer.putContent(this.getPresentationTemplateFile());
|
||||
|
||||
final TemplatingService ts = TemplatingService.getInstance();
|
||||
ts.registerTemplateType(this.getTemplateType());
|
||||
final String rootTagName =
|
||||
this.getSchemaFileName().replaceAll("([^\\.])\\..+", "$1");
|
||||
final TemplateType tt = ts.newTemplateType(rootTagName, schemaFileNodeRef);
|
||||
if (this.getPresentationTemplateFile() != null)
|
||||
{
|
||||
tt.addOutputMethod(new XSLTOutputMethod(presentationTemplateFileNodeRef));
|
||||
}
|
||||
ts.registerTemplateType(tt);
|
||||
|
||||
// return the default outcome
|
||||
return outcome;
|
||||
@@ -278,25 +285,6 @@ public class CreateXmlContentTypeWizard extends BaseWizardBean
|
||||
{
|
||||
return this.getFile("pt");
|
||||
}
|
||||
|
||||
public TemplateType getTemplateType()
|
||||
throws ParserConfigurationException,
|
||||
SAXException,
|
||||
IOException
|
||||
{
|
||||
if (this.getSchemaFile() == null)
|
||||
return null;
|
||||
final TemplatingService ts = TemplatingService.getInstance();
|
||||
final String rootTagName =
|
||||
this.getSchemaFileName().replaceAll("([^\\.])\\..+", "$1");
|
||||
final Document d = ts.parseXML(this.getSchemaFile());
|
||||
final TemplateType result = ts.newTemplateType(rootTagName, d);
|
||||
if (this.getPresentationTemplateFile() != null)
|
||||
{
|
||||
result.addOutputMethod(new XSLTOutputMethod(this.getPresentationTemplateFile()));
|
||||
}
|
||||
return result;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return Returns a list of mime types to allow the user to select from
|
||||
|
Reference in New Issue
Block a user