public static RequestOperationLevel operationLevelFromEntity(RequestEntity entity) {
    RequestOperationLevel level = null;
    RequestOperationLevelEntity operationLevelEntity = entity.getRequestOperationLevel();

    if (operationLevelEntity != null) {
      String hostName = null;
      if (operationLevelEntity.getHostId() != null) {
        HostEntity hostEntity = hostDAO.findById(operationLevelEntity.getHostId());
        hostName = hostEntity.getHostName();
      }

      level = new RequestOperationLevel(
          Resource.Type.valueOf(operationLevelEntity.getLevel()),
          operationLevelEntity.getClusterName(),
          operationLevelEntity.getServiceName(),
          operationLevelEntity.getHostComponentName(),
          hostName);
    }

    return level;
  }
@param entity  the request entity
@return the {@link RequestOperationLevel} from the entity, or {@code null}
       if none is defined
ambari-server/src/main/java/org/apache/ambari/server/actionmanager/Request.java