public static ServiceAdvisorCommandType getEnum(String name) {
    for (ServiceAdvisorCommandType v : values()) {
      if (v.getValue().equalsIgnoreCase(name.replace("_", "-"))) {
        return v;
      }
    }
    throw new IllegalArgumentException();
  }
Instead of Enum.valueOf("value"), use this method instead to map the string to the correct Enum.
@param name Name with lowercase and dashes.
@return Enum that matches the string.
ambari-serviceadvisor/src/main/java/org/apache/ambari/serviceadvisor/ServiceAdvisorCommandType.java