예제 #1
0
 public static EDLController createEDLController(
     EDocLiteAssociation edlAssociation,
     EDLGlobalConfig edlGlobalConfig,
     DocumentRouteHeaderValue document) {
   EDLController edlController = createEDLController(edlAssociation, edlGlobalConfig);
   try {
     Document defaultDom = edlController.getDefaultDOM();
     Document documentDom = XmlHelper.readXml(document.getDocContent());
     // get the data node and import it into our default DOM
     Element documentData = (Element) documentDom.getElementsByTagName(EDLXmlUtils.DATA_E).item(0);
     if (documentData != null) {
       Element defaultDomEDL = EDLXmlUtils.getEDLContent(defaultDom, false);
       Element defaultDomData =
           (Element) defaultDomEDL.getElementsByTagName(EDLXmlUtils.DATA_E).item(0);
       defaultDomEDL.replaceChild(defaultDom.importNode(documentData, true), defaultDomData);
     }
     if (LOG.isDebugEnabled()) {
       LOG.debug(
           "Created default Node from document id "
               + document.getDocumentId()
               + " content "
               + XmlJotter.jotNode(defaultDom));
     }
   } catch (Exception e) {
     throw new WorkflowRuntimeException(
         "Problems creating controller for EDL "
             + edlAssociation.getEdlName()
             + " document "
             + document.getDocumentId(),
         e);
   }
   return edlController;
 }
예제 #2
0
  private static Document getDefaultDOM(EDocLiteAssociation edlAssociation) throws Exception {
    Document dom = DocumentBuilderFactory.newInstance().newDocumentBuilder().newDocument();
    Element rootElement = dom.createElement("documentContent"); // this is a
    // throwback
    // to some
    // original
    // madness
    // to get EDL routing over a year ago we need to look into this being
    // eliminated.
    dom.appendChild(rootElement);
    Element edlContentElement = EDLXmlUtils.getEDLContent(dom, true);
    EDLXmlUtils.getDataFromEDLDocument(edlContentElement, true);

    // get the data element that was just created ***jitrue***
    Element edlData = EDLXmlUtils.getChildElement(edlContentElement, EDLXmlUtils.DATA_E);
    // set edlName attribute on data element of default DOM ***jitrue***
    edlData.setAttribute("edlName", edlAssociation.getEdlName());

    return dom;
  }