All Downloads are FREE. Search and download functionalities are using the official Maven repository.

com.ctp.cdi.query.builder.part.QueryPart Maven / Gradle / Ivy

The newest version!
package com.ctp.cdi.query.builder.part;

import java.util.LinkedList;
import java.util.List;
import java.util.Set;

import com.ctp.cdi.query.builder.QueryBuilderContext;
import com.ctp.cdi.query.meta.DaoComponent;

/**
 *
 * @author thomashug
 */
public abstract class QueryPart  {
    
    protected List children = new LinkedList();
    
    protected abstract QueryPart build(String queryPart, String method, DaoComponent dao);
    
    protected abstract QueryPart buildQuery(QueryBuilderContext ctx);
    
    protected void buildQueryForChildren(QueryBuilderContext ctx) {
        for (QueryPart child : children) {
            child.buildQuery(ctx);
        }
    }
    
    protected boolean hasChildren(Set> excluded) {
        if (children == null || children.isEmpty()) {
            return false;
        }
        for (QueryPart part : children) {
            if (!excluded.contains(part.getClass())) {
                return true;
            }
        }
        return false;
    }
    
}




© 2015 - 2025 Weber Informatics LLC | Privacy Policy