diff --git a/qqq-backend-core/src/main/java/com/kingsrook/qqq/backend/core/actions/tables/DeleteAction.java b/qqq-backend-core/src/main/java/com/kingsrook/qqq/backend/core/actions/tables/DeleteAction.java index 415c006b..b0c37efc 100644 --- a/qqq-backend-core/src/main/java/com/kingsrook/qqq/backend/core/actions/tables/DeleteAction.java +++ b/qqq-backend-core/src/main/java/com/kingsrook/qqq/backend/core/actions/tables/DeleteAction.java @@ -183,21 +183,14 @@ public class DeleteAction if(CollectionUtils.nullSafeHasContents(primaryKeyList)) { - if(CollectionUtils.nullSafeHasContents(deleteInput.getTable().getRecordSecurityLocks())) - { - //////////////////////////////////////////////////////////////////////////////////////////////////////// - // if the table has any security locks, then we need full entities (to record the keys), not just ids // - //////////////////////////////////////////////////////////////////////////////////////////////////////// - QueryInput queryInput = new QueryInput(); - queryInput.setTableName(deleteInput.getTableName()); - queryInput.setFilter(new QQueryFilter(new QFilterCriteria(deleteInput.getTable().getPrimaryKeyField(), QCriteriaOperator.IN, primaryKeyList))); - QueryOutput queryOutput = new QueryAction().execute(queryInput); - recordListForAudit = queryOutput.getRecords(); - } - else - { - recordListForAudit = primaryKeyList.stream().map(pk -> new QRecord().withValue(deleteInput.getTable().getPrimaryKeyField(), pk)).toList(); - } + //////////////////////////////////////////////////////////////////////////////////// + // always fetch the records - we'll use them anyway for checking not-exist below // + //////////////////////////////////////////////////////////////////////////////////// + QueryInput queryInput = new QueryInput(); + queryInput.setTableName(deleteInput.getTableName()); + queryInput.setFilter(new QQueryFilter(new QFilterCriteria(deleteInput.getTable().getPrimaryKeyField(), QCriteriaOperator.IN, primaryKeyList))); + QueryOutput queryOutput = new QueryAction().execute(queryInput); + recordListForAudit = queryOutput.getRecords(); } } @@ -241,7 +234,9 @@ public class DeleteAction { for(QRecord record : oldRecordList) { - lookedUpRecords.put(record.getValue(table.getPrimaryKeyField()), record); + Serializable primaryKeyValue = record.getValue(table.getPrimaryKeyField()); + primaryKeyValue = ValueUtils.getValueAsFieldType(primaryKeyField.getType(), primaryKeyValue); + lookedUpRecords.put(primaryKeyValue, record); } } else if(!primaryKeysToLookup.isEmpty()) diff --git a/qqq-backend-core/src/main/java/com/kingsrook/qqq/backend/core/actions/tables/InsertAction.java b/qqq-backend-core/src/main/java/com/kingsrook/qqq/backend/core/actions/tables/InsertAction.java index 3f25bf9b..8b1bcb91 100644 --- a/qqq-backend-core/src/main/java/com/kingsrook/qqq/backend/core/actions/tables/InsertAction.java +++ b/qqq-backend-core/src/main/java/com/kingsrook/qqq/backend/core/actions/tables/InsertAction.java @@ -81,6 +81,11 @@ public class InsertAction extends AbstractQActionFunction postInsertCustomizer = QCodeLoader.getTableCustomizer(AbstractPostInsertCustomizer.class, table, TableCustomizers.POST_INSERT_RECORD.getRole()); setAutomationStatusField(insertInput); diff --git a/qqq-backend-core/src/main/java/com/kingsrook/qqq/backend/core/model/metadata/tables/QFieldSection.java b/qqq-backend-core/src/main/java/com/kingsrook/qqq/backend/core/model/metadata/tables/QFieldSection.java index bccda36e..51b1e2b8 100644 --- a/qqq-backend-core/src/main/java/com/kingsrook/qqq/backend/core/model/metadata/tables/QFieldSection.java +++ b/qqq-backend-core/src/main/java/com/kingsrook/qqq/backend/core/model/metadata/tables/QFieldSection.java @@ -24,6 +24,7 @@ package com.kingsrook.qqq.backend.core.model.metadata.tables; import java.util.List; import com.kingsrook.qqq.backend.core.model.metadata.layout.QIcon; +import com.kingsrook.qqq.backend.core.utils.collections.MutableList; /******************************************************************************* @@ -63,7 +64,7 @@ public class QFieldSection this.label = label; this.icon = icon; this.tier = tier; - this.fieldNames = fieldNames; + this.fieldNames = new MutableList<>(fieldNames); } @@ -76,7 +77,7 @@ public class QFieldSection this.name = name; this.icon = icon; this.tier = tier; - this.fieldNames = fieldNames; + this.fieldNames = new MutableList<>(fieldNames); } diff --git a/qqq-middleware-api/src/main/java/com/kingsrook/qqq/api/javalin/QJavalinApiHandler.java b/qqq-middleware-api/src/main/java/com/kingsrook/qqq/api/javalin/QJavalinApiHandler.java index a231f328..d48a6a7e 100644 --- a/qqq-middleware-api/src/main/java/com/kingsrook/qqq/api/javalin/QJavalinApiHandler.java +++ b/qqq-middleware-api/src/main/java/com/kingsrook/qqq/api/javalin/QJavalinApiHandler.java @@ -650,12 +650,15 @@ public class QJavalinApiHandler { try { - InsertInput insertInput = new InsertInput(); - insertInput.setTableName(APILog.TABLE_NAME); - // todo - security fields!!!!! - // todo - user!!!! - insertInput.setRecords(List.of(apiLog.toQRecord())); - new InsertAction().executeAsync(insertInput); + if(QContext.getQInstance().getTable(APILog.TABLE_NAME) != null) + { + InsertInput insertInput = new InsertInput(); + insertInput.setTableName(APILog.TABLE_NAME); + // todo - security fields!!!!! + // todo - user!!!! + insertInput.setRecords(List.of(apiLog.toQRecord())); + new InsertAction().executeAsync(insertInput); + } } catch(Exception e) {