misc fixes

This commit is contained in:
2023-03-31 16:30:56 -05:00
parent 6fbfbe9db2
commit f79bf85c14
4 changed files with 28 additions and 24 deletions

View File

@ -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())

View File

@ -81,6 +81,11 @@ public class InsertAction extends AbstractQActionFunction<InsertInput, InsertOut
ActionHelper.validateSession(insertInput);
QTableMetaData table = insertInput.getTable();
if(table == null)
{
throw (new QException("Error: Undefined table: " + insertInput.getTableName()));
}
Optional<AbstractPostInsertCustomizer> postInsertCustomizer = QCodeLoader.getTableCustomizer(AbstractPostInsertCustomizer.class, table, TableCustomizers.POST_INSERT_RECORD.getRole());
setAutomationStatusField(insertInput);

View File

@ -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);
}