Update of /var/cvs/contributions/didactor2/src/core/java/nl/didactor/filter
In directory james.mmbase.org:/tmp/cvs-serv30165
Modified Files:
ProviderFilter.java
Log Message:
Bit smarter code to determin a provider (e.g. there is little point in taking
one which has no educations, if another provider does have those)
See also:
http://cvs.mmbase.org/viewcvs/contributions/didactor2/src/core/java/nl/didactor/filter
Index: ProviderFilter.java
===================================================================
RCS file:
/var/cvs/contributions/didactor2/src/core/java/nl/didactor/filter/ProviderFilter.java,v
retrieving revision 1.25
retrieving revision 1.26
diff -u -b -r1.25 -r1.26
--- ProviderFilter.java 21 Nov 2008 14:10:53 -0000 1.25
+++ ProviderFilter.java 24 Nov 2008 15:03:02 -0000 1.26
@@ -34,7 +34,7 @@
* Request scope vars are 'provider', 'education', 'class'.
*
* @author Michiel Meeuwissen
- * @version $Id: ProviderFilter.java,v 1.25 2008/11/21 14:10:53 michiel Exp $
+ * @version $Id: ProviderFilter.java,v 1.26 2008/11/24 15:03:02 michiel Exp $
*/
public class ProviderFilter implements Filter, MMBaseStarter,
NodeEventListener, RelationEventListener {
private static final Logger log =
Logging.getLoggerInstance(ProviderFilter.class);
@@ -395,12 +395,19 @@
if (provider == null) {
- NodeList providers =
cloud.getNodeManager("providers").getList(null, null, null);
- if (providers.size() > 0) {
- provider = providers.getNode(0);
+ NodeList providers =
cloud.getNodeManager("providers").getList(null, "number", "descending");
+ for (Node prov : providers) {
+ if (prov.getRelations("related", "educations").size() > 0)
{
+ provider = prov;
+ break;
+ }
+ }
+ if (provider == null && providers.size() > 0) {
+ provider = providers.get(0);
+ }
defaultEducation = getEducation(cloud, provider, urls);
education = defaultEducation;
- }
+
}
if (education != null) {
@@ -446,7 +453,7 @@
attributes.put("includePath", "" + provider.getNumber());
}
- attributes.put("referids", "class?,workgroup?,student?,c?" +
(education.getNumber() != defaultEducation.getNumber() ? ",education" : ""));
+ attributes.put("referids", "class?,workgroup?,student?,c?" +
((education != null && education.getNumber() != defaultEducation.getNumber()) ?
",education" : ""));
providerCache.put(key, attributes);
_______________________________________________
Cvs mailing list
[email protected]
http://lists.mmbase.org/mailman/listinfo/cvs