mirror of
https://github.com/Kingsrook/qqq.git
synced 2025-07-20 06:00:44 +00:00
Checkpoint, WIP on processes in api
This commit is contained in:
@ -370,7 +370,7 @@ public class QInstanceEnricher
|
||||
|
||||
for(QSupplementalProcessMetaData supplementalProcessMetaData : CollectionUtils.nonNullMap(process.getSupplementalMetaData()).values())
|
||||
{
|
||||
supplementalProcessMetaData.enrich(process);
|
||||
supplementalProcessMetaData.enrich(this, process);
|
||||
}
|
||||
|
||||
enrichPermissionRules(process);
|
||||
|
@ -54,6 +54,9 @@ public class QProcessMetaData implements QAppChildMetaData, MetaDataWithPermissi
|
||||
private BasepullConfiguration basepullConfiguration;
|
||||
private QPermissionRules permissionRules;
|
||||
|
||||
private Integer minInputRecords = null;
|
||||
private Integer maxInputRecords = null;
|
||||
|
||||
private List<QStepMetaData> stepList; // these are the steps that are ran, by-default, in the order they are ran in
|
||||
private Map<String, QStepMetaData> steps; // this is the full map of possible steps
|
||||
|
||||
@ -64,6 +67,7 @@ public class QProcessMetaData implements QAppChildMetaData, MetaDataWithPermissi
|
||||
private Map<String, QSupplementalProcessMetaData> supplementalMetaData;
|
||||
|
||||
|
||||
|
||||
/*******************************************************************************
|
||||
**
|
||||
*******************************************************************************/
|
||||
@ -605,4 +609,66 @@ public class QProcessMetaData implements QAppChildMetaData, MetaDataWithPermissi
|
||||
return (this);
|
||||
}
|
||||
|
||||
|
||||
|
||||
/*******************************************************************************
|
||||
** Getter for minInputRecords
|
||||
*******************************************************************************/
|
||||
public Integer getMinInputRecords()
|
||||
{
|
||||
return (this.minInputRecords);
|
||||
}
|
||||
|
||||
|
||||
|
||||
/*******************************************************************************
|
||||
** Setter for minInputRecords
|
||||
*******************************************************************************/
|
||||
public void setMinInputRecords(Integer minInputRecords)
|
||||
{
|
||||
this.minInputRecords = minInputRecords;
|
||||
}
|
||||
|
||||
|
||||
|
||||
/*******************************************************************************
|
||||
** Fluent setter for minInputRecords
|
||||
*******************************************************************************/
|
||||
public QProcessMetaData withMinInputRecords(Integer minInputRecords)
|
||||
{
|
||||
this.minInputRecords = minInputRecords;
|
||||
return (this);
|
||||
}
|
||||
|
||||
|
||||
|
||||
/*******************************************************************************
|
||||
** Getter for maxInputRecords
|
||||
*******************************************************************************/
|
||||
public Integer getMaxInputRecords()
|
||||
{
|
||||
return (this.maxInputRecords);
|
||||
}
|
||||
|
||||
|
||||
|
||||
/*******************************************************************************
|
||||
** Setter for maxInputRecords
|
||||
*******************************************************************************/
|
||||
public void setMaxInputRecords(Integer maxInputRecords)
|
||||
{
|
||||
this.maxInputRecords = maxInputRecords;
|
||||
}
|
||||
|
||||
|
||||
|
||||
/*******************************************************************************
|
||||
** Fluent setter for maxInputRecords
|
||||
*******************************************************************************/
|
||||
public QProcessMetaData withMaxInputRecords(Integer maxInputRecords)
|
||||
{
|
||||
this.maxInputRecords = maxInputRecords;
|
||||
return (this);
|
||||
}
|
||||
|
||||
}
|
||||
|
@ -22,7 +22,7 @@
|
||||
package com.kingsrook.qqq.backend.core.model.metadata.processes;
|
||||
|
||||
|
||||
import com.kingsrook.qqq.backend.core.model.metadata.tables.QTableMetaData;
|
||||
import com.kingsrook.qqq.backend.core.instances.QInstanceEnricher;
|
||||
|
||||
|
||||
/*******************************************************************************
|
||||
@ -69,7 +69,7 @@ public abstract class QSupplementalProcessMetaData
|
||||
/*******************************************************************************
|
||||
**
|
||||
*******************************************************************************/
|
||||
public void enrich(QProcessMetaData process)
|
||||
public void enrich(QInstanceEnricher qInstanceEnricher, QProcessMetaData process)
|
||||
{
|
||||
////////////////////////
|
||||
// noop in base class //
|
||||
|
@ -0,0 +1,19 @@
|
||||
package com.kingsrook.qqq.backend.core.processes.implementations.etl.streamedwithfrontend;
|
||||
|
||||
|
||||
import com.kingsrook.qqq.backend.core.exceptions.QException;
|
||||
|
||||
|
||||
/*******************************************************************************
|
||||
**
|
||||
*******************************************************************************/
|
||||
public class CouldNotFindQueryFilterForExtractStepException extends QException
|
||||
{
|
||||
/*******************************************************************************
|
||||
**
|
||||
*******************************************************************************/
|
||||
public CouldNotFindQueryFilterForExtractStepException(String message)
|
||||
{
|
||||
super(message);
|
||||
}
|
||||
}
|
@ -223,7 +223,7 @@ public class ExtractViaQueryStep extends AbstractExtractStep
|
||||
return (new QQueryFilter().withCriteria(new QFilterCriteria(table.getPrimaryKeyField(), QCriteriaOperator.IN, idStrings)));
|
||||
}
|
||||
|
||||
throw (new QException("Could not find query filter for Extract step."));
|
||||
throw (new CouldNotFindQueryFilterForExtractStepException("Could not find query filter for Extract step."));
|
||||
}
|
||||
|
||||
|
||||
|
@ -407,6 +407,30 @@ public class StreamedETLWithFrontendProcess
|
||||
|
||||
|
||||
|
||||
/*******************************************************************************
|
||||
** Fluent setter for minInputRecords
|
||||
**
|
||||
*******************************************************************************/
|
||||
public Builder withMinInputRecords(Integer minInputRecords)
|
||||
{
|
||||
processMetaData.setMinInputRecords(minInputRecords);
|
||||
return (this);
|
||||
}
|
||||
|
||||
|
||||
|
||||
/*******************************************************************************
|
||||
** Fluent setter for maxInputRecords
|
||||
**
|
||||
*******************************************************************************/
|
||||
public Builder withMaxInputRecords(Integer maxInputRecords)
|
||||
{
|
||||
processMetaData.setMaxInputRecords(maxInputRecords);
|
||||
return (this);
|
||||
}
|
||||
|
||||
|
||||
|
||||
/*******************************************************************************
|
||||
**
|
||||
*******************************************************************************/
|
||||
|
@ -22,6 +22,9 @@
|
||||
package com.kingsrook.qqq.backend.core.utils;
|
||||
|
||||
|
||||
import java.util.function.Consumer;
|
||||
import java.util.function.Predicate;
|
||||
import com.kingsrook.qqq.backend.core.utils.lambdas.UnsafeConsumer;
|
||||
import com.kingsrook.qqq.backend.core.utils.lambdas.UnsafeSupplier;
|
||||
|
||||
|
||||
@ -96,4 +99,44 @@ public class ObjectUtils
|
||||
return (defaultIfThrew);
|
||||
}
|
||||
|
||||
|
||||
|
||||
/*******************************************************************************
|
||||
**
|
||||
*******************************************************************************/
|
||||
public static <T> void ifNotNull(T object, Consumer<T> consumer)
|
||||
{
|
||||
if(object != null)
|
||||
{
|
||||
consumer.accept(object);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
/*******************************************************************************
|
||||
**
|
||||
*******************************************************************************/
|
||||
public static <T, E extends Exception> void ifNotNullUnsafe(T object, UnsafeConsumer<T, E> consumer) throws E
|
||||
{
|
||||
if(object != null)
|
||||
{
|
||||
consumer.run(object);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
/*******************************************************************************
|
||||
**
|
||||
*******************************************************************************/
|
||||
public static <T> T requireConditionElse(T a, Predicate<T> condition, T b)
|
||||
{
|
||||
if(condition.test(a))
|
||||
{
|
||||
return (a);
|
||||
}
|
||||
return (b);
|
||||
}
|
||||
|
||||
}
|
||||
|
@ -35,18 +35,18 @@ import java.util.function.Supplier;
|
||||
**
|
||||
** Can use it 2 ways:
|
||||
** MapBuilder.of(key, value, key2, value2, ...) => Map (a HashMap)
|
||||
** MapBuilder.<KeyType ValueType>of(SomeMap::new).with(key, value).with(key2, value2)...build() => SomeMap (the type you specify)
|
||||
** MapBuilder.of(() -> new SomeMap<SomeKeyType, SomeValueType>()).with(key, value).with(key2, value2)...build() => SomeMap (the type you specify)
|
||||
*******************************************************************************/
|
||||
public class MapBuilder<K, V>
|
||||
public class MapBuilder<K, V, M extends Map<K, V>>
|
||||
{
|
||||
private Map<K, V> map;
|
||||
private M map;
|
||||
|
||||
|
||||
|
||||
/*******************************************************************************
|
||||
**
|
||||
*******************************************************************************/
|
||||
private MapBuilder(Map<K, V> map)
|
||||
private MapBuilder(M map)
|
||||
{
|
||||
this.map = map;
|
||||
}
|
||||
@ -56,7 +56,7 @@ public class MapBuilder<K, V>
|
||||
/*******************************************************************************
|
||||
**
|
||||
*******************************************************************************/
|
||||
public static <K, V> MapBuilder<K, V> of(Supplier<Map<K, V>> mapSupplier)
|
||||
public static <K, V, M extends Map<K, V>> MapBuilder<K, V, M> of(Supplier<M> mapSupplier)
|
||||
{
|
||||
return (new MapBuilder<>(mapSupplier.get()));
|
||||
}
|
||||
@ -66,7 +66,7 @@ public class MapBuilder<K, V>
|
||||
/*******************************************************************************
|
||||
**
|
||||
*******************************************************************************/
|
||||
public MapBuilder<K, V> with(K key, V value)
|
||||
public MapBuilder<K, V, M> with(K key, V value)
|
||||
{
|
||||
map.put(key, value);
|
||||
return (this);
|
||||
@ -77,7 +77,7 @@ public class MapBuilder<K, V>
|
||||
/*******************************************************************************
|
||||
**
|
||||
*******************************************************************************/
|
||||
public Map<K, V> build()
|
||||
public M build()
|
||||
{
|
||||
return (this.map);
|
||||
}
|
||||
|
Reference in New Issue
Block a user