NIHVIVO-1229 break out a method for getBean(ServletContext)
This commit is contained in:
parent
eed6e5a9d9
commit
b8fefaee00
1 changed files with 11 additions and 3 deletions
|
@ -62,7 +62,16 @@ public class RevisionInfoBean {
|
||||||
return DUMMY_BEAN;
|
return DUMMY_BEAN;
|
||||||
}
|
}
|
||||||
|
|
||||||
Object o = session.getServletContext().getAttribute(ATTRIBUTE_NAME);
|
return getBean(session.getServletContext());
|
||||||
|
}
|
||||||
|
|
||||||
|
public static RevisionInfoBean getBean(ServletContext context) {
|
||||||
|
if (context == null) {
|
||||||
|
log.warn("Tried to get revision info bean from a null context");
|
||||||
|
return DUMMY_BEAN;
|
||||||
|
}
|
||||||
|
|
||||||
|
Object o = context.getAttribute(ATTRIBUTE_NAME);
|
||||||
if (o == null) {
|
if (o == null) {
|
||||||
log.warn("Tried to get revision info bean, but didn't find any.");
|
log.warn("Tried to get revision info bean, but didn't find any.");
|
||||||
return DUMMY_BEAN;
|
return DUMMY_BEAN;
|
||||||
|
@ -88,8 +97,7 @@ public class RevisionInfoBean {
|
||||||
private final long buildDate;
|
private final long buildDate;
|
||||||
private final List<LevelRevisionInfo> levelInfos;
|
private final List<LevelRevisionInfo> levelInfos;
|
||||||
|
|
||||||
public RevisionInfoBean(Date buildDate,
|
RevisionInfoBean(Date buildDate, Collection<LevelRevisionInfo> levelInfos) {
|
||||||
Collection<LevelRevisionInfo> levelInfos) {
|
|
||||||
this.buildDate = buildDate.getTime();
|
this.buildDate = buildDate.getTime();
|
||||||
this.levelInfos = Collections
|
this.levelInfos = Collections
|
||||||
.unmodifiableList(new ArrayList<LevelRevisionInfo>(levelInfos));
|
.unmodifiableList(new ArrayList<LevelRevisionInfo>(levelInfos));
|
||||||
|
|
Loading…
Add table
Reference in a new issue