mirror of
https://github.com/Kingsrook/qqq.git
synced 2025-07-18 13:10:44 +00:00
Update to clone query filters
This commit is contained in:
@ -222,7 +222,7 @@ public class GenerateReportAction
|
|||||||
*******************************************************************************/
|
*******************************************************************************/
|
||||||
private void gatherData(ReportInput reportInput, QReportDataSource dataSource, QReportView tableView, List<QReportView> pivotViews, List<QReportView> variantViews) throws QException
|
private void gatherData(ReportInput reportInput, QReportDataSource dataSource, QReportView tableView, List<QReportView> pivotViews, List<QReportView> variantViews) throws QException
|
||||||
{
|
{
|
||||||
QQueryFilter queryFilter = dataSource.getQueryFilter();
|
QQueryFilter queryFilter = dataSource.getQueryFilter().clone();
|
||||||
setInputValuesInQueryFilter(reportInput, queryFilter);
|
setInputValuesInQueryFilter(reportInput, queryFilter);
|
||||||
|
|
||||||
////////////////////////////////////////////////////////////////////////////////////////
|
////////////////////////////////////////////////////////////////////////////////////////
|
||||||
|
@ -23,6 +23,7 @@ package com.kingsrook.qqq.backend.core.model.actions.tables.query;
|
|||||||
|
|
||||||
|
|
||||||
import java.io.Serializable;
|
import java.io.Serializable;
|
||||||
|
import java.util.ArrayList;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
|
||||||
|
|
||||||
@ -30,7 +31,7 @@ import java.util.List;
|
|||||||
* A single criteria Component of a Query
|
* A single criteria Component of a Query
|
||||||
*
|
*
|
||||||
*******************************************************************************/
|
*******************************************************************************/
|
||||||
public class QFilterCriteria implements Serializable
|
public class QFilterCriteria implements Serializable, Cloneable
|
||||||
{
|
{
|
||||||
private String fieldName;
|
private String fieldName;
|
||||||
private QCriteriaOperator operator;
|
private QCriteriaOperator operator;
|
||||||
@ -38,6 +39,30 @@ public class QFilterCriteria implements Serializable
|
|||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
/*******************************************************************************
|
||||||
|
**
|
||||||
|
*******************************************************************************/
|
||||||
|
@Override
|
||||||
|
public QFilterCriteria clone()
|
||||||
|
{
|
||||||
|
try
|
||||||
|
{
|
||||||
|
QFilterCriteria clone = (QFilterCriteria) super.clone();
|
||||||
|
if(values != null)
|
||||||
|
{
|
||||||
|
clone.values = new ArrayList<>();
|
||||||
|
clone.values.addAll(values);
|
||||||
|
}
|
||||||
|
return clone;
|
||||||
|
}
|
||||||
|
catch(CloneNotSupportedException e)
|
||||||
|
{
|
||||||
|
throw new AssertionError();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
/*******************************************************************************
|
/*******************************************************************************
|
||||||
**
|
**
|
||||||
*******************************************************************************/
|
*******************************************************************************/
|
||||||
|
@ -29,13 +29,31 @@ import java.io.Serializable;
|
|||||||
** Bean representing an element of a query order-by clause.
|
** Bean representing an element of a query order-by clause.
|
||||||
**
|
**
|
||||||
*******************************************************************************/
|
*******************************************************************************/
|
||||||
public class QFilterOrderBy implements Serializable
|
public class QFilterOrderBy implements Serializable, Cloneable
|
||||||
{
|
{
|
||||||
private String fieldName;
|
private String fieldName;
|
||||||
private boolean isAscending = true;
|
private boolean isAscending = true;
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
/*******************************************************************************
|
||||||
|
**
|
||||||
|
*******************************************************************************/
|
||||||
|
@Override
|
||||||
|
public QFilterOrderBy clone()
|
||||||
|
{
|
||||||
|
try
|
||||||
|
{
|
||||||
|
return (QFilterOrderBy) super.clone();
|
||||||
|
}
|
||||||
|
catch(CloneNotSupportedException e)
|
||||||
|
{
|
||||||
|
throw new AssertionError();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
/*******************************************************************************
|
/*******************************************************************************
|
||||||
** Default no-arg constructor
|
** Default no-arg constructor
|
||||||
*******************************************************************************/
|
*******************************************************************************/
|
||||||
|
@ -31,13 +31,51 @@ import java.util.List;
|
|||||||
* Full "filter" for a query - a list of criteria and order-bys
|
* Full "filter" for a query - a list of criteria and order-bys
|
||||||
*
|
*
|
||||||
*******************************************************************************/
|
*******************************************************************************/
|
||||||
public class QQueryFilter implements Serializable
|
public class QQueryFilter implements Serializable, Cloneable
|
||||||
{
|
{
|
||||||
private List<QFilterCriteria> criteria = new ArrayList<>();
|
private List<QFilterCriteria> criteria = new ArrayList<>();
|
||||||
private List<QFilterOrderBy> orderBys = new ArrayList<>();
|
private List<QFilterOrderBy> orderBys = new ArrayList<>();
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
/*******************************************************************************
|
||||||
|
**
|
||||||
|
*******************************************************************************/
|
||||||
|
@Override
|
||||||
|
public QQueryFilter clone()
|
||||||
|
{
|
||||||
|
try
|
||||||
|
{
|
||||||
|
QQueryFilter clone = (QQueryFilter) super.clone();
|
||||||
|
|
||||||
|
if(criteria != null)
|
||||||
|
{
|
||||||
|
clone.criteria = new ArrayList<>();
|
||||||
|
for(QFilterCriteria criterion : criteria)
|
||||||
|
{
|
||||||
|
clone.criteria.add(criterion.clone());
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if(orderBys != null)
|
||||||
|
{
|
||||||
|
clone.orderBys = new ArrayList<>();
|
||||||
|
for(QFilterOrderBy orderBy : orderBys)
|
||||||
|
{
|
||||||
|
clone.orderBys.add(orderBy.clone());
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
return clone;
|
||||||
|
}
|
||||||
|
catch(CloneNotSupportedException e)
|
||||||
|
{
|
||||||
|
throw new AssertionError();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
/*******************************************************************************
|
/*******************************************************************************
|
||||||
** Getter for criteria
|
** Getter for criteria
|
||||||
**
|
**
|
||||||
|
Reference in New Issue
Block a user