Skip to content

Commit

Permalink
RF Only support (#12)
Browse files Browse the repository at this point in the history
  • Loading branch information
slominskir authored Dec 9, 2024
1 parent 673c1b4 commit b34ce00
Show file tree
Hide file tree
Showing 5 changed files with 25 additions and 15 deletions.
2 changes: 1 addition & 1 deletion container/oracle/initdb.d/02_ddl.sql
Original file line number Diff line number Diff line change
Expand Up @@ -73,7 +73,7 @@ CREATE TABLE JAM_OWNER.DESTINATION_AUTHORIZATION
(
BEAM_DESTINATION_ID INTEGER NOT NULL ,
AUTHORIZATION_ID INTEGER NOT NULL ,
BEAM_MODE VARCHAR2(16) NOT NULL CONSTRAINT DESTINATION_AUTHORIZATION_CK1 CHECK (BEAM_MODE IN ('None', 'Tune', 'CW', 'Ceramic Viewer', 'Viewer Limited', 'High Duty Cycle', 'BLM Checkout')),
BEAM_MODE VARCHAR2(16) NOT NULL CONSTRAINT DESTINATION_AUTHORIZATION_CK1 CHECK (BEAM_MODE IN ('None', 'Tune', 'CW', 'Ceramic Viewer', 'Viewer Limited', 'High Duty Cycle', 'BLM Checkout', 'RF Only')),
CW_LIMIT NUMBER(24,12) NULL ,
COMMENTS VARCHAR2(256) NULL ,
EXPIRATION_DATE DATE NULL ,
Expand Down
1 change: 1 addition & 0 deletions container/oracle/initdb.d/03_default_data.sql
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,7 @@ insert into JAM_OWNER.beam_destination (BEAM_DESTINATION_ID, NAME, MACHINE, CURR
insert into JAM_OWNER.beam_destination (BEAM_DESTINATION_ID, NAME, MACHINE, CURRENT_LIMIT_UNITS, ACTIVE_YN, WEIGHT) values(JAM_OWNER.destination_id.nextval, 'Destination 7', 'UITF', 'uA', 'Y', 7);
insert into JAM_OWNER.beam_destination (BEAM_DESTINATION_ID, NAME, MACHINE, CURRENT_LIMIT_UNITS, ACTIVE_YN, WEIGHT) values(JAM_OWNER.destination_id.nextval, 'Destination 8', 'UITF', 'uA', 'Y', 8);
insert into JAM_OWNER.beam_destination (BEAM_DESTINATION_ID, NAME, MACHINE, CURRENT_LIMIT_UNITS, ACTIVE_YN, WEIGHT) values(JAM_OWNER.destination_id.nextval, 'Destination 9', 'UITF', 'uA', 'Y', 9);
insert into JAM_OWNER.beam_destination (BEAM_DESTINATION_ID, NAME, MACHINE, CURRENT_LIMIT_UNITS, ACTIVE_YN, WEIGHT) values(JAM_OWNER.destination_id.nextval, 'Injector RF Operations', 'CEBAF', 'uA', 'Y', 9);

-- Populate Initial Control Verification
insert into JAM_OWNER.control_verification (CONTROL_VERIFICATION_ID, CREDITED_CONTROL_ID, BEAM_DESTINATION_ID, VERIFICATION_ID, VERIFICATION_DATE, VERIFIED_BY, EXPIRATION_DATE, COMMENTS, MODIFIED_BY, MODIFIED_DATE) values(JAM_OWNER.control_verification_id.nextval, 1, 1, 100, sysdate, 'admin', null, null, 'admin', sysdate);
Expand Down
28 changes: 17 additions & 11 deletions src/main/java/org/jlab/jam/presentation/util/BeamAuthFunctions.java
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@ public final class BeamAuthFunctions {

private static final Logger LOGGER = Logger.getLogger(BeamAuthFunctions.class.getName());

private static final List<String> RF_LIST = Arrays.asList("None", "RF Only");
private static final List<String> CEBAF_LIST = Arrays.asList("None", "Tune", "CW");
private static final List<String> LERF_LIST =
Arrays.asList(
Expand All @@ -24,20 +25,25 @@ private BeamAuthFunctions() {
// cannot instantiate publicly
}

public static List<String> beamModeList(String facility) {
public static List<String> beamModeList(String facility, String destination) {
List<String> modes = null;

switch (facility) {
case "cebaf":
modes = CEBAF_LIST;
break;
case "lerf":
modes = LERF_LIST;
break;
case "uitf":
modes = UITF_LIST;
break;
if (destination.contains("RF Operations")) {
modes = RF_LIST;
} else {
switch (facility) {
case "cebaf":
modes = CEBAF_LIST;
break;
case "lerf":
modes = LERF_LIST;
break;
case "uitf":
modes = UITF_LIST;
break;
}
}

return modes;
}

Expand Down
2 changes: 1 addition & 1 deletion src/main/webapp/WEB-INF/functions.tld
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@
<function>
<name>beamModeList</name>
<function-class>org.jlab.jam.presentation.util.BeamAuthFunctions</function-class>
<function-signature>java.util.List beamModeList(java.lang.String)</function-signature>
<function-signature>java.util.List beamModeList(java.lang.String, java.lang.String)</function-signature>
</function>
<function>
<name>laseModeList</name>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,7 @@
<div class="readonly-field"><c:out value="${selectedBeamMode}"/></div>
<div class="editable-field">
<select name="mode[]" class="mode-select">
<c:forEach items="${beamauth:beamModeList(facility)}" var="beamMode">
<c:forEach items="${beamauth:beamModeList(facility, destination.name)}" var="beamMode">
<option${beamMode eq selectedBeamMode ? ' selected="selected"' : ''}><c:out value="${beamMode}"/></option>
</c:forEach>
</select>
Expand All @@ -61,6 +61,9 @@
<c:set var="selectedLimit" value="${destinationAuthorization.cwLimit eq null ? '' : destinationAuthorization.cwLimit}"/>
<span class="readonly-field">
<c:choose>
<c:when test="${fn:contains(destination.name, 'RF Operations')}">
N/A
</c:when>
<c:when test="${selectedLimit ne ''}">
<fmt:formatNumber value="${selectedLimit}"/>
<c:out value="${units}"/>
Expand All @@ -73,7 +76,7 @@
</c:choose>
</span>
<span class="editable-field">
<input name="limit[]" class="limit-input" type="text" value="${selectedBeamMode eq 'None' ? '' : fn:escapeXml(selectedLimit)}"${selectedBeamMode eq 'None' ? ' readonly="readonly"' : ''}/>
<input name="limit[]" class="limit-input" type="text" value="${selectedBeamMode eq 'None' ? '' : fn:escapeXml(selectedLimit)}"${selectedBeamMode eq 'None' || selectedBeamMode eq 'RF Only' ? ' readonly="readonly"' : ''}/>
<c:out value="${units}"/>
</span>
<input type="hidden" name="beamDestinationId[]" value="${destination.beamDestinationId}"/>
Expand Down

0 comments on commit b34ce00

Please sign in to comment.