You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@lenya.apache.org by Yura Taras <yu...@gmail.com> on 2006/10/05 10:47:41 UTC
Re: How to pass parameters to CustomDoctypeCreator
On 9/29/06, Yura Taras <yu...@gmail.com> wrote:
> Hi, Lenya users.
> I want to add custom doctype to my publication. Also I want to use my
> own creator (instead of DefaultBranchCreator).
> In sample blog publication there is such a feature:
>
> public class NewBlogEntryCreator extends DefaultBranchCreator {
>
> protected void transformXML(Document doc, String childId, short childType,
> String childName, Map parameters) throws Exception {
> // skip
> // Replace title
> du.setElementValue(doc, "/echo:entry/echo:title",
> (String)parameters.get("title"));
> }
> }
>
> As you see, thay use parameters variable to get values entered into
> input fields by user.
> I want to do thms like that, but by default, parameters is EMPTY_MAP
> and I don't know, in which part of code I should change parameters
> variable... I can't recognize where do they do it in blog app.
> Can anybody help me with that?
>
> To be clear:
>
> I have class NewMovieReviewCreator:
>
> public class NewMovieReviewCreator extends DefaultBranchCreator
>
> It has method transformXML:
> @Override
> protected void transformXML(Document doc, String childId, short childType,
> String childName, Map parameters) throws Exception {
> String title = (String).get("properties.create.child-name"));
> }
>
> title is always null, but i want to assign it value of request
> parameter properties.create.child-name
>
> Thanks.
>
Can't anyone help me with it?? Maybe, I've described my question bad...
DocumentCreator calls NewBlogEntryCreator.create with empty"parameters" param:
creator.create(
new File(doctypesDirectory, "samples"),
new File(authoringDirectory, parentId),
childId,
childType,
childName,
language,
Collections.EMPTY_MAP);
NewBlogEntryCreator.create is inherited from DefaultCreator:
public void create(
File samplesDir,
File parentDir,
String childId,
short childType,
String childName,
String language,
Map parameters) {
...
// transform the xml if needed
log.debug("transform sample file: ");
transformXML(doc, id, childType, childName, parameters);
...
}
And NewBlogEntryCreator.transformXML uses parameters as non-empty map:
// Replace title
du.setElementValue(doc, "/echo:entry/echo:title",
(String)parameters.get("title"));
I can't understand, where empty parameters map is replaced with
request parameters map but I need the same trick in my app.
Thanks.
---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscribe@lenya.apache.org
For additional commands, e-mail: user-help@lenya.apache.org