Skip to content

Commit

Permalink
Merge pull request #2650 from ControlSystemStudio/alarm_sevrpv
Browse files Browse the repository at this point in the history
Alarm config action: Preserve PV names
  • Loading branch information
kasemir authored Apr 21, 2023
2 parents d934240 + d3424df commit 65757b9
Showing 1 changed file with 31 additions and 21 deletions.
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*******************************************************************************
* Copyright (c) 2018 Oak Ridge National Laboratory.
* Copyright (c) 2018-2023 Oak Ridge National Laboratory.
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License v1.0
* which accompanies this distribution, and is available at
Expand Down Expand Up @@ -215,36 +215,46 @@ private void createTable()
}

/**
* This function extract the command option from detail "option:info"
* This function extracts the option from detail "option:info"
*
* @param titleDetailDelay
* @return enum Option_d either mailto or cmd
* @return enum Option_d (mailto, cmd, sevrpv)
*/
private Option_d getOptionFromDetail(TitleDetailDelay titleDetailDelay) {
Option_d option = null;
String detail = titleDetailDelay != null ? titleDetailDelay.detail : null;
String[] split = detail != null ? detail.split(":") : null;
String optionString = split != null && split.length > 0 ? split[0] : null;
try {
option = optionString != null ? Option_d.valueOf(optionString) : Option_d.mailto;
} catch (Exception e) {
option = Option_d.mailto;
private Option_d getOptionFromDetail(final TitleDetailDelay titleDetailDelay)
{
if (titleDetailDelay == null)
return null;

final int sep = titleDetailDelay.detail.indexOf(':');
if (sep < 0)
return Option_d.mailto;

try
{
return Option_d.valueOf(titleDetailDelay.detail.substring(0, sep));
}
catch (Exception e)
{
return Option_d.mailto;
}
return option;
}

/**
* This function extract the info from detail "option:info"
* This function extracts the info from detail "option:info"
*
* @param titleDetailDelay
* @return information eg : mail or command
* @return information eg : mail, command, PV
*/
private String getInfoFromDetail(TitleDetailDelay titleDetailDelay) {
String info = "";
String detail = titleDetailDelay != null ? titleDetailDelay.detail : null;
String[] split = detail != null ? detail.split(":") : null;
info = split != null && split.length > 1 ? split[1] : "";
return info;
private String getInfoFromDetail(final TitleDetailDelay titleDetailDelay)
{
if (titleDetailDelay == null)
return "";

final int sep = titleDetailDelay.detail.indexOf(':');
if (sep < 0)
return "";

return titleDetailDelay.detail.substring(sep+1);
}

/**
Expand Down

0 comments on commit 65757b9

Please sign in to comment.