/// <summary> /// Add a JDF node to the current JDF or document /// </summary> /// <returns>The newly created JDF node.</returns> /// <remarks>Passing isGrayBox=true will result in the creation of a gray box (process group with types set)</remarks> public static XElement AddJdfElement(this XContainer parent, bool isGrayBox, params string[] types) { ParameterCheck.ParameterRequired(parent, "parent"); if (parent is XElement) { parent = (parent as XElement).NearestJdf(); } var jdfNode = new XElement(Element.JDF); parent.Add(jdfNode); if (isGrayBox) { jdfNode.MakeJdfElementAGrayBox(types); } else { jdfNode.MakeJdfElementAProcess(types); } jdfNode.SetUniqueId(); jdfNode.SetStatus(JdfStatus.Waiting); if (jdfNode.IsJdfRoot()) { if (Configuration.FluentJdfLibrary.Settings.JdfAuthoringSettings.GenerateJobId) { jdfNode.SetJobId(); } jdfNode.SetAttributeValue(XNamespace.Xmlns.GetName("xsi"), Globals.XsiNamespace.NamespaceName); jdfNode.SetVersion(); } else { if (Configuration.FluentJdfLibrary.Settings.JdfAuthoringSettings.GenerateJobPartId) { jdfNode.SetJobPartId(); } } if (jdfNode.IsJdfRoot() && Configuration.FluentJdfLibrary.Settings.JdfAuthoringSettings.CreateAuditOnNewRootJdf) { jdfNode.AddAudit(Audit.Created); } return(jdfNode); }