public boolean isOperationAllowed(Resource.Type operationLevel,
      ServiceComponentHost sch) throws AmbariException {
    MaintenanceState maintenanceState = getEffectiveState(sch);

    switch (operationLevel.getInternalType()) {
      case Cluster:
        if (maintenanceState.equals(MaintenanceState.OFF)) {
          return true;
        }
        break;
      case Service:
        if (maintenanceState.equals(MaintenanceState.IMPLIED_FROM_SERVICE)
            || maintenanceState.equals(MaintenanceState.OFF)) {
          return true;
        }
        break;
      case Host:
        if (maintenanceState.equals(MaintenanceState.IMPLIED_FROM_HOST)
            || maintenanceState.equals(MaintenanceState.OFF)) {
          return true;
        }
        break;
      case HostComponent: {
        return true;
      }
      default:
        LOG.warn("Unsupported Resource type, type = " + operationLevel);
        break;
    }
    return false;
  }
Determine based on the requesting Resource level and the state of the
operand whether to allow operations on it.

@param operationLevel
         Request Source: {CLUSTER, SERVICE, HOSTCOMPONENT, HOST}
@param sch
         HostComponent which is the operand of the operation
@return
@throws AmbariException
ambari-server/src/main/java/org/apache/ambari/server/controller/MaintenanceStateHelper.java