SysDataviewLangFilter.java

/*
 * Copyright 2026 Global Crop Diversity Trust
 * Licensed under the Apache License, Version 2.0
 * See LICENSE file in project root folder or http://www.apache.org/licenses/LICENSE-2.0
 */

package org.gringlobal.service.filter;

import java.util.List;

import org.gringlobal.model.QSysDataviewLang;
import org.gringlobal.model.SysDataview;
import org.gringlobal.model.SysDataviewLang;

import lombok.EqualsAndHashCode;
import lombok.Getter;
import lombok.Setter;
import lombok.experimental.Accessors;

import com.querydsl.core.types.Predicate;

@Getter
@Setter
@EqualsAndHashCode(callSuper = true)
@Accessors(fluent = true)
public class SysDataviewLangFilter extends CooperatorOwnedLangFilter<SysDataviewLangFilter, SysDataviewLang, SysDataview, QSysDataviewLang> {

	private static final long serialVersionUID = 1674550807816705624L;

	public SysDataviewFilter sysDataview;

	/**
	 * Builds the query.
	 *
	 * @return the predicate
	 */
	@Override
	public List<Predicate> collectPredicates() {
		return collectPredicates(QSysDataviewLang.sysDataviewLang);
	}

	/**
	 * Builds the query.
	 *
	 * @param sysDataviewLang the sysDataviewLang
	 * @return the predicate
	 */
	public List<Predicate> collectPredicates(QSysDataviewLang sysDataviewLang) {
		final List<Predicate> predicates = super.collectSuperPredicates(sysDataviewLang, sysDataviewLang._super);

		if (sysDataview != null) {
			predicates.add(sysDataview.nestedPredicate(sysDataviewLang.entity()));
		}
		return predicates;
	}
}