Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 3 additions & 2 deletions src/main/java/org/jlab/dtm/business/session/SystemFacade.java
Original file line number Diff line number Diff line change
Expand Up @@ -192,8 +192,9 @@ public SystemEntity findWithExpertList(BigInteger systemId) {
}

@PermitAll
public List<SystemEntity> findAllWithExpertList() {
List<SystemEntity> systemList = this.findByComponentCategoryAndSystem(null, null, null, null);
public List<SystemEntity> findAllWithExpertList(BigInteger categoryId) {
List<SystemEntity> systemList =
this.findByComponentCategoryAndSystem(null, categoryId, null, null);

for (SystemEntity s : systemList) {
JPAUtil.initialize(s.getSystemExpertList());
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,9 +7,13 @@
import jakarta.servlet.http.HttpServletRequest;
import jakarta.servlet.http.HttpServletResponse;
import java.io.IOException;
import java.math.BigInteger;
import java.util.List;
import org.jlab.dtm.business.session.CategoryFacade;
import org.jlab.dtm.business.session.SystemFacade;
import org.jlab.dtm.persistence.entity.Category;
import org.jlab.dtm.persistence.entity.SystemEntity;
import org.jlab.smoothness.presentation.util.ParamConverter;

/**
* @author ryans
Expand All @@ -18,6 +22,7 @@
name = "ExpertReport",
urlPatterns = {"/reports/expert"})
public class ExpertReport extends HttpServlet {
@EJB CategoryFacade categoryFacade;
@EJB SystemFacade systemFacade;

/**
Expand All @@ -32,8 +37,25 @@ public class ExpertReport extends HttpServlet {
protected void doGet(HttpServletRequest request, HttpServletResponse response)
throws ServletException, IOException {

List<SystemEntity> systemList = systemFacade.findAllWithExpertList();
Category selectedCategory = null;

BigInteger categoryId = ParamConverter.convertBigInteger(request, "category");

if (categoryId != null) {
selectedCategory = categoryFacade.find(categoryId);
}

List<Category> categoryList = categoryFacade.findAlphaCategoryList();
List<SystemEntity> systemList = systemFacade.findAllWithExpertList(categoryId);

String selectionMessage = "All Experts";

if (selectedCategory != null) {
selectionMessage = "Category \"" + selectedCategory.getName() + "\"";
}

request.setAttribute("selectionMessage", selectionMessage);
request.setAttribute("categoryList", categoryList);
request.setAttribute("systemList", systemList);

getServletConfig()
Expand Down
30 changes: 29 additions & 1 deletion src/main/webapp/WEB-INF/views/reports/expert.jsp
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,35 @@
</jsp:attribute>
<jsp:body>
<section>
<h2><c:out value="${title}"/></h2>
<s:filter-flyout-widget>
<form class="filter-form" method="get" action="expert">
<div id="filter-form-panel">
<fieldset>
<legend>Taxonomy</legend>
<ul class="key-value-list">
<li>
<div class="li-key">
<label for="category">Category</label>
</div>
<div class="li-value">
<select id="category" name="category">
<option value=""> </option>
<c:forEach items="${categoryList}" var="category">
<option value="${category.categoryId}" ${category.categoryId eq param.category ? 'selected="selected"' : ''}><c:out value="${category.name}"/></option>
</c:forEach>
</select>
</div>
</li>
</ul>
</fieldset>
</div>
<input class="filter-form-submit-button" type="submit" value="Apply"/>
</form>
</s:filter-flyout-widget>
<h2 class="page-header-title"><c:out value="${title}"/></h2>
<div class="message-box">
<c:out value="${selectionMessage}"/>
</div>
<div>
<c:forEach items="${systemList}" var="system">
<h3><c:out value="${system.name}"/></h3>
Expand Down
Loading