Re: Inherit/Share query-params

Splash Forums PrettyFaces Users Inherit/Share query-params Re: Inherit/Share query-params

#21115

mbenson
Participant

@chkal: http://code.google.com/p/prettyfaces/issues/detail?id=115

I would think it possible to implement equals/hashCode on LazyExpression using the beanClass + component. It would be up to you guys whether it is also necessary to test the equality of the embedded LazyBeanNameFinder.

@lincoln: I don’t really want to C&P code I wrote on my employer’s dime; however, briefly:

void process(PrettyConfig config) {
HashSet<String> processed = new HashSet<String>();
for (UrlMapping mapping : config.getMappings()) {
process(config, processed);
}
}

void process(UrlMapping mapping, PrettyConfig config, Set<String> processed) {
if (processed.contains(mapping)) {
return;
}
UrlMapping parent = config.getMappingById(mapping.getParentId());
if (parent != null) {
process(parent, config, processed);
for (QueryParameter parentParam : parent.getQueryParams()) {
//exercise for the reader, comparing name/expression string
if (!containsSimilar(mapping.getQueryParams(), parentParam)) {
mapping.getQueryParams().add(parentParam);
}
}
}
processed.add(mapping.getId());
}