mirror of
https://github.com/Kingsrook/qqq.git
synced 2025-07-18 13:10:44 +00:00
Merge pull request #33 from Kingsrook/feature/CE-551-change-logic-for-fed-ex
Feature/ce 551 change logic for fed ex
This commit is contained in:
@ -32,6 +32,9 @@ import com.kingsrook.qqq.backend.core.exceptions.QException;
|
|||||||
*******************************************************************************/
|
*******************************************************************************/
|
||||||
public abstract class MetaDataProducer<T extends TopLevelMetaDataInterface>
|
public abstract class MetaDataProducer<T extends TopLevelMetaDataInterface>
|
||||||
{
|
{
|
||||||
|
public static final int DEFAULT_SORT_ORDER = 500;
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
/*******************************************************************************
|
/*******************************************************************************
|
||||||
** Produce the metaData object. Generally, you don't want to add it to the instance
|
** Produce the metaData object. Generally, you don't want to add it to the instance
|
||||||
@ -43,11 +46,13 @@ public abstract class MetaDataProducer<T extends TopLevelMetaDataInterface>
|
|||||||
|
|
||||||
/*******************************************************************************
|
/*******************************************************************************
|
||||||
** In case this producer needs to run before (or after) others, this method
|
** In case this producer needs to run before (or after) others, this method
|
||||||
** can help influence that (e.g., if used by MetaDataProducerHelper).
|
** can control influence that (e.g., if used by MetaDataProducerHelper).
|
||||||
|
**
|
||||||
|
** Smaller values run first.
|
||||||
*******************************************************************************/
|
*******************************************************************************/
|
||||||
public int getSortOrder()
|
public int getSortOrder()
|
||||||
{
|
{
|
||||||
return (500);
|
return (DEFAULT_SORT_ORDER);
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@ -22,6 +22,7 @@
|
|||||||
package com.kingsrook.qqq.backend.core.model.metadata.frontend;
|
package com.kingsrook.qqq.backend.core.model.metadata.frontend;
|
||||||
|
|
||||||
|
|
||||||
|
import java.io.Serializable;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
import com.fasterxml.jackson.annotation.JsonInclude;
|
import com.fasterxml.jackson.annotation.JsonInclude;
|
||||||
import com.fasterxml.jackson.annotation.JsonInclude.Include;
|
import com.fasterxml.jackson.annotation.JsonInclude.Include;
|
||||||
@ -38,14 +39,15 @@ import com.kingsrook.qqq.backend.core.model.metadata.fields.QFieldType;
|
|||||||
@JsonInclude(Include.NON_NULL)
|
@JsonInclude(Include.NON_NULL)
|
||||||
public class QFrontendFieldMetaData
|
public class QFrontendFieldMetaData
|
||||||
{
|
{
|
||||||
private String name;
|
private String name;
|
||||||
private String label;
|
private String label;
|
||||||
private QFieldType type;
|
private QFieldType type;
|
||||||
private boolean isRequired;
|
private boolean isRequired;
|
||||||
private boolean isEditable;
|
private boolean isEditable;
|
||||||
private boolean isHeavy;
|
private boolean isHeavy;
|
||||||
private String possibleValueSourceName;
|
private String possibleValueSourceName;
|
||||||
private String displayFormat;
|
private String displayFormat;
|
||||||
|
private Serializable defaultValue;
|
||||||
|
|
||||||
private List<FieldAdornment> adornments;
|
private List<FieldAdornment> adornments;
|
||||||
|
|
||||||
@ -69,6 +71,7 @@ public class QFrontendFieldMetaData
|
|||||||
this.possibleValueSourceName = fieldMetaData.getPossibleValueSourceName();
|
this.possibleValueSourceName = fieldMetaData.getPossibleValueSourceName();
|
||||||
this.displayFormat = fieldMetaData.getDisplayFormat();
|
this.displayFormat = fieldMetaData.getDisplayFormat();
|
||||||
this.adornments = fieldMetaData.getAdornments();
|
this.adornments = fieldMetaData.getAdornments();
|
||||||
|
this.defaultValue = fieldMetaData.getDefaultValue();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@ -170,4 +173,14 @@ public class QFrontendFieldMetaData
|
|||||||
return possibleValueSourceName;
|
return possibleValueSourceName;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
/*******************************************************************************
|
||||||
|
** Getter for defaultValue
|
||||||
|
**
|
||||||
|
*******************************************************************************/
|
||||||
|
public Serializable getDefaultValue()
|
||||||
|
{
|
||||||
|
return defaultValue;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
@ -24,6 +24,8 @@ package com.kingsrook.qqq.backend.core.model.metadata.layout;
|
|||||||
|
|
||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
import com.kingsrook.qqq.backend.core.model.metadata.QInstance;
|
||||||
|
import com.kingsrook.qqq.backend.core.model.metadata.TopLevelMetaDataInterface;
|
||||||
import com.kingsrook.qqq.backend.core.model.metadata.permissions.MetaDataWithPermissionRules;
|
import com.kingsrook.qqq.backend.core.model.metadata.permissions.MetaDataWithPermissionRules;
|
||||||
import com.kingsrook.qqq.backend.core.model.metadata.permissions.QPermissionRules;
|
import com.kingsrook.qqq.backend.core.model.metadata.permissions.QPermissionRules;
|
||||||
import com.kingsrook.qqq.backend.core.model.metadata.processes.QProcessMetaData;
|
import com.kingsrook.qqq.backend.core.model.metadata.processes.QProcessMetaData;
|
||||||
@ -36,7 +38,7 @@ import com.kingsrook.qqq.backend.core.utils.CollectionUtils;
|
|||||||
** MetaData definition of an App - an entity that organizes tables & processes
|
** MetaData definition of an App - an entity that organizes tables & processes
|
||||||
** and can be arranged hierarchically (e.g, apps can contain other apps).
|
** and can be arranged hierarchically (e.g, apps can contain other apps).
|
||||||
*******************************************************************************/
|
*******************************************************************************/
|
||||||
public class QAppMetaData implements QAppChildMetaData, MetaDataWithPermissionRules
|
public class QAppMetaData implements QAppChildMetaData, MetaDataWithPermissionRules, TopLevelMetaDataInterface
|
||||||
{
|
{
|
||||||
private String name;
|
private String name;
|
||||||
private String label;
|
private String label;
|
||||||
@ -414,4 +416,14 @@ public class QAppMetaData implements QAppChildMetaData, MetaDataWithPermissionRu
|
|||||||
return (this);
|
return (this);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
/*******************************************************************************
|
||||||
|
**
|
||||||
|
*******************************************************************************/
|
||||||
|
@Override
|
||||||
|
public void addSelfToInstance(QInstance qInstance)
|
||||||
|
{
|
||||||
|
qInstance.addApp(this);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
@ -0,0 +1,85 @@
|
|||||||
|
/*
|
||||||
|
* QQQ - Low-code Application Framework for Engineers.
|
||||||
|
* Copyright (C) 2021-2023. 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.actions.tables.helpers;
|
||||||
|
|
||||||
|
|
||||||
|
import java.util.concurrent.TimeUnit;
|
||||||
|
import com.kingsrook.qqq.backend.core.BaseTest;
|
||||||
|
import com.kingsrook.qqq.backend.core.utils.SleepUtils;
|
||||||
|
import org.junit.jupiter.api.Test;
|
||||||
|
import static org.junit.jupiter.api.Assertions.assertFalse;
|
||||||
|
import static org.junit.jupiter.api.Assertions.assertTrue;
|
||||||
|
|
||||||
|
|
||||||
|
/*******************************************************************************
|
||||||
|
** Unit test for ActionTimeoutHelper
|
||||||
|
*******************************************************************************/
|
||||||
|
class ActionTimeoutHelperTest extends BaseTest
|
||||||
|
{
|
||||||
|
boolean didCancel = false;
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
/*******************************************************************************
|
||||||
|
**
|
||||||
|
*******************************************************************************/
|
||||||
|
@Test
|
||||||
|
void testTimesOut()
|
||||||
|
{
|
||||||
|
didCancel = false;
|
||||||
|
ActionTimeoutHelper actionTimeoutHelper = new ActionTimeoutHelper(10, TimeUnit.MILLISECONDS, () -> doCancel());
|
||||||
|
actionTimeoutHelper.start();
|
||||||
|
SleepUtils.sleep(50, TimeUnit.MILLISECONDS);
|
||||||
|
assertTrue(didCancel);
|
||||||
|
assertTrue(actionTimeoutHelper.getDidTimeout());
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
/*******************************************************************************
|
||||||
|
**
|
||||||
|
*******************************************************************************/
|
||||||
|
@Test
|
||||||
|
void testGetsCancelled()
|
||||||
|
{
|
||||||
|
didCancel = false;
|
||||||
|
ActionTimeoutHelper actionTimeoutHelper = new ActionTimeoutHelper(100, TimeUnit.MILLISECONDS, () -> doCancel());
|
||||||
|
actionTimeoutHelper.start();
|
||||||
|
SleepUtils.sleep(10, TimeUnit.MILLISECONDS);
|
||||||
|
actionTimeoutHelper.cancel();
|
||||||
|
assertFalse(didCancel);
|
||||||
|
SleepUtils.sleep(200, TimeUnit.MILLISECONDS);
|
||||||
|
assertFalse(didCancel);
|
||||||
|
assertFalse(actionTimeoutHelper.getDidTimeout());
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
/*******************************************************************************
|
||||||
|
**
|
||||||
|
*******************************************************************************/
|
||||||
|
private void doCancel()
|
||||||
|
{
|
||||||
|
didCancel = true;
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
@ -45,6 +45,7 @@ import com.kingsrook.qqq.backend.core.model.metadata.tables.QFieldSection;
|
|||||||
import com.kingsrook.qqq.backend.core.model.metadata.tables.QTableMetaData;
|
import com.kingsrook.qqq.backend.core.model.metadata.tables.QTableMetaData;
|
||||||
import com.kingsrook.qqq.backend.core.model.metadata.tables.Tier;
|
import com.kingsrook.qqq.backend.core.model.metadata.tables.Tier;
|
||||||
import com.kingsrook.qqq.backend.core.model.metadata.tables.UniqueKey;
|
import com.kingsrook.qqq.backend.core.model.metadata.tables.UniqueKey;
|
||||||
|
import com.kingsrook.qqq.backend.core.utils.CollectionUtils;
|
||||||
|
|
||||||
|
|
||||||
/*******************************************************************************
|
/*******************************************************************************
|
||||||
@ -62,7 +63,8 @@ public class ApiInstanceMetaDataProvider
|
|||||||
*******************************************************************************/
|
*******************************************************************************/
|
||||||
public static void defineAll(QInstance qInstance, String backendName, Consumer<QTableMetaData> backendDetailEnricher) throws QException
|
public static void defineAll(QInstance qInstance, String backendName, Consumer<QTableMetaData> backendDetailEnricher) throws QException
|
||||||
{
|
{
|
||||||
definePossibleValueSources(qInstance);
|
definePossibleValueSourcesUsedByApiLogTable(qInstance);
|
||||||
|
definePossibleValueSourcesForApiNameAndVersion(qInstance);
|
||||||
defineAPILogTable(qInstance, backendName, backendDetailEnricher);
|
defineAPILogTable(qInstance, backendName, backendDetailEnricher);
|
||||||
defineAPILogUserTable(qInstance, backendName, backendDetailEnricher);
|
defineAPILogUserTable(qInstance, backendName, backendDetailEnricher);
|
||||||
}
|
}
|
||||||
@ -72,7 +74,7 @@ public class ApiInstanceMetaDataProvider
|
|||||||
/*******************************************************************************
|
/*******************************************************************************
|
||||||
**
|
**
|
||||||
*******************************************************************************/
|
*******************************************************************************/
|
||||||
private static void definePossibleValueSources(QInstance instance)
|
public static void definePossibleValueSourcesUsedByApiLogTable(QInstance instance)
|
||||||
{
|
{
|
||||||
instance.addPossibleValueSource(new QPossibleValueSource()
|
instance.addPossibleValueSource(new QPossibleValueSource()
|
||||||
.withName(TABLE_NAME_API_LOG_USER)
|
.withName(TABLE_NAME_API_LOG_USER)
|
||||||
@ -104,7 +106,15 @@ public class ApiInstanceMetaDataProvider
|
|||||||
new QPossibleValue<>(429, "429 (Too Many Requests)"),
|
new QPossibleValue<>(429, "429 (Too Many Requests)"),
|
||||||
new QPossibleValue<>(500, "500 (Internal Server Error)")
|
new QPossibleValue<>(500, "500 (Internal Server Error)")
|
||||||
)));
|
)));
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
/*******************************************************************************
|
||||||
|
**
|
||||||
|
*******************************************************************************/
|
||||||
|
public static void definePossibleValueSourcesForApiNameAndVersion(QInstance instance)
|
||||||
|
{
|
||||||
////////////////////////////////////////////////////////////////////////////
|
////////////////////////////////////////////////////////////////////////////
|
||||||
// loop over api names and versions, building out possible values sources //
|
// loop over api names and versions, building out possible values sources //
|
||||||
////////////////////////////////////////////////////////////////////////////
|
////////////////////////////////////////////////////////////////////////////
|
||||||
@ -121,14 +131,14 @@ public class ApiInstanceMetaDataProvider
|
|||||||
apiNamePossibleValues.add(new QPossibleValue<>(entry.getKey(), entry.getValue().getLabel()));
|
apiNamePossibleValues.add(new QPossibleValue<>(entry.getKey(), entry.getValue().getLabel()));
|
||||||
|
|
||||||
ApiInstanceMetaData apiInstanceMetaData = entry.getValue();
|
ApiInstanceMetaData apiInstanceMetaData = entry.getValue();
|
||||||
allVersions.addAll(apiInstanceMetaData.getPastVersions());
|
allVersions.addAll(CollectionUtils.nonNullCollection(apiInstanceMetaData.getPastVersions()));
|
||||||
allVersions.addAll(apiInstanceMetaData.getSupportedVersions());
|
allVersions.addAll(CollectionUtils.nonNullCollection(apiInstanceMetaData.getSupportedVersions()));
|
||||||
|
|
||||||
///////////////////////////////////////////////////////////////////////////////////////////////////////
|
///////////////////////////////////////////////////////////////////////////////////////////////////////
|
||||||
// I think we don't want future-versions in this dropdown, I think... //
|
// I think we don't want future-versions in this dropdown, I think... //
|
||||||
// grr, actually todo maybe we want this to be a table-backed enum, with past/present/future columns //
|
// grr, actually todo maybe we want this to be a table-backed enum, with past/present/future columns //
|
||||||
///////////////////////////////////////////////////////////////////////////////////////////////////////
|
///////////////////////////////////////////////////////////////////////////////////////////////////////
|
||||||
allVersions.addAll(apiInstanceMetaData.getFutureVersions());
|
allVersions.addAll(CollectionUtils.nonNullCollection(apiInstanceMetaData.getFutureVersions()));
|
||||||
}
|
}
|
||||||
|
|
||||||
instance.addPossibleValueSource(new QPossibleValueSource()
|
instance.addPossibleValueSource(new QPossibleValueSource()
|
||||||
|
Reference in New Issue
Block a user