reverting it back to original piece of code as Nick faced some problem. Will look into whats the problem.

This commit is contained in:
ass92 2010-12-08 13:59:40 +00:00
parent c332d76577
commit 1126d6f75d

View file

@ -140,7 +140,7 @@ public class SelfEditingIdentifierFactory implements IdentifierBundleFactory {
} }
log.debug("Found an Individual for netId " + username + " URI: " + uri); log.debug("Found an Individual for netId " + username + " URI: " + uri);
String blacklisted = checkForBlacklisted(ind, context, req); String blacklisted = checkForBlacklisted(ind, context);
return new SelfEditing(ind, blacklisted, false); return new SelfEditing(ind, blacklisted, false);
} }
@ -183,7 +183,7 @@ public class SelfEditingIdentifierFactory implements IdentifierBundleFactory {
* or more rows will be cause the user to be blacklisted. The first variable from * or more rows will be cause the user to be blacklisted. The first variable from
* the first solution set will be returned. * the first solution set will be returned.
*/ */
public static String checkForBlacklisted(Individual ind, ServletContext context, HttpServletRequest req) { public static String checkForBlacklisted(Individual ind, ServletContext context) {
if( ind == null || context == null ) { if( ind == null || context == null ) {
log.error("could not check for Blacklist, null individual or context"); log.error("could not check for Blacklist, null individual or context");
return NOT_BLACKLISTED; return NOT_BLACKLISTED;
@ -209,7 +209,7 @@ public class SelfEditingIdentifierFactory implements IdentifierBundleFactory {
String reasonForBlacklist = NOT_BLACKLISTED; String reasonForBlacklist = NOT_BLACKLISTED;
for( File file : files ){ for( File file : files ){
try{ try{
reasonForBlacklist = runSparqlFileForBlacklist( file, ind, context, req); reasonForBlacklist = runSparqlFileForBlacklist( file, ind, context);
if( reasonForBlacklist != NOT_BLACKLISTED ) if( reasonForBlacklist != NOT_BLACKLISTED )
break; break;
}catch(RuntimeException ex){ }catch(RuntimeException ex){
@ -230,7 +230,7 @@ public class SelfEditingIdentifierFactory implements IdentifierBundleFactory {
* token "?individualURI" is found. * token "?individualURI" is found.
*/ */
private static String runSparqlFileForBlacklist private static String runSparqlFileForBlacklist
(File file, Individual ind, ServletContext context, HttpServletRequest req) (File file, Individual ind, ServletContext context)
{ {
if( !file.canRead() ){ if( !file.canRead() ){
log.debug("cannot read blacklisting SPARQL file " + file.getName()); log.debug("cannot read blacklisting SPARQL file " + file.getName());
@ -261,14 +261,14 @@ public class SelfEditingIdentifierFactory implements IdentifierBundleFactory {
log.debug(file.getName() + " is empty"); log.debug(file.getName() + " is empty");
return NOT_BLACKLISTED; return NOT_BLACKLISTED;
} }
// Model model = (Model)context.getAttribute("jenaOntModel"); Model model = (Model)context.getAttribute("jenaOntModel");
VitroRequest request = new VitroRequest(req); // VitroRequest request = new VitroRequest(req);
Dataset dataset = request.getDataset(); // Dataset dataset = request.getDataset();
queryString = queryString.replaceAll("\\?individualURI", "<" + ind.getURI() + ">"); queryString = queryString.replaceAll("\\?individualURI", "<" + ind.getURI() + ">");
log.debug(queryString); log.debug(queryString);
Query query = QueryFactory.create(queryString); Query query = QueryFactory.create(queryString);
QueryExecution qexec = QueryExecutionFactory.create(query,dataset); QueryExecution qexec = QueryExecutionFactory.create(query,model);
try{ try{
ResultSet results = qexec.execSelect(); ResultSet results = qexec.execSelect();
while(results.hasNext()){ while(results.hasNext()){