Compare commits

...
Author SHA1 Message Date
Darin Kelkhoff 7a4265ddc4 Release 0.1.4 2025-04-29 08:47:18 -05:00
Darin Kelkhoff cd99d328ba Update to do a to-record-from-table-dynamic style link on the recordId in ProcessTraceSummaryLineRecordInt 2025-04-21 11:45:24 -05:00
Darin Kelkhoff 14d28c311a Update qqq version (wrong build of sprint-61 was pulled in) 2025-02-24 12:08:20 -06:00
Darin Kelkhoff cbdc041e20 Update pom version and qqq dep 2025-02-24 11:56:52 -06:00
Darin Kelkhoff f16f557bfd UI enhancements:
- join ProcessTrace with QQQProcess and QQQTable (for key record)
- expose those joins (mostly so we can punch-in to a query-screen filtered by table name, from record-list widget)
- add RecentProcessTracesWidgetBuilder for dropping a recent-processes widget on a table view screen;
- make keyRecordId be linked to the key-record.
2025-02-24 11:17:40 -06:00
Darin Kelkhoff 46a390c869 Make use of .circleci/mvn-settings.xml 2025-02-20 14:52:36 -06:00
Darin Kelkhoff 43151a9886 Initial checkin 2025-02-20 14:51:41 -06:00
Darin Kelkhoff aafdebb7a8 Update image name 2025-02-20 14:50:12 -06:00
Darin Kelkhoff 5c81de06bf Update image name 2025-02-20 14:49:07 -06:00
Darin Kelkhoff 81d3abcd48 Update version to 0.1.2 2025-02-20 14:31:48 -06:00
Darin Kelkhoff d8be4aad1d Switch to use ProcessTracerKeyRecordMessage from backend-core; add try-catch when building record ints 2025-02-20 14:31:14 -06:00
Darin Kelkhoff 4eba1fb039 Deprecate this class - as it moved into qqq-backend-core (this class now extends the one from there (with an extra 'r' in its name) 2025-02-20 14:30:28 -06:00
Darin Kelkhoff f55bb484fa fix marking java version 17; update qqq dep (sprint-61) 2025-02-20 14:30:03 -06:00
13 changed files with 413 additions and 100 deletions

No files matched your search

+4 -59
View File
@@ -1,64 +1,9 @@
#version: 2.1
#
#commands:
#
# mvn_jar_deploy:
# steps:
# - checkout
# - run:
# name: Adjust pom version
# command: |
# .circleci/adjust-pom-version.sh
# - restore_cache:
# keys:
# - v1-dependencies-{{ checksum "pom.xml" }}
# - run:
# name: Run Maven Jar Deploy
# command: |
# mvn -s .circleci/mvn-settings.xml -T4 flatten:flatten jar:jar deploy:deploy
# - save_cache:
# paths:
# - ~/.m2
# key: v1-dependencies-{{ checksum "pom.xml" }}
#
#jobs:
# mvn_test:
# executor: cimg/openjdk:17.0.14
# steps:
# - mvn_verify
#
# mvn_deploy:
# executor: cimg/openjdk:17.0.14
# steps:
# - mvn_jar_deploy
#
#workflows:
# test_only:
# jobs:
# - mvn_test:
# context: qqq-maven-registry-credentials
# filters:
# branches:
# ignore: /(dev|integration.*)/
# tags:
# ignore: /(version|snapshot)-.*/
#
# deploy:
# jobs:
# - mvn_deploy:
# context: qqq-maven-registry-credentials
# filters:
# branches:
# only: /(dev|integration.*)/
# tags:
# only: /(version|snapshot)-.*/
version: 2.1
executors:
java-executor:
docker:
- image: circleci/openjdk:17-jdk
- image: cimg/openjdk:17.0
jobs:
verify:
@@ -70,7 +15,7 @@ jobs:
- v1-maven-cache-{{ checksum "pom.xml" }}
- run:
name: Verify with Maven
command: mvn verify
command: mvn -s .circleci/mvn-settings.xml verify
- store_test_results:
path: target/surefire-reports
- save_cache:
@@ -87,7 +32,7 @@ jobs:
- v1-maven-cache-{{ checksum "pom.xml" }}
- run:
name: Deploy with Maven
command: mvn deploy
command: mvn -s .circleci/mvn-settings.xml deploy
- store_test_results:
path: target/surefire-reports
- save_cache:
@@ -108,4 +53,4 @@ workflows:
context: qqq-maven-registry-credentials
filters:
branches:
only: main
only: main
+9
View File
@@ -0,0 +1,9 @@
<settings xmlns="http://maven.apache.org/SETTINGS/1.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/SETTINGS/1.0.0 http://maven.apache.org/xsd/settings-1.0.0.xsd">
<servers>
<server>
<id>github-qqq-maven-registry</id>
<username>${env.QQQ_MAVEN_REGISTRY_USERNAME}</username>
<password>${env.QQQ_MAVEN_REGISTRY_PASSWORD}</password>
</server>
</servers>
</settings>
+4 -3
View File
@@ -25,12 +25,13 @@
<groupId>com.kingsrook.qbits</groupId>
<artifactId>qbit-standard-process-trace</artifactId>
<version>0.1.1-SNAPSHOT</version>
<version>0.1.4</version>
<properties>
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
<project.reporting.outputEncoding>UTF-8</project.reporting.outputEncoding>
<maven.compiler.release>17</maven.compiler.release>
<maven.compiler.source>17</maven.compiler.source>
<maven.compiler.target>17</maven.compiler.target>
</properties>
<dependencyManagement>
@@ -38,7 +39,7 @@
<dependency>
<groupId>com.kingsrook.qqq</groupId>
<artifactId>qqq-bom-pom</artifactId>
<version>0.24.0-integration-sprint-59-20250210-161628</version>
<version>0.24.0-integration-sprint-61-20250224-173943</version>
<type>pom</type>
<scope>import</scope>
</dependency>
@@ -66,6 +66,7 @@ public class StandardProcessTraceQBitProducer implements MetaDataProducerInterfa
public MetaDataProducerMultiOutput produce(QInstance qInstance) throws QException
{
MetaDataProducerHelper.processAllMetaDataProducersInPackage(qInstance, ProcessTrace.class.getPackageName(), tableMetaDataCustomizer);
MetaDataProducerHelper.processAllMetaDataProducersInPackage(qInstance, getClass().getPackageName() + ".metadata", tableMetaDataCustomizer);
//////////////////////////////////////////////////////////////////////////////////////
// set the possible value source on the processTrace.userId field, if so configured //
@@ -0,0 +1,59 @@
/*
* QQQ - Low-code Application Framework for Engineers.
* Copyright (C) 2021-2025. 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.qbits.standardprocesstrace.metadata;
import com.kingsrook.qbits.standardprocesstrace.model.ProcessTrace;
import com.kingsrook.qqq.backend.core.exceptions.QException;
import com.kingsrook.qqq.backend.core.model.metadata.MetaDataProducer;
import com.kingsrook.qqq.backend.core.model.metadata.QInstance;
import com.kingsrook.qqq.backend.core.model.metadata.joins.JoinOn;
import com.kingsrook.qqq.backend.core.model.metadata.joins.JoinType;
import com.kingsrook.qqq.backend.core.model.metadata.joins.QJoinMetaData;
import com.kingsrook.qqq.backend.core.model.tables.QQQTable;
/*******************************************************************************
** Meta Data Producer for ProcessTraceJoinKeyRecordQQQTable
*******************************************************************************/
public class ProcessTraceJoinKeyRecordQQQTableMetaDataProducer extends MetaDataProducer<QJoinMetaData>
{
public static final String NAME = "ProcessTraceJoinKeyRecordQQQTable";
/*******************************************************************************
**
*******************************************************************************/
@Override
public QJoinMetaData produce(QInstance qInstance) throws QException
{
return (new QJoinMetaData()
.withLeftTable(ProcessTrace.TABLE_NAME)
.withRightTable(QQQTable.TABLE_NAME)
.withType(JoinType.MANY_TO_ONE)
.withJoinOn(new JoinOn("keyRecordQqqTableId", "id"))
.withName(NAME)
);
}
}
@@ -0,0 +1,59 @@
/*
* QQQ - Low-code Application Framework for Engineers.
* Copyright (C) 2021-2025. 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.qbits.standardprocesstrace.metadata;
import com.kingsrook.qbits.standardprocesstrace.model.ProcessTrace;
import com.kingsrook.qqq.backend.core.exceptions.QException;
import com.kingsrook.qqq.backend.core.model.metadata.MetaDataProducer;
import com.kingsrook.qqq.backend.core.model.metadata.QInstance;
import com.kingsrook.qqq.backend.core.model.metadata.joins.JoinOn;
import com.kingsrook.qqq.backend.core.model.metadata.joins.JoinType;
import com.kingsrook.qqq.backend.core.model.metadata.joins.QJoinMetaData;
import com.kingsrook.qqq.backend.core.model.processes.QQQProcess;
/*******************************************************************************
** Meta Data Producer for ProcessTraceJoinQQQProcess
*******************************************************************************/
public class ProcessTraceJoinQQQProcessMetaDataProducer extends MetaDataProducer<QJoinMetaData>
{
public static final String NAME = "ProcessTraceJoinQQQProcess";
/*******************************************************************************
**
*******************************************************************************/
@Override
public QJoinMetaData produce(QInstance qInstance) throws QException
{
return (new QJoinMetaData()
.withLeftTable(ProcessTrace.TABLE_NAME)
.withRightTable(QQQProcess.TABLE_NAME)
.withType(JoinType.MANY_TO_ONE)
.withJoinOn(new JoinOn("qqqProcessId", "id"))
.withName(NAME)
);
}
}
@@ -24,12 +24,19 @@ package com.kingsrook.qbits.standardprocesstrace.model;
import java.time.Instant;
import java.util.List;
import com.kingsrook.qbits.standardprocesstrace.metadata.ProcessTraceJoinKeyRecordQQQTableMetaDataProducer;
import com.kingsrook.qbits.standardprocesstrace.metadata.ProcessTraceJoinQQQProcessMetaDataProducer;
import com.kingsrook.qbits.standardprocesstrace.utils.ProcessTraceTableCustomizer;
import com.kingsrook.qqq.backend.core.actions.customizers.TableCustomizers;
import com.kingsrook.qqq.backend.core.exceptions.QException;
import com.kingsrook.qqq.backend.core.model.data.QField;
import com.kingsrook.qqq.backend.core.model.data.QRecord;
import com.kingsrook.qqq.backend.core.model.data.QRecordEntity;
import com.kingsrook.qqq.backend.core.model.metadata.QInstance;
import com.kingsrook.qqq.backend.core.model.metadata.code.QCodeReference;
import com.kingsrook.qqq.backend.core.model.metadata.fields.AdornmentType;
import com.kingsrook.qqq.backend.core.model.metadata.fields.DisplayFormat;
import com.kingsrook.qqq.backend.core.model.metadata.fields.FieldAdornment;
import com.kingsrook.qqq.backend.core.model.metadata.fields.ValueTooLongBehavior;
import com.kingsrook.qqq.backend.core.model.metadata.joins.QJoinMetaData;
import com.kingsrook.qqq.backend.core.model.metadata.layout.QIcon;
@@ -90,7 +97,12 @@ public class ProcessTrace extends QRecordEntity
.withSection(new QFieldSection("identity", new QIcon().withName("badge"), Tier.T1, List.of("id", "qqqProcessId", "processUUID", "userId")))
.withSection(new QFieldSection("data", new QIcon().withName("text_snippet"), Tier.T2, List.of("startTimestamp", "endTimestamp", "runtimeMillis", "keyRecordQqqTableId", "keyRecordId", "recordCount", "exceptionMessage")))
.withSection(new QFieldSection("summaryLines", new QIcon().withName("horizontal_rule"), Tier.T2).withWidgetName(childJoinName))
.withExposedJoin(new ExposedJoin().withLabel("Summary Lines").withJoinPath(List.of(childJoinName)).withJoinTable(ProcessTraceSummaryLine.TABLE_NAME));
.withExposedJoin(new ExposedJoin().withLabel("Summary Lines").withJoinPath(List.of(childJoinName)).withJoinTable(ProcessTraceSummaryLine.TABLE_NAME))
.withExposedJoin(new ExposedJoin().withLabel("Key Record Table").withJoinPath(List.of(ProcessTraceJoinKeyRecordQQQTableMetaDataProducer.NAME)).withJoinTable(QQQTable.TABLE_NAME))
.withExposedJoin(new ExposedJoin().withLabel("Process").withJoinPath(List.of(ProcessTraceJoinQQQProcessMetaDataProducer.NAME)).withJoinTable(QQQProcess.TABLE_NAME));
table.withCustomizer(TableCustomizers.POST_QUERY_RECORD, new QCodeReference(ProcessTraceTableCustomizer.class));
table.getField("keyRecordId").withFieldAdornment(new FieldAdornment(AdornmentType.LINK).withValue(AdornmentType.LinkValues.TO_RECORD_FROM_TABLE_DYNAMIC, true));
return (table);
}
@@ -22,48 +22,22 @@
package com.kingsrook.qbits.standardprocesstrace.model;
import com.kingsrook.qqq.backend.core.processes.tracing.ProcessTracerMessage;
import com.kingsrook.qqq.backend.core.processes.tracing.ProcessTracerKeyRecordMessage;
/*******************************************************************************
**
*******************************************************************************/
public class ProcessTraceKeyRecordMessage extends ProcessTracerMessage
@Deprecated(since = "Moved to ProcessTracerKeyRecordMessage in qqq-backend-core")
public class ProcessTraceKeyRecordMessage extends ProcessTracerKeyRecordMessage
{
private final String tableName;
private final Integer recordId;
/***************************************************************************
**
***************************************************************************/
public ProcessTraceKeyRecordMessage(String tableName, Integer recordId)
{
super("Process Key Record is " + tableName + " " + recordId);
this.tableName = tableName;
this.recordId = recordId;
super(tableName, recordId);
}
/*******************************************************************************
** Getter for tableName
**
*******************************************************************************/
public String getTableName()
{
return (tableName);
}
/*******************************************************************************
** Getter for id
**
*******************************************************************************/
public Integer getRecordId()
{
return (recordId);
}
}
@@ -24,11 +24,16 @@ package com.kingsrook.qbits.standardprocesstrace.model;
import java.util.List;
import com.kingsrook.qbits.standardprocesstrace.utils.ProcessTraceSummaryLineRecordIntTableCustomizer;
import com.kingsrook.qqq.backend.core.actions.customizers.TableCustomizers;
import com.kingsrook.qqq.backend.core.exceptions.QException;
import com.kingsrook.qqq.backend.core.model.data.QField;
import com.kingsrook.qqq.backend.core.model.data.QRecord;
import com.kingsrook.qqq.backend.core.model.data.QRecordEntity;
import com.kingsrook.qqq.backend.core.model.metadata.QInstance;
import com.kingsrook.qqq.backend.core.model.metadata.code.QCodeReference;
import com.kingsrook.qqq.backend.core.model.metadata.fields.AdornmentType;
import com.kingsrook.qqq.backend.core.model.metadata.fields.FieldAdornment;
import com.kingsrook.qqq.backend.core.model.metadata.joins.QJoinMetaData;
import com.kingsrook.qqq.backend.core.model.metadata.layout.QIcon;
import com.kingsrook.qqq.backend.core.model.metadata.producers.MetaDataCustomizerInterface;
@@ -78,6 +83,9 @@ public class ProcessTraceSummaryLineRecordInt extends QRecordEntity
.withExposedJoin(new ExposedJoin().withLabel("Summary Line").withJoinPath(List.of(parentJoinName)).withJoinTable(ProcessTraceSummaryLine.TABLE_NAME))
.withExposedJoin(new ExposedJoin().withLabel("Process Trace").withJoinPath(List.of(parentJoinName, grandparentJoinName)).withJoinTable(ProcessTrace.TABLE_NAME));
table.withCustomizer(TableCustomizers.POST_QUERY_RECORD, new QCodeReference(ProcessTraceSummaryLineRecordIntTableCustomizer.class));
table.getField("recordId").withFieldAdornment(new FieldAdornment(AdornmentType.LINK).withValue(AdornmentType.LinkValues.TO_RECORD_FROM_TABLE_DYNAMIC, true));
return (table);
}
}
@@ -0,0 +1,78 @@
/*
* QQQ - Low-code Application Framework for Engineers.
* Copyright (C) 2021-2025. 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.qbits.standardprocesstrace.utils;
import java.io.Serializable;
import java.util.List;
import java.util.Map;
import java.util.Objects;
import java.util.Set;
import java.util.stream.Collectors;
import com.kingsrook.qqq.backend.core.actions.customizers.TableCustomizerInterface;
import com.kingsrook.qqq.backend.core.exceptions.QException;
import com.kingsrook.qqq.backend.core.model.actions.tables.QueryOrGetInputInterface;
import com.kingsrook.qqq.backend.core.model.actions.tables.query.QCriteriaOperator;
import com.kingsrook.qqq.backend.core.model.actions.tables.query.QFilterCriteria;
import com.kingsrook.qqq.backend.core.model.actions.tables.query.QQueryFilter;
import com.kingsrook.qqq.backend.core.model.data.QRecord;
import com.kingsrook.qqq.backend.core.model.metadata.fields.AdornmentType;
import com.kingsrook.qqq.backend.core.model.tables.QQQTable;
import com.kingsrook.qqq.backend.core.processes.utils.GeneralProcessUtils;
/*******************************************************************************
**
*******************************************************************************/
public class ProcessTraceSummaryLineRecordIntTableCustomizer implements TableCustomizerInterface
{
/***************************************************************************
**
***************************************************************************/
@Override
public List<QRecord> postQuery(QueryOrGetInputInterface queryInput, List<QRecord> records) throws QException
{
if(queryInput.getShouldGenerateDisplayValues())
{
///////////////////////////////////////////////////////////////////////////////////////
// for records with a qqqTableId - look up that table name, then set a display-value //
// for the Link type adornment, to the recordId record within that table. //
///////////////////////////////////////////////////////////////////////////////////////
Set<Serializable> tableIds = records.stream().map(r -> r.getValue("qqqTableId")).filter(Objects::nonNull).collect(Collectors.toSet());
if(!tableIds.isEmpty())
{
Map<Serializable, QRecord> tableMap = GeneralProcessUtils.loadTableToMap(QQQTable.TABLE_NAME, "id", new QQueryFilter(new QFilterCriteria("id", QCriteriaOperator.IN, tableIds)));
for(QRecord record : records)
{
QRecord qqqTableRecord = tableMap.get(record.getValue("qqqTableId"));
if(qqqTableRecord != null && record.getValue("recordId") != null)
{
record.setDisplayValue("recordId:" + AdornmentType.LinkValues.TO_RECORD_FROM_TABLE_DYNAMIC, qqqTableRecord.getValueString("name"));
}
}
}
}
return (records);
}
}
@@ -0,0 +1,78 @@
/*
* QQQ - Low-code Application Framework for Engineers.
* Copyright (C) 2021-2025. 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.qbits.standardprocesstrace.utils;
import java.io.Serializable;
import java.util.List;
import java.util.Map;
import java.util.Objects;
import java.util.Set;
import java.util.stream.Collectors;
import com.kingsrook.qqq.backend.core.actions.customizers.TableCustomizerInterface;
import com.kingsrook.qqq.backend.core.exceptions.QException;
import com.kingsrook.qqq.backend.core.model.actions.tables.QueryOrGetInputInterface;
import com.kingsrook.qqq.backend.core.model.actions.tables.query.QCriteriaOperator;
import com.kingsrook.qqq.backend.core.model.actions.tables.query.QFilterCriteria;
import com.kingsrook.qqq.backend.core.model.actions.tables.query.QQueryFilter;
import com.kingsrook.qqq.backend.core.model.data.QRecord;
import com.kingsrook.qqq.backend.core.model.metadata.fields.AdornmentType;
import com.kingsrook.qqq.backend.core.model.tables.QQQTable;
import com.kingsrook.qqq.backend.core.processes.utils.GeneralProcessUtils;
/*******************************************************************************
**
*******************************************************************************/
public class ProcessTraceTableCustomizer implements TableCustomizerInterface
{
/***************************************************************************
**
***************************************************************************/
@Override
public List<QRecord> postQuery(QueryOrGetInputInterface queryInput, List<QRecord> records) throws QException
{
if(queryInput.getShouldGenerateDisplayValues())
{
////////////////////////////////////////////////////////////////////////////////////////////////
// for records with a keyRecordQqqTableId - look up that table name, then set a display-value //
// for the Link type adornment, to the keyRecordId record within that table. //
////////////////////////////////////////////////////////////////////////////////////////////////
Set<Serializable> tableIds = records.stream().map(r -> r.getValue("keyRecordQqqTableId")).filter(Objects::nonNull).collect(Collectors.toSet());
if(!tableIds.isEmpty())
{
Map<Serializable, QRecord> tableMap = GeneralProcessUtils.loadTableToMap(QQQTable.TABLE_NAME, "id", new QQueryFilter(new QFilterCriteria("id", QCriteriaOperator.IN, tableIds)));
for(QRecord record : records)
{
QRecord qqqTableRecord = tableMap.get(record.getValue("keyRecordQqqTableId"));
if(qqqTableRecord != null && record.getValue("keyRecordId") != null)
{
record.setDisplayValue("keyRecordId:" + AdornmentType.LinkValues.TO_RECORD_FROM_TABLE_DYNAMIC, qqqTableRecord.getValueString("name"));
}
}
}
}
return (records);
}
}
@@ -0,0 +1,80 @@
/*
* QQQ - Low-code Application Framework for Engineers.
* Copyright (C) 2021-2025. 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.qbits.standardprocesstrace.utils;
import com.kingsrook.qbits.standardprocesstrace.model.ProcessTrace;
import com.kingsrook.qqq.backend.core.actions.dashboard.widgets.RecordListWidgetRenderer;
import com.kingsrook.qqq.backend.core.model.actions.tables.query.QCriteriaOperator;
import com.kingsrook.qqq.backend.core.model.actions.tables.query.QFilterOrderBy;
import com.kingsrook.qqq.backend.core.model.actions.tables.query.QQueryFilter;
import com.kingsrook.qqq.backend.core.model.metadata.dashboard.QWidgetMetaData;
import com.kingsrook.qqq.backend.core.utils.StringUtils;
/*******************************************************************************
** factory/builder class, to create instances of RecordListWidgetRenderer for
** specific tables and/or processes within a table.
*******************************************************************************/
public class RecentProcessTracesWidgetBuilder
{
/***************************************************************************
**
***************************************************************************/
public static QWidgetMetaData buildWidget(String tableName)
{
QWidgetMetaData widgetMetaData = RecordListWidgetRenderer.widgetMetaDataBuilder(tableName + "RecentProcessTraces")
.withTableName(ProcessTrace.TABLE_NAME)
.withMaxRows(20)
.withLabel("Recent Process Traces")
.withFilter(new QQueryFilter()
.withCriteria("qqqTable.name", QCriteriaOperator.EQUALS, tableName)
.withCriteria("keyRecordId", QCriteriaOperator.EQUALS, "${input.id}")
.withOrderBy(new QFilterOrderBy("id", false))
).getWidgetMetaData();
return (widgetMetaData);
}
/***************************************************************************
**
***************************************************************************/
public static QWidgetMetaData buildWidget(String tableName, String processName)
{
QWidgetMetaData widgetMetaData = RecordListWidgetRenderer.widgetMetaDataBuilder(tableName + StringUtils.ucFirst(processName) + "RecentProcessTraces")
.withTableName(ProcessTrace.TABLE_NAME)
.withMaxRows(20)
.withLabel("Recent Process Traces")
.withFilter(new QQueryFilter()
.withCriteria("qqqProcess.name", QCriteriaOperator.EQUALS, processName)
.withCriteria("qqqTable.name", QCriteriaOperator.EQUALS, tableName)
.withCriteria("keyRecordId", QCriteriaOperator.EQUALS, "${input.id}")
.withOrderBy(new QFilterOrderBy("id", false))
).getWidgetMetaData();
return (widgetMetaData);
}
}
@@ -30,7 +30,6 @@ import java.util.List;
import java.util.Map;
import com.kingsrook.qbits.standardprocesstrace.StandardProcessTraceQBitConfig;
import com.kingsrook.qbits.standardprocesstrace.model.ProcessTrace;
import com.kingsrook.qbits.standardprocesstrace.model.ProcessTraceKeyRecordMessage;
import com.kingsrook.qbits.standardprocesstrace.model.ProcessTraceSummaryLine;
import com.kingsrook.qbits.standardprocesstrace.model.ProcessTraceSummaryLineRecordInt;
import com.kingsrook.qqq.backend.core.actions.tables.GetAction;
@@ -55,6 +54,7 @@ import com.kingsrook.qqq.backend.core.model.session.QUser;
import com.kingsrook.qqq.backend.core.model.tables.QQQTableTableManager;
import com.kingsrook.qqq.backend.core.processes.implementations.etl.streamedwithfrontend.StreamedETLWithFrontendProcess;
import com.kingsrook.qqq.backend.core.processes.tracing.ProcessTracerInterface;
import com.kingsrook.qqq.backend.core.processes.tracing.ProcessTracerKeyRecordMessage;
import com.kingsrook.qqq.backend.core.processes.tracing.ProcessTracerMessage;
import com.kingsrook.qqq.backend.core.utils.CollectionUtils;
import com.kingsrook.qqq.backend.core.utils.StringUtils;
@@ -170,7 +170,7 @@ public class StandardProcessTracer implements ProcessTracerInterface
{
try
{
if(message instanceof ProcessTraceKeyRecordMessage keyRecordMessage)
if(message instanceof ProcessTracerKeyRecordMessage keyRecordMessage)
{
Integer keyTableId = QQQTableTableManager.getQQQTableId(QContext.getQInstance(), keyRecordMessage.getTableName());
@@ -297,12 +297,21 @@ public class StandardProcessTracer implements ProcessTracerInterface
for(Serializable primaryKey : processSummaryLine.getPrimaryKeys())
{
Integer recordId = ValueUtils.getValueAsInteger(primaryKey);
if(recordId != null)
try
{
recordIntList.add(new ProcessTraceSummaryLineRecordInt()
.withQqqTableId(qqqTableId)
.withRecordId(recordId));
Integer recordId = ValueUtils.getValueAsInteger(primaryKey);
if(recordId != null)
{
recordIntList.add(new ProcessTraceSummaryLineRecordInt()
.withQqqTableId(qqqTableId)
.withRecordId(recordId));
}
}
catch(Exception e)
{
/////////////////////////////////////////////////////////////////////
// todo log (would be loud)? or, let not be integer maybe better? //
/////////////////////////////////////////////////////////////////////
}
}
}