// add a node to the tree
getLogger().debug("invoking DefaultSiteTree(" + publication.getDirectory() +
File.separator + treeAuthoringPath + ")");
DefaultSiteTree siteTree = new DefaultSiteTree(new File(publication.getDirectory(),
treeAuthoringPath));
Label[] labels = new Label[1];
labels[0] = new Label(childname, null);
siteTree.addNode(parentid, creator.generateTreeId(childid, childType), labels);
// 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, allParameters);
} catch (Exception e) {
getLogger().error(".act(): Creator threw exception: " + e);
}
// commit (sort of)
siteTree.serialize();
HashMap actionMap = new HashMap();
return actionMap;
}