}
creator.init(doctypeConf);
// add a node to the tree
SiteTree siteTree = publication.getTree(Publication.AUTHORING_AREA);
Label[] labels = new Label[1];
labels[0] = new Label(childname, language);
siteTree.addNode(parentid, creator.generateTreeId(childid, childType), labels, visibleInNav);
// Transaction should actually be finished here!
// Create actual document
// grab all the parameters from session, request params and
// sitemap params
HashMap allParameters = new HashMap();
String[] names = parameters.getNames();
for (int i = 0; i < names.length; i++) {
String name = names[i];
String value = null;
try {
value = parameters.getParameter(name);
} catch (ParameterException pe) {
value = null;
}
allParameters.put(name, value);
}
Enumeration requestParameters = request.getParameterNames();
while (requestParameters.hasMoreElements()) {
String requestParameterName = (String) requestParameters.nextElement();
if (allParameters.containsKey(requestParameterName)) {
// we do not allow name clashes
throw new ProcessingException("Name clash in request parameter " +
"and sitemap parameter: " + requestParameterName);
}
allParameters.put(requestParameterName, request.getParameter(requestParameterName));
}
Enumeration sessionAttributeNames = session.getAttributeNames();
while (sessionAttributeNames.hasMoreElements()) {
String sessionAttributeName = (String) sessionAttributeNames.nextElement();
if (allParameters.containsKey(sessionAttributeName)) {
// we do not allow name clashes
throw new ProcessingException("Name clash in session attribute " +
"and request parameter or sitemap parameter: " + sessionAttributeName);
}
allParameters.put(sessionAttributeName, session.getAttribute(sessionAttributeName));
}
try {
creator.create(new File(absoluteDoctypesPath + "samples"),
new File(publication.getDirectory(), docsPath + parentid), childid, childType,
childname, language, allParameters);
} catch (Exception e) {
log.error("Creator threw exception: " + e);
return null;
}
// commit (sort of)
siteTree.save();
HashMap actionMap = new HashMap();
return actionMap;
}