NIHVIVO-2694 Simplify the interface to the IdentifierBundleFactory. Require only an HttpServletRequest as a parameter.
This commit is contained in:
parent
12a1f9342d
commit
cb4f07af47
3 changed files with 9 additions and 36 deletions
|
@ -122,8 +122,7 @@ public class ActiveIdentifierBundleFactories {
|
||||||
HttpSession session, ServletContext ctx) {
|
HttpSession session, ServletContext ctx) {
|
||||||
IdentifierBundle ib = new ArrayIdentifierBundle();
|
IdentifierBundle ib = new ArrayIdentifierBundle();
|
||||||
for (IdentifierBundleFactory ibf : factories) {
|
for (IdentifierBundleFactory ibf : factories) {
|
||||||
IdentifierBundle obj = ibf.getIdentifierBundle(request, session,
|
IdentifierBundle obj = ibf.getIdentifierBundle(request);
|
||||||
ctx);
|
|
||||||
if (obj != null) {
|
if (obj != null) {
|
||||||
ib.addAll(obj);
|
ib.addAll(obj);
|
||||||
}
|
}
|
||||||
|
|
|
@ -2,22 +2,16 @@
|
||||||
|
|
||||||
package edu.cornell.mannlib.vitro.webapp.auth.identifier;
|
package edu.cornell.mannlib.vitro.webapp.auth.identifier;
|
||||||
|
|
||||||
import javax.servlet.ServletContext;
|
import javax.servlet.http.HttpServletRequest;
|
||||||
import javax.servlet.ServletRequest;
|
|
||||||
import javax.servlet.http.HttpSession;
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Creates an IdentifierBundle for a ServletRequest/HttpSession. Useful
|
* Creates an IdentifierBundle for a ServletRequest/HttpSession. Useful for
|
||||||
* for getting the identifiers that should be associated with a request to
|
* getting the identifiers that should be associated with a request.
|
||||||
* a servlet or a JSP.
|
|
||||||
*
|
|
||||||
* We have this method signature because these are the object that are accessible
|
|
||||||
* from JSP TagSupport.pageContext.
|
|
||||||
*
|
|
||||||
* @author bdc34
|
|
||||||
*
|
|
||||||
*/
|
*/
|
||||||
public interface IdentifierBundleFactory {
|
public interface IdentifierBundleFactory {
|
||||||
public IdentifierBundle getIdentifierBundle(ServletRequest request, HttpSession session, ServletContext context);
|
/**
|
||||||
|
* Return the IdentifierBundle from this factory. May return an empty
|
||||||
|
* bundle, but never returns null.
|
||||||
|
*/
|
||||||
|
public IdentifierBundle getIdentifierBundle(HttpServletRequest request);
|
||||||
}
|
}
|
||||||
|
|
|
@ -3,11 +3,7 @@
|
||||||
package edu.cornell.mannlib.vitro.webapp.auth.identifier.factory;
|
package edu.cornell.mannlib.vitro.webapp.auth.identifier.factory;
|
||||||
|
|
||||||
import javax.servlet.ServletContext;
|
import javax.servlet.ServletContext;
|
||||||
import javax.servlet.ServletRequest;
|
|
||||||
import javax.servlet.http.HttpServletRequest;
|
|
||||||
import javax.servlet.http.HttpSession;
|
|
||||||
|
|
||||||
import edu.cornell.mannlib.vitro.webapp.auth.identifier.IdentifierBundle;
|
|
||||||
import edu.cornell.mannlib.vitro.webapp.auth.identifier.IdentifierBundleFactory;
|
import edu.cornell.mannlib.vitro.webapp.auth.identifier.IdentifierBundleFactory;
|
||||||
import edu.cornell.mannlib.vitro.webapp.dao.IndividualDao;
|
import edu.cornell.mannlib.vitro.webapp.dao.IndividualDao;
|
||||||
import edu.cornell.mannlib.vitro.webapp.dao.UserAccountsDao;
|
import edu.cornell.mannlib.vitro.webapp.dao.UserAccountsDao;
|
||||||
|
@ -42,25 +38,9 @@ public abstract class BaseIdentifierBundleFactory implements
|
||||||
this.indDao = wdf.getIndividualDao();
|
this.indDao = wdf.getIndividualDao();
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
|
||||||
* This method should go away. Why are we passing anything other than the
|
|
||||||
* request?
|
|
||||||
*/
|
|
||||||
@Override
|
|
||||||
public final IdentifierBundle getIdentifierBundle(ServletRequest request,
|
|
||||||
HttpSession session, ServletContext context) {
|
|
||||||
return getIdentifierBundle((HttpServletRequest) request);
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public String toString() {
|
public String toString() {
|
||||||
return this.getClass().getSimpleName() + " - " + hashCode();
|
return this.getClass().getSimpleName() + " - " + hashCode();
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
|
||||||
* Return the IdentifierBundle from this factory. May return an empty
|
|
||||||
* bundle, but never returns null.
|
|
||||||
*/
|
|
||||||
public abstract IdentifierBundle getIdentifierBundle(HttpServletRequest req);
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
Loading…
Add table
Reference in a new issue