Fix bulk process PVS rendering

This commit is contained in:
2022-10-19 09:09:44 -05:00
parent 2d3d1091fd
commit b12de62295
5 changed files with 28 additions and 8 deletions

View File

@ -113,13 +113,13 @@ public class RunProcessAction
{
case BREAK ->
{
LOG.info("Breaking process [" + process.getName() + "] at frontend step (as requested by caller): " + step.getName());
LOG.trace("Breaking process [" + process.getName() + "] at frontend step (as requested by caller): " + step.getName());
processState.setNextStepName(step.getName());
break STEP_LOOP;
}
case SKIP ->
{
LOG.info("Skipping frontend step [" + step.getName() + "] in process [" + process.getName() + "] (as requested by caller)");
LOG.trace("Skipping frontend step [" + step.getName() + "] in process [" + process.getName() + "] (as requested by caller)");
//////////////////////////////////////////////////////////////////////
// much less error prone in case this code changes in the future... //
@ -129,7 +129,7 @@ public class RunProcessAction
}
case FAIL ->
{
LOG.info("Throwing error for frontend step [" + step.getName() + "] in process [" + process.getName() + "] (as requested by caller)");
LOG.trace("Throwing error for frontend step [" + step.getName() + "] in process [" + process.getName() + "] (as requested by caller)");
throw (new QException("Failing process at step " + step.getName() + " (as requested, to fail on frontend steps)"));
}
default -> throw new IllegalStateException("Unexpected value: " + runProcessInput.getFrontendStepBehavior());
@ -313,7 +313,7 @@ public class RunProcessAction
QStepMetaData step = process.getStep(stepName);
if(step == null)
{
throw(new QException("Could not find a step named [" + stepName + "] in this process."));
throw (new QException("Could not find a step named [" + stepName + "] in this process."));
}
result.add(step);
}

View File

@ -41,6 +41,7 @@ import com.kingsrook.qqq.backend.core.model.actions.tables.query.QueryOutput;
import com.kingsrook.qqq.backend.core.model.data.QRecord;
import com.kingsrook.qqq.backend.core.model.metadata.QInstance;
import com.kingsrook.qqq.backend.core.model.metadata.fields.QFieldMetaData;
import com.kingsrook.qqq.backend.core.model.metadata.fields.QFieldType;
import com.kingsrook.qqq.backend.core.model.metadata.possiblevalues.QPossibleValue;
import com.kingsrook.qqq.backend.core.model.metadata.possiblevalues.QPossibleValueSource;
import com.kingsrook.qqq.backend.core.model.metadata.possiblevalues.QPossibleValueSourceType;
@ -48,6 +49,7 @@ import com.kingsrook.qqq.backend.core.model.metadata.tables.QTableMetaData;
import com.kingsrook.qqq.backend.core.model.session.QSession;
import com.kingsrook.qqq.backend.core.utils.CollectionUtils;
import com.kingsrook.qqq.backend.core.utils.ListingHash;
import com.kingsrook.qqq.backend.core.utils.ValueUtils;
import org.apache.logging.log4j.LogManager;
import org.apache.logging.log4j.Logger;
@ -145,7 +147,7 @@ public class QPossibleValueTranslator
/*******************************************************************************
** For a given field and (raw/id) value, get the translated (string) value.
*******************************************************************************/
String translatePossibleValue(QFieldMetaData field, Serializable value)
public String translatePossibleValue(QFieldMetaData field, Serializable value)
{
QPossibleValueSource possibleValueSource = qInstance.getPossibleValueSource(field.getPossibleValueSourceName());
if(possibleValueSource == null)
@ -154,6 +156,11 @@ public class QPossibleValueTranslator
return (null);
}
if(field.getType().equals(QFieldType.INTEGER) && !(value instanceof Integer))
{
value = ValueUtils.getValueAsInteger(value);
}
return translatePossibleValue(possibleValueSource, value);
}

View File

@ -25,6 +25,7 @@ package com.kingsrook.qqq.backend.core.processes.implementations.bulk.edit;
import java.io.Serializable;
import java.util.ArrayList;
import java.util.List;
import com.kingsrook.qqq.backend.core.actions.values.QPossibleValueTranslator;
import com.kingsrook.qqq.backend.core.actions.values.QValueFormatter;
import com.kingsrook.qqq.backend.core.exceptions.QException;
import com.kingsrook.qqq.backend.core.model.actions.processes.ProcessSummaryLine;
@ -167,7 +168,18 @@ public class BulkEditTransformStep extends AbstractTransformStep
String verb = isExecuteStep ? "was" : "will be";
if(StringUtils.hasContent(ValueUtils.getValueAsString(value)))
{
String formattedValue = qValueFormatter.formatValue(field, value); // todo - PVS!
String formattedValue = qValueFormatter.formatValue(field, value);
if(field.getPossibleValueSourceName() != null)
{
QPossibleValueTranslator qPossibleValueTranslator = new QPossibleValueTranslator(runBackendStepInput.getInstance(), runBackendStepInput.getSession());
String translatedValue = qPossibleValueTranslator.translatePossibleValue(field, value);
if(StringUtils.hasContent(translatedValue))
{
formattedValue = translatedValue;
}
}
summaryLine.setMessage(label + " " + verb + " set to: " + formattedValue);
}
else

View File

@ -59,7 +59,7 @@ public class StreamedETLValidateStep extends BaseStreamedETLStep implements Back
boolean supportsFullValidation = runBackendStepInput.getValuePrimitiveBoolean(StreamedETLWithFrontendProcess.FIELD_SUPPORTS_FULL_VALIDATION);
if(!supportsFullValidation)
{
LOG.info("Process does not support validation, so skipping validation step");
LOG.debug("Process does not support validation, so skipping validation step");
return;
}
@ -69,7 +69,7 @@ public class StreamedETLValidateStep extends BaseStreamedETLStep implements Back
boolean doFullValidation = runBackendStepInput.getValuePrimitiveBoolean(StreamedETLWithFrontendProcess.FIELD_DO_FULL_VALIDATION);
if(!doFullValidation)
{
LOG.info("Not requested to do full validation, so skipping validation step");
LOG.trace("Not requested to do full validation, so skipping validation step");
return;
}

View File

@ -104,6 +104,7 @@ public class ScheduleManager
if(propertyValue.equals("false"))
{
LOG.warn("Not starting ScheduleManager (per system property [" + propertyName + "=" + propertyValue + "]).");
return;
}
for(QQueueProviderMetaData queueProvider : qInstance.getQueueProviders().values())