01: /**
02: *
03: */package nl.hippo.cms.wizard.widgets;
04:
05: import nl.hippo.cms.wizard.WizardResult;
06:
07: import org.apache.avalon.framework.service.ServiceManager;
08: import org.apache.avalon.framework.service.WrapperServiceSelector;
09: import org.apache.cocoon.components.modules.input.InputModule;
10: import org.springframework.web.context.WebApplicationContext;
11:
12: /**
13: * @author a.bogaart@hippo.nl
14: *
15: */
16: public class CategoryItemWidget extends ItemWidget {
17:
18: public void fillResult(WizardResult result,
19: WebApplicationContext context) throws Exception {
20:
21: ServiceManager manager = (ServiceManager) context
22: .getBean("serviceManager");
23: WrapperServiceSelector selector = (WrapperServiceSelector) manager
24: .lookup(InputModule.ROLE + "Selector");
25: InputModule model = (InputModule) selector
26: .select("locationmapmodel");
27:
28: //search for location[@src=$value]/parent::match/@pattern, using element names istead of * results in null,
29: //possibly a namespace thing
30: String xpath = "//*[@src='" + value + "']/parent::*/@pattern";
31: String path = (String) model.getAttribute(xpath, null, null);
32: if (path != null) {
33: path = path.substring(path.indexOf("/"));
34: result.addPath(path);
35: }
36: }
37:
38: }
|