use of org.dom4j.Document in project cpsolver by UniTime.
the class StudentRequestXml method main.
public static void main(String[] args) {
try {
ToolBox.configureLogging();
StudentSectioningModel model = new StudentSectioningModel(new DataProperties());
Assignment<Request, Enrollment> assignment = new DefaultSingleAssignment<Request, Enrollment>();
StudentSectioningXMLLoader xmlLoad = new StudentSectioningXMLLoader(model, assignment);
xmlLoad.setInputFile(new File(args[0]));
xmlLoad.load();
Document document = exportModel(assignment, model);
FileOutputStream fos = new FileOutputStream(new File(args[1]));
(new XMLWriter(fos, OutputFormat.createPrettyPrint())).write(document);
fos.flush();
fos.close();
} catch (Exception e) {
e.printStackTrace();
}
}
use of org.dom4j.Document in project cpsolver by UniTime.
the class StudentSectioningXMLSaver method saveDocument.
public Document saveDocument() {
Document document = DocumentHelper.createDocument();
document.addComment("Student Sectioning");
populate(document);
return document;
}
use of org.dom4j.Document in project tdi-studio-se by Talend.
the class JobJavaScriptsManager method updateMavenBuildFileContent.
protected void updateMavenBuildFileContent(File mavenBuildFile, Map<String, String> mavenPropertiesMap, boolean addDependencies, boolean updateModules) throws DocumentException, IOException {
SAXReader saxReader = new SAXReader();
Document pomDocument = saxReader.read(mavenBuildFile);
setMavenBuildScriptProperties(pomDocument, mavenPropertiesMap);
if (updateModules) {
setMavenBuildScriptModules(pomDocument);
}
if (addDependencies) {
setMavenDependencyElements(pomDocument);
}
saveXmlDocoment(pomDocument, mavenBuildFile);
}
use of org.dom4j.Document in project cpsolver by UniTime.
the class TimetableXMLSaver method saveDocument.
public Document saveDocument() {
Document document = DocumentHelper.createDocument();
document.addComment("University Course Timetabling");
if (iSaveCurrent && getAssignment().nrAssignedVariables() != 0) {
StringBuffer comments = new StringBuffer("Solution Info:\n");
Map<String, String> solutionInfo = (getSolution() == null ? getModel().getExtendedInfo(getAssignment()) : getSolution().getExtendedInfo());
for (String key : new TreeSet<String>(solutionInfo.keySet())) {
String value = solutionInfo.get(key);
comments.append(" " + key + ": " + value + "\n");
}
document.addComment(comments.toString());
}
Element root = document.addElement("timetable");
doSave(root);
return document;
}
use of org.dom4j.Document in project zm-mailbox by Zimbra.
the class RightManager method genAdminDocs.
/**
* generates two files in the output directory
*
* {right}-expanded.xml: the root combo right fully expanded
* {right}-ui.xml: all UI covered by the root combo right
*
* @param outputDir
* @throws ServiceException
* @throws IOException
*/
private void genAdminDocs(String outputDir) throws ServiceException, IOException {
if (!outputDir.endsWith("/")) {
outputDir = outputDir + "/";
}
List<AdminRight> rootRights = ImmutableList.of(Admin.R_adminConsoleRights);
for (AdminRight right : rootRights) {
Multimap<UI, Right> uiMap = TreeMultimap.create();
/*
* output the rights XML. This XML has the root combo right expanded
* down to each atom(preset or attrs) right
*/
Document document = DocumentHelper.createDocument();
Element rightsRoot = document.addElement(E_ROOT);
genAdminDocByRight(rightsRoot, right, uiMap);
writeXML(outputDir + right.getName() + "-expanded.xml", document);
/*
* output the UI XML. This XML contains one entry for each UI, sorted by
* the description of the UI.
*/
document = DocumentHelper.createDocument();
Element uiRoot = document.addElement(E_ROOT);
genAdminDocByUI(uiRoot, uiMap);
writeXML(outputDir + right.getName() + "-ui.xml", document);
}
}
Aggregations