Merged dev into feature/CE-604-complete-shipment-sla-updates-and-local-tnt-rules

This commit is contained in:
2023-10-27 16:10:29 -05:00
6 changed files with 93 additions and 0 deletions

View File

@ -112,6 +112,12 @@ public class QValueFormatter
{
return formatLocalTime(lt);
}
//////////////////////////////////////////////////////////////////////////////////////////
// else, just return the value as a string, rather than going through String.formatted //
// this saves some overhead incurred by String.formatted when called millions of times. //
//////////////////////////////////////////////////////////////////////////////////////////
return (ValueUtils.getValueAsString(value));
}
////////////////////////////////////////////////////////

View File

@ -0,0 +1,50 @@
/*
* QQQ - Low-code Application Framework for Engineers.
* Copyright (C) 2021-2022. Kingsrook, LLC
* 651 N Broad St Ste 205 # 6917 | Middletown DE 19709 | United States
* contact@kingsrook.com
* https://github.com/Kingsrook/
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU Affero General Public License as
* published by the Free Software Foundation, either version 3 of the
* License, or (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU Affero General Public License for more details.
*
* You should have received a copy of the GNU Affero General Public License
* along with this program. If not, see <https://www.gnu.org/licenses/>.
*/
package com.kingsrook.qqq.backend.core.processes.implementations.etl.streamedwithfrontend;
import com.kingsrook.qqq.backend.core.exceptions.QException;
import com.kingsrook.qqq.backend.core.model.actions.processes.RunBackendStepInput;
import com.kingsrook.qqq.backend.core.model.actions.processes.RunBackendStepOutput;
/*******************************************************************************
** Load step that does nothing.
**
*******************************************************************************/
public class NoopLoadStep extends AbstractLoadStep
{
/*******************************************************************************
** Execute the backend step - using the request as input, and the result as output.
**
*******************************************************************************/
@Override
public void run(RunBackendStepInput runBackendStepInput, RunBackendStepOutput runBackendStepOutput) throws QException
{
///////////
// noop. //
///////////
}
}

View File

@ -90,4 +90,15 @@ public class InMemoryStateProvider implements StateProviderInterface
}
}
/*******************************************************************************
** Remove a block of data, under a key, from the state store.
*******************************************************************************/
@Override
public void remove(AbstractStateKey key)
{
map.remove(key);
}
}

View File

@ -52,4 +52,10 @@ public interface StateProviderInterface
** Get a block of data, under a key, from the state store.
*******************************************************************************/
<T extends Serializable> Optional<T> get(Class<? extends T> type, AbstractStateKey key);
/*******************************************************************************
** Remove a block of data, under a key, from the state store.
*******************************************************************************/
void remove(AbstractStateKey key);
}

View File

@ -30,6 +30,7 @@ import java.util.Optional;
import com.kingsrook.qqq.backend.core.logging.QLogger;
import com.kingsrook.qqq.backend.core.utils.JsonUtils;
import org.apache.commons.io.FileUtils;
import static com.kingsrook.qqq.backend.core.logging.LogUtils.logPair;
/*******************************************************************************
@ -110,6 +111,21 @@ public class TempFileStateProvider implements StateProviderInterface
/*******************************************************************************
** Remove a block of data, under a key, from the state store.
*******************************************************************************/
@Override
public void remove(AbstractStateKey key)
{
File file = getFile(key);
if(!file.delete())
{
LOG.warn("Error deleting state-providing tempFile", logPair("file", file.getAbsolutePath()));
}
}
/*******************************************************************************
** Get the file referenced by a key
*******************************************************************************/

View File

@ -57,6 +57,10 @@ class QValueFormatterTest extends BaseTest
{
assertNull(QValueFormatter.formatValue(new QFieldMetaData().withDisplayFormat(DisplayFormat.COMMAS), null));
assertEquals("1", QValueFormatter.formatValue(new QFieldMetaData(), 1));
assertEquals("1", QValueFormatter.formatValue(new QFieldMetaData().withDisplayFormat("%s"), 1));
assertEquals("Hello", QValueFormatter.formatValue(new QFieldMetaData().withDisplayFormat("%s"), "Hello"));
assertEquals("1", QValueFormatter.formatValue(new QFieldMetaData().withDisplayFormat(DisplayFormat.COMMAS), 1));
assertEquals("1,000", QValueFormatter.formatValue(new QFieldMetaData().withDisplayFormat(DisplayFormat.COMMAS), 1000));
assertEquals("1000", QValueFormatter.formatValue(new QFieldMetaData().withDisplayFormat(null), 1000));