Change process summary line to interface; add record-link summary-line

This commit is contained in:
2022-09-30 13:32:18 -05:00
parent 456364de2a
commit 17cace070c
12 changed files with 374 additions and 27 deletions

View File

@ -25,6 +25,7 @@ package com.kingsrook.qqq.backend.core.model.actions.processes;
import java.io.Serializable;
import java.util.ArrayList;
import java.util.List;
import com.kingsrook.qqq.backend.core.utils.StringUtils;
/*******************************************************************************
@ -32,7 +33,7 @@ import java.util.List;
** standard way to summarize information about the records in the process.
**
*******************************************************************************/
public class ProcessSummaryLine implements Serializable
public class ProcessSummaryLine implements ProcessSummaryLineInterface
{
private Status status;
private Integer count = 0;
@ -238,7 +239,7 @@ public class ProcessSummaryLine implements Serializable
/*******************************************************************************
**
*******************************************************************************/
public void addSelfToListIfAnyCount(ArrayList<ProcessSummaryLine> rs)
public void addSelfToListIfAnyCount(ArrayList<ProcessSummaryLineInterface> rs)
{
if(count != null && count > 0)
{
@ -401,4 +402,19 @@ public class ProcessSummaryLine implements Serializable
}
}
}
/*******************************************************************************
**
*******************************************************************************/
@Override
public void prepareForFrontend(boolean isForResultScreen)
{
if(!StringUtils.hasContent(getMessage()))
{
pickMessage(isForResultScreen);
}
}
}

View File

@ -0,0 +1,49 @@
/*
* 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.model.actions.processes;
import java.io.Serializable;
/*******************************************************************************
**
*******************************************************************************/
public interface ProcessSummaryLineInterface extends Serializable
{
/*******************************************************************************
** Getter for status
**
*******************************************************************************/
Status getStatus();
/*******************************************************************************
**
*******************************************************************************/
default void prepareForFrontend(boolean isForResultScreen)
{
}
}

View File

@ -0,0 +1,279 @@
/*
* 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.model.actions.processes;
import java.io.Serializable;
/*******************************************************************************
**
*******************************************************************************/
public class ProcessSummaryRecordLink implements ProcessSummaryLineInterface
{
private Status status;
private String tableName;
private Serializable recordId;
private String linkPreText;
private String linkText;
private String linkPostText;
/*******************************************************************************
** Constructor
**
*******************************************************************************/
public ProcessSummaryRecordLink()
{
}
/*******************************************************************************
**
*******************************************************************************/
public ProcessSummaryRecordLink(Status status, String tableName, Serializable recordId)
{
this.status = status;
this.tableName = tableName;
this.recordId = recordId;
}
/*******************************************************************************
**
*******************************************************************************/
public ProcessSummaryRecordLink(Status status, String tableName, Serializable recordId, String linkText)
{
this.status = status;
this.tableName = tableName;
this.recordId = recordId;
this.linkText = linkText;
}
/*******************************************************************************
** Getter for status
**
*******************************************************************************/
public Status getStatus()
{
return status;
}
/*******************************************************************************
** Setter for status
**
*******************************************************************************/
public void setStatus(Status status)
{
this.status = status;
}
/*******************************************************************************
** Fluent setter for status
**
*******************************************************************************/
public ProcessSummaryRecordLink withStatus(Status status)
{
this.status = status;
return (this);
}
/*******************************************************************************
** Getter for tableName
**
*******************************************************************************/
public String getTableName()
{
return tableName;
}
/*******************************************************************************
** Setter for tableName
**
*******************************************************************************/
public void setTableName(String tableName)
{
this.tableName = tableName;
}
/*******************************************************************************
** Fluent setter for tableName
**
*******************************************************************************/
public ProcessSummaryRecordLink withTableName(String tableName)
{
this.tableName = tableName;
return (this);
}
/*******************************************************************************
** Getter for recordId
**
*******************************************************************************/
public Serializable getRecordId()
{
return recordId;
}
/*******************************************************************************
** Setter for recordId
**
*******************************************************************************/
public void setRecordId(Serializable recordId)
{
this.recordId = recordId;
}
/*******************************************************************************
** Fluent setter for recordId
**
*******************************************************************************/
public ProcessSummaryRecordLink withRecordId(Serializable recordId)
{
this.recordId = recordId;
return (this);
}
/*******************************************************************************
** Getter for linkPreText
**
*******************************************************************************/
public String getLinkPreText()
{
return linkPreText;
}
/*******************************************************************************
** Setter for linkPreText
**
*******************************************************************************/
public void setLinkPreText(String linkPreText)
{
this.linkPreText = linkPreText;
}
/*******************************************************************************
** Fluent setter for linkPreText
**
*******************************************************************************/
public ProcessSummaryRecordLink withLinkPreText(String linkPreText)
{
this.linkPreText = linkPreText;
return (this);
}
/*******************************************************************************
** Getter for linkText
**
*******************************************************************************/
public String getLinkText()
{
return linkText;
}
/*******************************************************************************
** Setter for linkText
**
*******************************************************************************/
public void setLinkText(String linkText)
{
this.linkText = linkText;
}
/*******************************************************************************
** Fluent setter for linkText
**
*******************************************************************************/
public ProcessSummaryRecordLink withLinkText(String linkText)
{
this.linkText = linkText;
return (this);
}
/*******************************************************************************
** Getter for linkPostText
**
*******************************************************************************/
public String getLinkPostText()
{
return linkPostText;
}
/*******************************************************************************
** Setter for linkPostText
**
*******************************************************************************/
public void setLinkPostText(String linkPostText)
{
this.linkPostText = linkPostText;
}
/*******************************************************************************
** Fluent setter for linkPostText
**
*******************************************************************************/
public ProcessSummaryRecordLink withLinkPostText(String linkPostText)
{
this.linkPostText = linkPostText;
return (this);
}
}

