Skip to content

Commit

Permalink
VerificationTeam
Browse files Browse the repository at this point in the history
  • Loading branch information
slominskir committed Feb 4, 2025
1 parent 40d985c commit ba7be93
Show file tree
Hide file tree
Showing 7 changed files with 57 additions and 41 deletions.
11 changes: 10 additions & 1 deletion src/main/java/org/jlab/jam/business/session/RFSegmentFacade.java
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@
import javax.persistence.TypedQuery;
import javax.persistence.criteria.*;
import org.jlab.jam.persistence.entity.*;
import org.jlab.jam.persistence.view.RFSegmentVerification;

/**
* @author ryans
Expand Down Expand Up @@ -64,7 +65,7 @@ public int compare(RFControlVerification o1, RFControlVerification o2) {
}

@PermitAll
public List<RFSegment> filterList(Boolean active, Facility facility) {
public List<RFSegment> filterList(Boolean active, Facility facility, VerificationTeam team) {
CriteriaBuilder cb = getEntityManager().getCriteriaBuilder();
CriteriaQuery<RFSegment> cq = cb.createQuery(RFSegment.class);
Root<RFSegment> root = cq.from(RFSegment.class);
Expand All @@ -79,6 +80,14 @@ public List<RFSegment> filterList(Boolean active, Facility facility) {
filters.add(cb.equal(root.get("active"), active));
}

if (team != null) {
Join<RFSegment, RFSegmentVerification> verificationJoin =
root.join("rfControlVerificationList");
Join<RFSegmentVerification, CreditedControl> controlJoin =
verificationJoin.join("creditedControl");
filters.add(cb.equal(controlJoin.get("verificationTeam"), team));
}

if (!filters.isEmpty()) {
cq.where(cb.and(filters.toArray(new Predicate[] {})));
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -125,7 +125,7 @@ private void handleFacility(
RFAuthorization rfAuthorization = rfAuthorizationFacade.findCurrent();
BeamAuthorization beamAuthorization = beamAuthorizationFacade.findCurrent();

List<RFSegment> rfList = rfSegmentFacade.filterList(true, facility);
List<RFSegment> rfList = rfSegmentFacade.filterList(true, facility, null);
List<BeamDestination> beamList = beamDestinationFacade.filterList(true, facility);

Map<BigInteger, BeamDestinationAuthorization> destinationAuthorizationMap =
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@ protected void doGet(HttpServletRequest request, HttpServletResponse response)
adminOrLeader = request.getRemoteUser() != null;
}

List<RFSegment> segmentList = segmentFacade.filterList(true, null);
List<RFSegment> segmentList = segmentFacade.filterList(true, null, null);

request.setAttribute("segmentList", segmentList);
request.setAttribute("adminOrLeader", adminOrLeader);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,7 @@ protected void doGet(HttpServletRequest request, HttpServletResponse response)
// authorization,
// it would be better to grab list of destinations and segments that existed at time of
// authorization.
List<RFSegment> rfList = rfSegmentFacade.filterList(true, facility);
List<RFSegment> rfList = rfSegmentFacade.filterList(true, facility, null);

Map<BigInteger, RFSegmentAuthorization> segmentAuthorizationMap =
rfAuthorizationFacade.createSegmentAuthorizationMap(rfAuthorization);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -74,7 +74,7 @@ protected void doGet(HttpServletRequest request, HttpServletResponse response)

List<CreditedControl> ccList = ccFacade.findWithFacilityVerification(facility, team);

List<RFSegment> segmentList = segmentFacade.filterList(true, facility);
List<RFSegment> segmentList = segmentFacade.filterList(true, facility, team);
List<BeamDestination> destinationList = destinationFacade.filterList(true, facility);

List<Facility> facilityList = facilityFacade.findAll(new OrderDirective("weight"));
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,7 @@ protected void doGet(HttpServletRequest request, HttpServletResponse response)
throw new ServletException("Facility not found");
}

List<RFSegment> segmentList = segmentFacade.filterList(true, facility);
List<RFSegment> segmentList = segmentFacade.filterList(true, facility, null);
List<BeamDestination> destinationList = destinationFacade.filterList(true, facility);
List<CreditedControl> ccList = ccFacade.findAllWithVerificationList();

Expand Down
77 changes: 42 additions & 35 deletions src/main/webapp/WEB-INF/views/verifications.jsp
Original file line number Diff line number Diff line change
Expand Up @@ -106,41 +106,48 @@
</c:otherwise>
</c:choose>
<h3>RF Segments</h3>
<table class="data-table">
<tbody>
<c:forEach items="${segmentList}" var="segment">
<tr>
<td>
<c:choose>
<c:when test="${segment.verification.verificationStatusId eq 1}">
<span title="Verified" class="small-icon baseline-small-icon verified-icon"></span>
</c:when>
<c:when test="${segment.verification.verificationStatusId eq 50}">
<span title="Verified" class="small-icon baseline-small-icon provisional-icon"></span>
</c:when>
<c:otherwise>
<span title="Not Verified" class="small-icon baseline-small-icon not-verified-icon"></span>
</c:otherwise>
</c:choose>
<c:out value="${segment.name}"/>
</td>
<td><c:out value="${segment.facility.name}"/></td>
<td>
<c:if test="${segment.verification.verificationStatusId ne 100}">
<fmt:formatDate value="${segment.verification.expirationDate}" pattern="${s:getFriendlyDateTimePattern()}"/>
<span class="expiring-soon" style="<c:out value="${jam:isExpiringSoon(segment.verification.expirationDate) ? 'display: inline-block;' : 'display: none;'}"/>">(Expiring Soon)</span>
</c:if>
</td>
<td>
<form method="get" action="${pageContext.request.contextPath}/verifications/segment">
<input type="hidden" name="segmentId" value="${segment.getRFSegmentId()}"/>
<button class="single-char-button" type="submit">&rarr;</button>
</form>
</td>
</tr>
</c:forEach>
</tbody>
</table>
<c:choose>
<c:when test="${not empty segmentList}">
<table class="data-table">
<tbody>
<c:forEach items="${segmentList}" var="segment">
<tr>
<td>
<c:choose>
<c:when test="${segment.verification.verificationStatusId eq 1}">
<span title="Verified" class="small-icon baseline-small-icon verified-icon"></span>
</c:when>
<c:when test="${segment.verification.verificationStatusId eq 50}">
<span title="Verified" class="small-icon baseline-small-icon provisional-icon"></span>
</c:when>
<c:otherwise>
<span title="Not Verified" class="small-icon baseline-small-icon not-verified-icon"></span>
</c:otherwise>
</c:choose>
<c:out value="${segment.name}"/>
</td>
<td><c:out value="${segment.facility.name}"/></td>
<td>
<c:if test="${segment.verification.verificationStatusId ne 100}">
<fmt:formatDate value="${segment.verification.expirationDate}" pattern="${s:getFriendlyDateTimePattern()}"/>
<span class="expiring-soon" style="<c:out value="${jam:isExpiringSoon(segment.verification.expirationDate) ? 'display: inline-block;' : 'display: none;'}"/>">(Expiring Soon)</span>
</c:if>
</td>
<td>
<form method="get" action="${pageContext.request.contextPath}/verifications/segment">
<input type="hidden" name="segmentId" value="${segment.getRFSegmentId()}"/>
<button class="single-char-button" type="submit">&rarr;</button>
</form>
</td>
</tr>
</c:forEach>
</tbody>
</table>
</c:when>
<c:otherwise>
None
</c:otherwise>
</c:choose>
<h3>Beam Destinations</h3>
<c:choose>
<c:when test="${not empty destinationList}">
Expand Down

0 comments on commit ba7be93

Please sign in to comment.