reverting a small rearrangement of VClassGroupCache to avoid changing the unit test

This commit is contained in:
brianjlowe 2015-12-09 22:08:00 +02:00
parent 1a1606d6ff
commit 6e99b1c707

View file

@ -358,13 +358,10 @@ public class VClassGroupCache implements SearchIndexer.Listener {
} }
} }
protected static boolean isClassNameChange(Statement stmt, ServletContext context) { protected static boolean isClassNameChange(Statement stmt, OntModel jenaOntModel) {
// Check if the stmt is a rdfs:label change and that the // Check if the stmt is a rdfs:label change and that the
// subject is an owl:Class. // subject is an owl:Class.
if( !RDFS.label.equals( stmt.getPredicate() )) { if( RDFS.label.equals( stmt.getPredicate() )) {
return false;
}
OntModel jenaOntModel = ModelAccess.on(context).getOntModelSelector().getTBoxModel();
jenaOntModel.enterCriticalSection(Lock.READ); jenaOntModel.enterCriticalSection(Lock.READ);
try{ try{
return jenaOntModel.contains( return jenaOntModel.contains(
@ -375,8 +372,10 @@ public class VClassGroupCache implements SearchIndexer.Listener {
}finally{ }finally{
jenaOntModel.leaveCriticalSection(); jenaOntModel.leaveCriticalSection();
} }
}else{
return false;
}
} }
/* ******************** RebuildGroupCacheThread **************** */ /* ******************** RebuildGroupCacheThread **************** */
protected class RebuildGroupCacheThread extends VitroBackgroundThread { protected class RebuildGroupCacheThread extends VitroBackgroundThread {
@ -488,10 +487,13 @@ public class VClassGroupCache implements SearchIndexer.Listener {
requestCacheUpdate(); requestCacheUpdate();
} else if(VitroVocabulary.DISPLAY_RANK.equals(stmt.getPredicate().getURI())){ } else if(VitroVocabulary.DISPLAY_RANK.equals(stmt.getPredicate().getURI())){
requestCacheUpdate(); requestCacheUpdate();
} else if( isClassNameChange(stmt, context) ) { } else if (RDFS.label.equals(stmt.getPredicate())){
OntModel jenaOntModel = ModelAccess.on(context).getOntModelSelector().getTBoxModel();
if( isClassNameChange(stmt, jenaOntModel) ) {
requestCacheUpdate(); requestCacheUpdate();
} }
} }
}
public void notifyEvent(Model model, Object event) { public void notifyEvent(Model model, Object event) {
if (event instanceof BulkUpdateEvent) { if (event instanceof BulkUpdateEvent) {