View File

@ -25,6 +25,7 @@ package com.kingsrook.qqq.backend.core.processes.implementations.bulk.delete;
import java.util.ArrayList;
import com.kingsrook.qqq.backend.core.exceptions.QException;
import com.kingsrook.qqq.backend.core.model.actions.processes.ProcessSummaryLine;
import com.kingsrook.qqq.backend.core.model.actions.processes.ProcessSummaryLineInterface;
import com.kingsrook.qqq.backend.core.model.actions.processes.RunBackendStepInput;
import com.kingsrook.qqq.backend.core.model.actions.processes.RunBackendStepOutput;
import com.kingsrook.qqq.backend.core.model.actions.processes.Status;
@ -108,7 +109,7 @@ public class BulkDeleteTransformStep extends AbstractTransformStep
**
*******************************************************************************/
@Override
public ArrayList<ProcessSummaryLine> getProcessSummary(boolean isForResultScreen)
public ArrayList<ProcessSummaryLineInterface> getProcessSummary(RunBackendStepOutput runBackendStepOutput, boolean isForResultScreen)
{
if(isForResultScreen)
{
@ -119,7 +120,7 @@ public class BulkDeleteTransformStep extends AbstractTransformStep
okSummary.setMessage(tableLabel + " records will be deleted.");
}
ArrayList<ProcessSummaryLine> rs = new ArrayList<>();
ArrayList<ProcessSummaryLineInterface> rs = new ArrayList<>();
rs.add(okSummary);
return (rs);
}

View File

