private RoleCommand getRoleCommand(HostRoleCommand hostRoleCommand) {
    if (hostRoleCommand.getRoleCommand().equals(RoleCommand.CUSTOM_COMMAND)) {
      return hostRoleCommand.getCustomCommandName().equals("RESTART") ? RoleCommand.RESTART : RoleCommand.CUSTOM_COMMAND;
    }
    return hostRoleCommand.getRoleCommand();
  }
This method return more detailed RoleCommand type. For now, i've added code
only for RESTART name of CUSTOM COMMAND, but in future i think all other will be added too.
This method was implemented for fix in role_command_order.json, for RESTART commands.
ambari-server/src/main/java/org/apache/ambari/server/stageplanner/RoleGraph.java