AnsweredAssumed Answered

create webform from webscript - metadata extraction problem

Question asked by davidg on Mar 3, 2009
Latest reply on Aug 28, 2009 by rdifrango
I have successfully created a slight variant of the WCM metadata extraction example for a press_release from the alfresco recommended example
(Refer: http://blogs.alfresco.com/wp/jbarmash/2008/12/01/xml-metadata-extraction-for-wcm/)

I am now generating the required XML form from javascript.

I have checked in the nodebrowser that ALL the correct aspects are present and the required properties.

My problem seems to be that the
  • renditions are not being generated. I assumed that they would be generated if the form aspect(and the others) was correctly configured,
  • metadata extract - not being triggered

  • If I subsequently open and save(without edit) the form using the web client, the txt and html renditions are generated and the metadata is extracted.

    Do I need to do an additional generate renditions step in javascript?
    Any suggestions?


    The code I use is as follows:


    var timestamp = new Date().getTime();
    var storeRootNode = avm.lookupStoreRoot(storeName);
    var path = storeRootNode.path + "/ROOT";
    var node = avm.lookupNode(path);

    var fileName= "pr " + timestamp + ".xml";
    var pressReleaseDocF= node.createNode(fileName, "wcm:avmplaincontent");
    pressReleaseDoc.properties["cm:name"] = fileName;

    var props= new Array(2);
    props["wca:parentformname"] = "press-release";
    props["wca:originalparentpath"] = "dgtest–admin–preview:/www/avm_webapps/ROOT";
    pressReleaseDocF.addAspect("wca:forminstancedata", props);
    pressReleaseDocF.save();

    var props= new Array(2);
    props["cm:title"] = fileName;
    pressReleaseDocF.addAspect("cm:titled", props);
    pressReleaseDocF.save();

    var prNs= new Namespace("pr", "http://www.demo.net.au/alfresco/pr");
    var pressReleaseXml2=  <pr:press_release xmlns:pr="http://www.demo.net.au/alfresco/pr"
    xmlns:alf="http://www.alfresco.org"
    xmlns:chiba="http://chiba.sourceforge.net/xforms"
    xmlns:ev="http://www.w3.org/2001/xml-events"
    xmlns:xf="http://www.w3.org/2002/xforms"
    xmlns:xhtml="http://www.w3.org/1999/xhtml"
    xmlns:xs="http://www.w3.org/2001/XMLSchema"
    xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
    >
      </pr:press_release>;

    pressReleaseXml2.prNs::title= "pr title "+timestamp;
    pressReleaseXml2.prNs::overview= "the abstract";
    pressReleaseXml2.prNs::location=  "pr location";
    pressReleaseXml2.prNs::body=  "pr body";
    pressReleaseXml2.prNs::include_media_contacts=  "true";
    pressReleaseXml2.prNs::launch_date=  "2009-02-04";
    pressReleaseXml2.prNs::expiration_date=  "2009-04-06";
    pressReleaseXml2.prNs::numtimes=  "1";

    pressReleaseDocF.content = pressReleaseXml2.toXMLString();
    pressReleaseDocF.save();

    Outcomes