@ -28,6 +28,7 @@ import java.util.List;
import com.kingsrook.qqq.backend.core.actions.values.QValueFormatter;
import com.kingsrook.qqq.backend.core.exceptions.QException;
import com.kingsrook.qqq.backend.core.model.actions.processes.ProcessSummaryLine;
import com.kingsrook.qqq.backend.core.model.actions.processes.ProcessSummaryLineInterface;
import com.kingsrook.qqq.backend.core.model.actions.processes.RunBackendStepInput;
import com.kingsrook.qqq.backend.core.model.actions.processes.RunBackendStepOutput;
import com.kingsrook.qqq.backend.core.model.actions.processes.Status;
@ -196,7 +197,7 @@ public class BulkEditTransformStep extends AbstractTransformStep
**
*******************************************************************************/
@Override
public ArrayList<ProcessSummaryLine> getProcessSummary(boolean isForResultScreen)
public ArrayList<ProcessSummaryLineInterface> getProcessSummary(RunBackendStepOutput runBackendStepOutput, boolean isForResultScreen)
{
if(isForResultScreen)
{
@ -207,7 +208,7 @@ public class BulkEditTransformStep extends AbstractTransformStep
okSummary.setMessage(tableLabel + " records will be edited.");
}
ArrayList<ProcessSummaryLine> rs = new ArrayList<>();
ArrayList<ProcessSummaryLineInterface> rs = new ArrayList<>();
rs.add(okSummary);
rs.addAll(infoSummaries);
return (rs);

View File

@ -25,6 +25,7 @@ package com.kingsrook.qqq.backend.core.processes.implementations.bulk.insert;
import java.util.ArrayList;
import com.kingsrook.qqq.backend.core.exceptions.QException;
import com.kingsrook.qqq.backend.core.model.actions.processes.ProcessSummaryLine;
import com.kingsrook.qqq.backend.core.model.actions.processes.ProcessSummaryLineInterface;
import com.kingsrook.qqq.backend.core.model.actions.processes.RunBackendStepInput;
import com.kingsrook.qqq.backend.core.model.actions.processes.RunBackendStepOutput;
import com.kingsrook.qqq.backend.core.model.actions.processes.Status;
@ -101,7 +102,7 @@ public class BulkInsertTransformStep extends AbstractTransformStep
**
*******************************************************************************/
@Override
public ArrayList<ProcessSummaryLine> getProcessSummary(boolean isForResultScreen)
public ArrayList<ProcessSummaryLineInterface> getProcessSummary(RunBackendStepOutput runBackendStepOutput, boolean isForResultScreen)
{
if(isForResultScreen)
{
@ -112,7 +113,7 @@ public class BulkInsertTransformStep extends AbstractTransformStep
okSummary.setMessage(tableLabel + " records will be inserted.");
}
ArrayList<ProcessSummaryLine> rs = new ArrayList<>();
ArrayList<ProcessSummaryLineInterface> rs = new ArrayList<>();
rs.add(okSummary);
return (rs);
}

View File

@ -23,8 +23,8 @@ package com.kingsrook.qqq.backend.core.processes.implementations.etl.streamedwit
import java.util.ArrayList;
import com.kingsrook.qqq.backend.core.model.actions.processes.ProcessSummaryLine;
import com.kingsrook.qqq.backend.core.utils.StringUtils;
import com.kingsrook.qqq.backend.core.model.actions.processes.ProcessSummaryLineInterface;
import com.kingsrook.qqq.backend.core.model.actions.processes.RunBackendStepOutput;
/*******************************************************************************
@ -36,7 +36,7 @@ public interface ProcessSummaryProviderInterface
/*******************************************************************************
** Note - object needs to be serializable, and List isn't... so, use ArrayList?
*******************************************************************************/
ArrayList<ProcessSummaryLine> getProcessSummary(boolean isForResultScreen);
ArrayList<ProcessSummaryLineInterface> getProcessSummary(RunBackendStepOutput runBackendStepOutput, boolean isForResultScreen);
/*******************************************************************************
@ -44,20 +44,17 @@ public interface ProcessSummaryProviderInterface
** all lines have their proper message picked (e.g., if they have singular/plural
** and past/future variants).
*******************************************************************************/
default ArrayList<ProcessSummaryLine> doGetProcessSummary(boolean isForResultScreen)
default ArrayList<ProcessSummaryLineInterface> doGetProcessSummary(RunBackendStepOutput runBackendStepOutput, boolean isForResultScreen)
{
ArrayList<ProcessSummaryLine> processSummary = getProcessSummary(isForResultScreen);
ArrayList<ProcessSummaryLineInterface> processSummary = getProcessSummary(runBackendStepOutput, isForResultScreen);
if(processSummary == null)
{
return (null);
}
for(ProcessSummaryLine processSummaryLine : processSummary)
for(ProcessSummaryLineInterface processSummaryLine : processSummary)
{
if(!StringUtils.hasContent(processSummaryLine.getMessage()))
{
processSummaryLine.pickMessage(isForResultScreen);
}
processSummaryLine.prepareForFrontend(isForResultScreen);
}
return (processSummary);

View File

@ -91,7 +91,7 @@ public class StreamedETLExecuteStep extends BaseStreamedETLStep implements Backe
////////////////////////////////////////////////////////////////////////////////////////////////////
// get the process summary from the ... transform step? the load step? each knows some... todo? //
////////////////////////////////////////////////////////////////////////////////////////////////////
runBackendStepOutput.addValue(StreamedETLWithFrontendProcess.FIELD_PROCESS_SUMMARY, transformStep.doGetProcessSummary(true));
runBackendStepOutput.addValue(StreamedETLWithFrontendProcess.FIELD_PROCESS_SUMMARY, transformStep.doGetProcessSummary(runBackendStepOutput, true));
transformStep.postRun(runBackendStepInput, runBackendStepOutput);
loadStep.postRun(runBackendStepInput, runBackendStepOutput);

View File

@ -105,7 +105,7 @@ public class StreamedETLValidateStep extends BaseStreamedETLStep implements Back
//////////////////////////////////////////////////////
// get the process summary from the validation step //
//////////////////////////////////////////////////////
runBackendStepOutput.addValue(StreamedETLWithFrontendProcess.FIELD_VALIDATION_SUMMARY, transformStep.doGetProcessSummary(false));
runBackendStepOutput.addValue(StreamedETLWithFrontendProcess.FIELD_VALIDATION_SUMMARY, transformStep.doGetProcessSummary(runBackendStepOutput, false));
transformStep.postRun(runBackendStepInput, runBackendStepOutput);
}

View File

@ -32,6 +32,7 @@ import com.kingsrook.qqq.backend.core.actions.processes.QProcessCallback;
import com.kingsrook.qqq.backend.core.actions.processes.RunProcessAction;
import com.kingsrook.qqq.backend.core.exceptions.QException;
import com.kingsrook.qqq.backend.core.model.actions.processes.ProcessSummaryLine;
import com.kingsrook.qqq.backend.core.model.actions.processes.ProcessSummaryLineInterface;
import com.kingsrook.qqq.backend.core.model.actions.processes.RunBackendStepInput;
import com.kingsrook.qqq.backend.core.model.actions.processes.RunBackendStepOutput;
import com.kingsrook.qqq.backend.core.model.actions.processes.RunProcessInput;
@ -359,7 +360,7 @@ public class StreamedETLWithFrontendProcessTest
@Override
public ArrayList<ProcessSummaryLine> getProcessSummary(boolean isForResultScreen)
public ArrayList<ProcessSummaryLineInterface> getProcessSummary(RunBackendStepOutput runBackendStepOutput, boolean isForResultScreen)
{
return null;
}
@ -381,14 +382,14 @@ public class StreamedETLWithFrontendProcessTest
**
*******************************************************************************/
@Override
public ArrayList<ProcessSummaryLine> getProcessSummary(boolean isForResultScreen)
public ArrayList<ProcessSummaryLineInterface> getProcessSummary(RunBackendStepOutput runBackendStepOutput, boolean isForResultScreen)
{
if(isForResultScreen)
{
okSummary.setMessage("were transformed into a Person");
}
ArrayList<ProcessSummaryLine> summaryList = new ArrayList<>();
ArrayList<ProcessSummaryLineInterface> summaryList = new ArrayList<>();
summaryList.add(okSummary);
summaryList.add(notAPolygonSummary);
return (summaryList);
@ -449,7 +450,7 @@ public class StreamedETLWithFrontendProcessTest
@Override
public ArrayList<ProcessSummaryLine> getProcessSummary(boolean isForResultScreen)
public ArrayList<ProcessSummaryLineInterface> getProcessSummary(RunBackendStepOutput runBackendStepOutput, boolean isForResultScreen)
{
return null;
}