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
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
public class CategoryDowntimeReportParams {
private Date start;
private Date end;
BigInteger eventTypeId;
BigInteger[] eventTypeIdArray;
Boolean beamTransport;
String chart;
String data;
Expand All @@ -28,12 +28,12 @@ public void setEnd(Date end) {
this.end = end;
}

public BigInteger getEventTypeId() {
return eventTypeId;
public BigInteger[] getEventTypeIdArray() {
return eventTypeIdArray;
}

public void setEventTypeId(BigInteger eventTypeId) {
this.eventTypeId = eventTypeId;
public void setEventTypeIdArray(BigInteger[] eventTypeIdArray) {
this.eventTypeIdArray = eventTypeIdArray;
}

public Boolean getBeamTransport() {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
public class ComponentDowntimeReportParams {
private Date start;
private Date end;
BigInteger eventTypeId;
BigInteger[] eventTypeIdArray;
Boolean beamTransport;
BigInteger systemId;
String chart;
Expand All @@ -28,12 +28,12 @@ public void setEnd(Date end) {
this.end = end;
}

public BigInteger getEventTypeId() {
return eventTypeId;
public BigInteger[] getEventTypeIdArray() {
return eventTypeIdArray;
}

public void setEventTypeId(BigInteger eventTypeId) {
this.eventTypeId = eventTypeId;
public void setEventTypeIdArray(BigInteger[] eventTypeIdArray) {
this.eventTypeIdArray = eventTypeIdArray;
}

public Boolean getBeamTransport() {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
public class SystemDowntimeReportParams {
private Date start;
private Date end;
BigInteger eventTypeId;
BigInteger[] eventTypeIdArray;
Boolean beamTransport;
BigInteger categoryId;
String chart;
Expand All @@ -29,12 +29,12 @@ public void setEnd(Date end) {
this.end = end;
}

public BigInteger getEventTypeId() {
return eventTypeId;
public BigInteger[] getEventTypeIdArray() {
return eventTypeIdArray;
}

public void setEventTypeId(BigInteger eventTypeId) {
this.eventTypeId = eventTypeId;
public void setEventTypeIdArray(BigInteger[] eventTypeIdArray) {
this.eventTypeIdArray = eventTypeIdArray;
}

public Boolean getBeamTransport() {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ public CategoryDowntimeFacade() {
public List<CategoryDowntime> findByPeriodAndType(
Date start,
Date end,
EventType type,
List<EventType> typeList,
Boolean beamTransport,
boolean packed,
BigInteger categoryId) {
Expand All @@ -58,8 +58,13 @@ public List<CategoryDowntime> findByPeriodAndType(

sql = sql + "where b.time_down < :end " + "and nvl(b.time_up, sysdate) >= :start ";

if (type != null) {
sql = sql + "and event_type_id = " + type.getEventTypeId() + " ";
if (typeList != null && !typeList.isEmpty()) {
String typeListString = typeList.get(0).getEventTypeId().toString();
for (int i = 1; i < typeList.size(); i++) {
typeListString = typeListString + "," + typeList.get(i).getEventTypeId().toString();
}

sql = sql + "and event_type_id in (" + typeListString + ") ";
}

if (categoryId != null) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ public ComponentDowntimeFacade() {

@PermitAll
public List<ComponentDowntime> findByPeriodAndType(
Date start, Date end, EventType type, Boolean beamTransport, BigInteger systemId) {
Date start, Date end, List<EventType> typeList, Boolean beamTransport, BigInteger systemId) {
String sql =
"select a.component_id, a.name, d.name as systemName, count(a.name) as incident_count, sum(interval_to_seconds(least(nvl(b.time_up, sysdate), :end) - greatest(b.time_down, :start))) / 60 / 60 / 24 as duration "
+ "from dtm_owner.component a, incident b, event c, dtm_owner.system d "
Expand All @@ -43,8 +43,13 @@ public List<ComponentDowntime> findByPeriodAndType(
+ "and b.time_down < :end "
+ "and nvl(b.time_up, sysdate) >= :start ";

if (type != null) {
sql = sql + "and c.event_type_id = " + type.getEventTypeId() + " ";
if (typeList != null && !typeList.isEmpty()) {
String typeListString = typeList.get(0).getEventTypeId().toString();
for (int i = 1; i < typeList.size(); i++) {
typeListString = typeListString + "," + typeList.get(i).getEventTypeId().toString();
}

sql = sql + "and event_type_id in (" + typeListString + ") ";
}

// beamTransport Y = only beam transport
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ public void export(
String filters,
double periodDurationHours,
double grandTotalDuration,
EventType type,
List<EventType> typeList,
double programHours)
throws IOException {
Workbook wb = new XSSFWorkbook();
Expand All @@ -47,7 +47,7 @@ public void export(
row1.createCell(2).setCellValue("NUMBER OF INCIDENTS");
row1.createCell(3).setCellValue("MEAN TIME TO RECOVER (HOURS)");

if (EventType.BLOCKED.equals(type)) {
if (typeList != null && typeList.size() == 1 && typeList.contains(EventType.BLOCKED)) {
row1.createCell(4).setCellValue("UPTIME (HOURS)");
row1.createCell(5).setCellValue("MTBF (HOURS)");
row1.createCell(6).setCellValue("HOURLY FAILURE RATE");
Expand Down Expand Up @@ -76,7 +76,7 @@ public void export(
c.setCellStyle(numberStyle);
c.setCellValue(downtime.getDuration() / downtime.getIncidentCount() * 24);

if (EventType.BLOCKED.equals(type)) {
if (typeList != null && typeList.size() == 1 && typeList.contains(EventType.BLOCKED)) {

double uptime = programHours - (downtime.getDuration() * 24);
double mtbf = uptime / downtime.getIncidentCount();
Expand Down Expand Up @@ -117,7 +117,7 @@ public void export(
sheet1.autoSizeColumn(2);
sheet1.autoSizeColumn(3);

if (EventType.BLOCKED.equals(type)) {
if (typeList != null && typeList.size() == 1 && typeList.contains(EventType.BLOCKED)) {
sheet1.autoSizeColumn(4);
sheet1.autoSizeColumn(5);
sheet1.autoSizeColumn(6);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ public void export(
String filters,
double periodDurationHours,
double grandTotalDuration,
EventType type,
List<EventType> selectedTypeList,
double programHours)
throws IOException {
Workbook wb = new XSSFWorkbook();
Expand All @@ -42,7 +42,9 @@ public void export(
row1.createCell(2).setCellValue("NUMBER OF INCIDENTS");
row1.createCell(3).setCellValue("MEAN TIME TO RECOVER (HOURS)");

if (EventType.BLOCKED.equals(type)) {
if (selectedTypeList != null
&& selectedTypeList.size() == 1
&& selectedTypeList.contains(EventType.BLOCKED)) {
row1.createCell(4).setCellValue("UPTIME (HOURS)");
row1.createCell(5).setCellValue("MTBF (HOURS)");
row1.createCell(6).setCellValue("HOURLY FAILURE RATE");
Expand Down Expand Up @@ -71,7 +73,9 @@ public void export(
c.setCellStyle(numberStyle);
c.setCellValue(downtime.getDuration() / downtime.getIncidentCount() * 24);

if (EventType.BLOCKED.equals(type)) {
if (selectedTypeList != null
&& selectedTypeList.size() == 1
&& selectedTypeList.contains(EventType.BLOCKED)) {

double uptime = programHours - (downtime.getDuration() * 24);
double mtbf = uptime / downtime.getIncidentCount();
Expand Down Expand Up @@ -112,7 +116,9 @@ public void export(
sheet1.autoSizeColumn(2);
sheet1.autoSizeColumn(3);

if (EventType.BLOCKED.equals(type)) {
if (selectedTypeList != null
&& selectedTypeList.size() == 1
&& selectedTypeList.contains(EventType.BLOCKED)) {
sheet1.autoSizeColumn(4);
sheet1.autoSizeColumn(5);
sheet1.autoSizeColumn(6);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ public SystemDowntimeFacade() {
public List<SystemDowntime> findByPeriodAndType(
Date start,
Date end,
EventType type,
List<EventType> typeList,
Boolean beamTransport,
BigInteger categoryId,
boolean packed) {
Expand All @@ -61,8 +61,13 @@ public List<SystemDowntime> findByPeriodAndType(
+ "and nvl(b.time_up, sysdate) >= :start "
+ "and a.system_id = d.system_id ";

if (type != null) {
sql = sql + "and event_type_id = " + type.getEventTypeId() + " ";
if (typeList != null && !typeList.isEmpty()) {
String typeListString = typeList.get(0).getEventTypeId().toString();
for (int i = 1; i < typeList.size(); i++) {
typeListString = typeListString + "," + typeList.get(i).getEventTypeId().toString();
}

sql = sql + "and event_type_id in (" + typeListString + ") ";
}

// beamTransport Y = only beam transport
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -106,9 +106,10 @@ public List<TrendRecord> find(TrendReportParams params)
return recordList;
}

private void fillInTrendCategories(TrendRecord record, Date start, Date end, EventType type) {
private void fillInTrendCategories(
TrendRecord record, Date start, Date end, List<EventType> typeList) {
record.categoryDowntimeList =
categoryDowntimeFacade.findByPeriodAndType(start, end, type, null, true, null);
categoryDowntimeFacade.findByPeriodAndType(start, end, typeList, null, true, null);

if (record.categoryDowntimeList != null) {
for (CategoryDowntime cd : record.categoryDowntimeList) {
Expand Down Expand Up @@ -163,7 +164,7 @@ public TrendRecord load(Date start, Date end, EventType type, boolean includeCat
record.downtimeMap = new HashMap<>();

if (includeCategories) {
fillInTrendCategories(record, start, end, type);
fillInTrendCategories(record, start, end, Collections.singletonList(type));
}

FsdTripService tripService = new FsdTripService();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,9 +7,8 @@
import jakarta.servlet.http.HttpServletRequest;
import jakarta.servlet.http.HttpServletResponse;
import java.io.IOException;
import java.util.Calendar;
import java.util.Date;
import java.util.List;
import java.math.BigInteger;
import java.util.*;
import org.jlab.dtm.business.params.TuneComparisonReportParams;
import org.jlab.dtm.business.session.AbstractFacade.OrderDirective;
import org.jlab.dtm.business.session.ComponentDowntimeFacade;
Expand All @@ -21,6 +20,7 @@
import org.jlab.dtm.persistence.model.ComponentDowntime;
import org.jlab.dtm.presentation.params.TuneComparisonReportUrlParamHandler;
import org.jlab.dtm.presentation.util.FilterSelectionMessage;
import org.jlab.smoothness.presentation.util.ParamConverter;

/**
* @author ryans
Expand Down Expand Up @@ -72,10 +72,17 @@ protected void doGet(HttpServletRequest request, HttpServletResponse response)
return;
}

EventType type = null;
BigInteger[] typeIdArray = ParamConverter.convertBigIntegerArray(request, "type");

if (params.getEventTypeId() != null) {
type = eventTypeFacade.find(params.getEventTypeId());
List<EventType> selectedTypeList = new ArrayList<>();

if (typeIdArray != null) {
for (BigInteger id : typeIdArray) {
if (id != null) {
EventType type = eventTypeFacade.find(id);
selectedTypeList.add(type);
}
}
}

List<EventType> eventTypeList = eventTypeFacade.filterList(null);
Expand All @@ -92,7 +99,8 @@ protected void doGet(HttpServletRequest request, HttpServletResponse response)
(params.getEnd().getTime() - params.getStart().getTime()) / 1000.0 / 60.0 / 60.0;

downtimeList =
downtimeFacade.findByPeriodAndType(params.getStart(), params.getEnd(), type, true, null);
downtimeFacade.findByPeriodAndType(
params.getStart(), params.getEnd(), selectedTypeList, true, null);

for (int i = 0; i < downtimeList.size(); i++) {
ComponentDowntime downtime = downtimeList.get(i);
Expand All @@ -104,7 +112,7 @@ protected void doGet(HttpServletRequest request, HttpServletResponse response)
FilterSelectionMessage.getDateRangeReportMessage(
params.getStart(),
params.getEnd(),
type,
selectedTypeList,
null,
null,
null,
Expand All @@ -114,7 +122,6 @@ protected void doGet(HttpServletRequest request, HttpServletResponse response)
params.getData(),
false);

request.setAttribute("type", type);
request.setAttribute("start", params.getStart());
request.setAttribute("end", params.getEnd());
request.setAttribute("eventTypeList", eventTypeList);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@
import java.io.IOException;
import java.math.BigInteger;
import java.text.ParseException;
import java.util.ArrayList;
import java.util.Date;
import java.util.List;
import org.jlab.dtm.business.session.CategoryDowntimeFacade;
Expand Down Expand Up @@ -66,12 +67,6 @@ protected void doGet(HttpServletRequest request, HttpServletResponse response)

BigInteger eventTypeId = ParamConverter.convertBigInteger(request, "type");

EventType type = null;

if (eventTypeId != null) {
type = eventTypeFacade.find(eventTypeId);
}

Boolean beamTransport = null;
try {
beamTransport = ParamConverter.convertYNBoolean(request, "transport");
Expand All @@ -86,9 +81,22 @@ protected void doGet(HttpServletRequest request, HttpServletResponse response)
throw new ServletException("packed must be Y or N", e);
}

BigInteger[] typeIdArray = ParamConverter.convertBigIntegerArray(request, "type");

List<EventType> selectedTypeList = new ArrayList<>();

if (typeIdArray != null) {
for (BigInteger id : typeIdArray) {
if (id != null) {
EventType type = eventTypeFacade.find(id);
selectedTypeList.add(type);
}
}
}

String filters =
FilterSelectionMessage.getReportMessage(
start, end, type, null, null, null, null, beamTransport, packed);
start, end, selectedTypeList, null, null, null, null, beamTransport, packed);

List<CategoryDowntime> downtimeList = null;
double grandTotalDuration = 0.0;
Expand All @@ -102,7 +110,8 @@ protected void doGet(HttpServletRequest request, HttpServletResponse response)
periodDurationHours = (end.getTime() - start.getTime()) / 1000.0 / 60.0 / 60.0;

downtimeList =
downtimeFacade.findByPeriodAndType(start, end, type, beamTransport, packed, null);
downtimeFacade.findByPeriodAndType(
start, end, selectedTypeList, beamTransport, packed, null);

for (int i = 0; i < downtimeList.size(); i++) {
CategoryDowntime downtime = downtimeList.get(i);
Expand Down
Loading
Loading