public static boolean hasRelations(RelationQuery query) {

    if (query == null || query.getRelations() == null || query.getRelations().isEmpty()) {
      return false;
    }

    return true;
  }
  public static boolean hasExcludedFields(RelationQuery query) {

    if (query == null || query.getExcludedFields() == null || query.getExcludedFields().isEmpty()) {
      return false;
    }

    return true;
  }
  public RelationQuery(RelationQuery relationQuery) {

    if (relationQuery == null) {

      return;
    }

    this.addRelations(relationQuery);
    this.addExcludedRelations(relationQuery);
    this.addExcludedFields(relationQuery);
    this.disableAutoRelations(relationQuery.isDisableAutoRelations());
    this.relationParameterHandler = relationQuery.getRelationParameterHandler();
    this.relationOrderByHandler = relationQuery.getRelationOrderByHandler();
    this.relationRowLimiterHandler = relationQuery.getRelationRowLimiterHandler();
  }
  public void addExcludedFields(RelationQuery relationQuery) {

    if (hasExcludedFields(relationQuery)) {

      this.addExcludedFields(relationQuery.getExcludedFields());
    }
  }
  public void addRelations(RelationQuery relationQuery) {

    if (hasRelations(relationQuery)) {

      this.addRelations(relationQuery.getRelations());
    }
  }
  @Override
  public RelationQuery clone() throws CloneNotSupportedException {

    RelationQuery clone = (RelationQuery) super.clone();

    if (this.excludedFields != null) {

      clone.excludedFields = new ArrayList<Field>(excludedFields);
    }

    if (this.excludedRelations != null) {

      clone.excludedRelations = new ArrayList<Field>(excludedRelations);
    }

    if (this.relations != null) {

      clone.relations = new ArrayList<Field>(relations);
    }

    return clone;
  }