public void writeXML(final Document repositoryDocument, final Document scenarioDocument, final String outputFolder) { final Element repositoryElement = repositoryDocument.createElement(XML_REPOSITORY_TAG_NAME); repositoryDocument.appendChild(repositoryElement); project.getSharedElements().forEach(container -> SharedContainerWriter.of(container).writeXML(repositoryDocument, repositoryElement, outputFolder)); project.getUserPaths().forEach(userPath -> UserPathWriter.of(userPath).writeXML(repositoryDocument, repositoryElement, outputFolder)); project.getServers().forEach(serv -> ServerWriter.of(serv).writeXML(repositoryDocument, repositoryElement)); project.getVariables().forEach(var -> WriterUtils.<VariableWriter>getWriterFor(var).writeXML(repositoryDocument, repositoryElement, outputFolder)); project.getPopulations().forEach(pop -> PopulationWriter.of(pop).writeXML(repositoryDocument, repositoryElement)); writeZoneAndLG(repositoryDocument, repositoryElement); final Element scenariosElement = scenarioDocument.createElement(XML_SCENARIOS_TAG_NAME); scenarioDocument.appendChild(scenariosElement); project.getScenarios().forEach(scenario -> ScenarioWriter.of(scenario).writeXML(scenarioDocument, scenariosElement)); }
/** * Fill a builder with attribute values from the provided {@code Project} instance. * Regular attribute values will be replaced with those from the given instance. * Absent optional values will not replace present values. * Collection elements and entries will be added, not replaced. * @param instance The instance from which to copy values * @return {@code this} builder for use in a chained invocation */ @CanIgnoreReturnValue public final Project.Builder from(Project instance) { Objects.requireNonNull(instance, "instance"); name(instance.getName()); addAllSharedElements(instance.getSharedElements()); addAllUserPaths(instance.getUserPaths()); addAllServers(instance.getServers()); addAllVariables(instance.getVariables()); addAllPopulations(instance.getPopulations()); addAllScenarios(instance.getScenarios()); putAllProjectSettings(instance.getProjectSettings()); return (Project.Builder) this; }