package performa.search;

import oneit.objstore.*;
import oneit.objstore.rdbms.filters.*;
import performa.orm.*;


public class SearchWorkFlowTemplate extends BaseSearchWorkFlowTemplate
{
    private static final long serialVersionUID = 0L;
    
    // This constructor should not be called
    public SearchWorkFlowTemplate ()
    {
        // Do not add any code to this, always put it in initialiseNewObject
    }
    
    @Override
    public BaseBusinessClass[] doSearch()
    {
        BaseWorkFlowTemplate.SearchAll searchByAll = WorkFlowTemplate.SearchByAll();
        
        if (isTrue(getOnlyGlobalTemplates()))
        {
            return searchByAll.andIsGlobalTemplate(new EqualsFilter<>(Boolean.TRUE)).search(getTransaction());
        }
        
        return searchByAll.andIsGlobalTemplate(new IsNotNullFilter<>()).search(getTransaction());
    }
}