Skip to content

Flow Elements and Rules in Elements #22

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 5 commits into from
Nov 16, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
61 changes: 61 additions & 0 deletions force-app/main/default/classes/Flow/flowUtility.cls
Original file line number Diff line number Diff line change
@@ -0,0 +1,61 @@
public class flowUtility {
//extracting the Flow ID and storing it in Utility variable flowId
public static void analyzeFlowStart(String line) {
List<String> splitArr = line.split('\\|');
utilityVariables.flowId = splitArr[splitArr.size() - 2];
}

//pushing the method to Stack i.e each flow under a particular object
public static void analyzeFlowName(String line) {
MethodSchema methodUnit = new MethodSchema();
List<String> splitArr = line.split('\\|');
methodUnit.methodName = splitArr[splitArr.size() - 1];
methodUnit.ruleId = utilityVariables.flowId;
addMethodtoStack(methodUnit);
}

public static void addElement(String line) {
List<String> splitArr = line.split('\\|');
LogLineSchema logLine = new LogLineSchema();
logLine.type = 'FLOEL';
logLine.isFlowElement = true;
logLine.ruleName = splitArr[splitArr.size() -1] +' ' +splitArr[splitArr.size() - 2];
pushVal(logLine);
}
public static void removeElement() {

}
public static void addvalue(String line) {
List<String> splitArr = line.split('\\|');
LogLineSchema logLine = new LogLineSchema();
logLine.type = 'FLORL';
logLine.isFlowElement = true;
logLine.ruleName = splitArr[splitArr.size() - 2] +' ' +splitArr[splitArr.size() - 1];
pushVal(logLine);
}
public static void popMethodUnit(){
if (!utilityVariables.methodUnitsStack.isEmpty()) {
utilityVariables.methodUnitsStack.pop();
}
}
//adding the existing flow to method stack and codeunit
private static void addMethodtoStack(MethodSchema methodUnit) {
if (!utilityVariables.codeUnitsStack.isEmpty()) {
CodeUnitContainerSchema currentCodeUnit = (CodeUnitContainerSchema) utilityVariables.codeUnitsStack.peek();
ExecutedLineAndSubUnitSchema elss = new ExecutedLineAndSubUnitSchema();
elss.methodUnit = methodUnit;
currentCodeUnit.executedLinesAndSubUnits.add(elss);
utilityVariables.methodUnitsStack.push(methodUnit);
}
}

private static void pushVal(LogLineSchema log) {
if (!utilityVariables.methodUnitsStack.isEmpty()) {
MethodSchema currentMethodUnit = (MethodSchema) utilityVariables.methodUnitsStack.peek();
ExecutedLineAndSubUnitSchema elss = new ExecutedLineAndSubUnitSchema();
elss.logLine = log;
currentMethodUnit.executedLinesAndSubUnits.add(elss);
utilityVariables.currentLog = log;
}
}
}
5 changes: 5 additions & 0 deletions force-app/main/default/classes/Flow/flowUtility.cls-meta.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
<?xml version="1.0" encoding="UTF-8"?>
<ApexClass xmlns="http://soap.sforce.com/2006/04/metadata">
<apiVersion>62.0</apiVersion>
<status>Active</status>
</ApexClass>
Original file line number Diff line number Diff line change
Expand Up @@ -34,4 +34,9 @@ public class LogLineSchema {
//Added for Validation Pass or fail
@AuraEnabled
public Boolean isValidRulePass;
//Added for Flow ruleName is both for element and rule
@AuraEnabled
public String ruleName;
@AuraEnabled
public Boolean isFlowElement;
}
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ public class MethodSchema {
//Total name of the method invoked with class and namespaces
@AuraEnabled
public String methodTitle;
//18-digit Id of validation rule
//18-digit Id of validation rule also Id for flow
@AuraEnabled
public String ruleId;
//Id of the class from which method Invoked
Expand Down
38 changes: 38 additions & 0 deletions force-app/main/default/classes/UtilityMethods.cls
Original file line number Diff line number Diff line change
Expand Up @@ -260,6 +260,44 @@ public class UtilityMethods {
SoqlUtility.processSoqlExit(line);
break;
}
else if (utilityVariables.currentLineEvent == 'FLOW_CREATE_INTERVIEW_BEGIN') {
flowUtility.analyzeFlowStart(line);
break;
}
else if (utilityVariables.currentLineEvent == 'FLOW_CREATE_INTERVIEW_END') {
flowUtility.analyzeFlowName(line);
break;
}
else if (utilityVariables.currentLineEvent == 'FLOW_ELEMENT_BEGIN') {
flowUtility.addElement(line);
break;
}
else if (utilityVariables.currentLineEvent == 'FLOW_ELEMENT_END') {
flowUtility.removeElement();
break;
}
else if (utilityVariables.currentLineEvent == 'FLOW_BULK_ELEMENT_BEGIN') {
/*
* 1. Use same methods as FLOW_ELEMENT_BEGIN
*/
flowUtility.addElement(line);
break;
}
else if (utilityVariables.currentLineEvent == 'FLOW_BULK_ELEMENT_END') {
/*
* 1. Use same methods as FLOW_ELEMENT_END
*/
flowUtility.removeElement();
break;
}
else if (utilityVariables.currentLineEvent == 'FLOW_VALUE_ASSIGNMENT') {
flowUtility.addvalue(line);
break;
}
else if (utilityVariables.currentLineEvent == 'FLOW_START_INTERVIEWS_END') {
flowUtility.popMethodUnit();
break;
}
}
}
} else {
Expand Down
41 changes: 38 additions & 3 deletions force-app/main/default/classes/utilityVariables.cls
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,8 @@ public class utilityVariables {
//String to Store the previous line event
public static String previousLineEvent = null;

public static String flowId = null;

//Track the currentHolding logLine
public static LogLineSchema currentLog = null;

Expand Down Expand Up @@ -61,7 +63,8 @@ public class utilityVariables {
'^[0-9:.]+\\s\\([0-9]+\\)\\|(CODE_UNIT_STARTED\\|)[(0-9)(\\[EXTERNAL\\])]+(\\|TRIGGERS)' => 'Trigger-Simple',
'^[0-9:.]+\\s\\([0-9]+\\)\\|(CODE_UNIT_STARTED\\|)[(0-9)(\\[EXTERNAL\\])]+(\\|)\\w+(\\|)[\\w.]+\\s(on)\\s(\\w)+\\s(trigger\\sevent\\s)\\w+(\\|__sfdc_trigger\\/)[\\w\\/]+' => 'Trigger-Detailed',
'^[0-9:.]+\\s\\([0-9]+\\)\\|(CODE_UNIT_STARTED\\|)[(0-9)(\\[EXTERNAL\\])]+(\\|)\\w+;\\w+;\\w+(\\|)[\\w\\.]+' => 'Trigger-Event',
'^[0-9:.]+\\s\\([0-9]+\\)\\|(CODE_UNIT_STARTED\\|)[(\\[EXTERNAL\\])(0-9)]+(\\|Validation)\\:[\\w]+\\:[\\w\\d]+' => 'Validation-Generic'
'^[0-9:.]+\\s\\([0-9]+\\)\\|(CODE_UNIT_STARTED\\|)[(\\[EXTERNAL\\])(0-9)]+(\\|Validation)\\:[\\w]+\\:[\\w\\d]+' => 'Validation-Generic',
'^[0-9:.\\s\\(\\)]+(\\|)(CODE_UNIT_STARTED)(\\|)(\\[EXTERNAL\\])(\\|)Flow:[a-zA-Z_]+' => 'Flow-Generic'
},
'STATEMENT_EXECUTE' => new Map<String, String>{
'^[0-9:.]+\\s\\([0-9]+\\)\\|(STATEMENT_EXECUTE\\|)\\[[0-9]+\\]' => 'Statement-Execute'
Expand Down Expand Up @@ -116,8 +119,32 @@ public class utilityVariables {
'SOQL_EXECUTE_BEGIN' => new Map<String, String>{
'^[0-9:.]+\\s\\([0-9]+\\)\\|(SOQL_EXECUTE_BEGIN\\|)\\[[0-9]+\\]+(\\|).+' => 'SOQL-Begin'
},
'SOQL_EXECUTE_END' => new Map<String, String>{
'^[0-9:.]+\\s\\([0-9]+\\)\\|(SOQL_EXECUTE_END\\|)\\[[0-9]+\\]+(\\|).+' => 'SOQL-End'
'SOQL_EXECUTE_END'=>new Map<String,String>{
'^[0-9:.]+\\s\\([0-9]+\\)\\|(SOQL_EXECUTE_END\\|)\\[[0-9]+\\]+(\\|).*' => 'SOQL-End'
},
'FLOW_CREATE_INTERVIEW_BEGIN'=>new Map<String,String>{
'^[0-9:.\\s\\(\\)]+(\\|)(FLOW_CREATE_INTERVIEW_BEGIN)(\\|)([0-9a-zA-Z])+(\\|)([0-9a-zA-Z])+(\\|)([0-9a-zA-Z])+' => 'Flow-Generic-Start'
},
'FLOW_CREATE_INTERVIEW_END'=>new Map<String,String>{
'^[0-9:.\\s\\(\\)]+(\\|)FLOW_CREATE_INTERVIEW_END(\\|)[a-z0-9\\-]+(\\|)[a-zA-Z\\s_]+' => 'Flow-Generic-End'
},
'FLOW_ELEMENT_BEGIN'=>new Map<String,String>{
'^[0-9:.\\s\\(\\)]+(\\|)(FLOW_ELEMENT_BEGIN)(\\|)[0-9a-z\\-]+(\\|)[a-zA-Z]+(\\|)[a-zA-Z_]+' => 'Flow-Element-Begin-Generic'
},
'FLOW_ELEMENT_END'=>new Map<String,String>{
'^[0-9:.\\s\\(\\)]+(\\|)(FLOW_ELEMENT_END)(\\|)[0-9a-z\\-]+(\\|)[a-zA-Z]+(\\|)[a-zA-Z_]+' => 'Flow-Element-End-Generic'
},
'FLOW_BULK_ELEMENT_BEGIN'=>new Map<String,String>{
'[0-9:.\\s\\(\\)]+(\\|)(FLOW_BULK_ELEMENT_BEGIN)(\\|)[a-zA-Z]+(\\|)[a-zA-Z_]+' => 'Flow-Bulk-Element-Begin-Generic'
},
'FLOW_BULK_ELEMENT_END'=>new Map<String,String>{
'^[0-9:.\\s\\(\\)]+(\\|)(FLOW_BULK_ELEMENT_END)(\\|)[a-zA-Z]+(\\|)[a-zA-Z_]+(\\|)[0,1](\\|)[0,1]' => 'Flow-Bullk-Element-End-Generic'
},
'FLOW_VALUE_ASSIGNMENT'=>new Map<String,String>{
'^[0-9:.\\s\\(\\)]+(\\|)(FLOW_VALUE_ASSIGNMENT)(\\|)[0-9a-z\\-]+(\\|)[A-Za-z_]+(\\|)[a-z]+' => 'Flow-Value-Assignment'
},
'FLOW_START_INTERVIEWS_END'=>new Map<String,String>{
'^[0-9:.\\s\\(\\)]+(\\|)FLOW_START_INTERVIEWS_END(\\|)[0-1]' => 'Flow-Start-Interviews-End'
}
};

Expand Down Expand Up @@ -207,6 +234,14 @@ public class utilityVariables {
String name = 'Validation on ';
name += splitArr[splitArr.size() - 2];
codeUnitDetails.codeUnitName = name;
} else if (pattern == 'Flow-Generic') {
enteredCondtion = true;
codeUnitDetails.codeUnitType = 'Flow';
codeUnitDetails.isTrigger = false;
List<String> splitArr = line.split(':');
String name = 'Flow on ';
name += splitArr[splitArr.size() - 1];
codeUnitDetails.codeUnitName = name;
}
if (!enteredCondtion) {
/**
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
lightning-card{
--slds-c-card-header-spacing-block-end:0px;
--slds-c-card-header-spacing-block-start:0px;
}
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
<!-- sldsValidatorIgnore -->
<template>
<lightning-card style="--slds-c-card-header-spacing-block-end:0px;--slds-c-card-header-spacing-block-start:0px;">
<lightning-card>
<div class={sectionClass}>
<h3 class="slds-section__title">
<button
Expand Down
2 changes: 1 addition & 1 deletion force-app/main/default/lwc/fileUploader/fileUploader.html
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
<p class="brand"><lightning-icon icon-name='utility:bug' alternative-text='bug' size='small' title='bug' class="bugicon"></lightning-icon>DEBUG FORCE</p>
<b>Home</b>
<b>Latest Updates</b>
<b style="float:right" onclick={resetApp}>Reset App</b>
<b onclick={resetApp}>Analyze Log</b>
</div>
<lightning-card variant="base" title="Upload File" if:false={responseState}>
<template lwc:if={renderUploader}>
Expand Down
7 changes: 6 additions & 1 deletion force-app/main/default/lwc/logLineWrapper/logLineWrapper.css
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,12 @@
.soqe {
color: rgb(73, 208, 63);
}

.florl {
color: rgb(216, 76, 198);
}
.floel {
color: rgb(158, 47, 166);
}
.debug {
color: rgb(248, 197, 85);
}
Expand Down
10 changes: 10 additions & 0 deletions force-app/main/default/lwc/logLineWrapper/logLineWrapper.html
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,16 @@
</td>
<!-- Line Content -->

<!-- Flow Elements and Rules -->
<template lwc:if={line.logLineData.isFlowElement}>
<td class="slds-text-body_small slds-cell-wrap line-content">
<div class="slds-line-clamp" title={line.logLineData.varValue}>
<span class="slds-text-font_monospace">
{line.logLineData.ruleName}</span
>
</div>
</td>
</template>
<!-- VARAS -->
<template lwc:if={line.logLineData.varValue}>
<td class="slds-text-body_small slds-cell-wrap line-content">
Expand Down
10 changes: 10 additions & 0 deletions force-app/main/default/lwc/logLineWrapper/logLineWrapper.js
Original file line number Diff line number Diff line change
Expand Up @@ -118,6 +118,16 @@ export default class LogLineWrapper extends LightningElement {
logTemp.eventClassComb = "slds-line-clamp soqe";
//console.log("No.of Rows: ", JSON.stringify(logTemp.logLineData));
}
//<!-- FLORL -->
else if (logTemp.logLineData.type === "FLORL") {
logTemp.eventClassComb = "slds-line-clamp florl";
console.log("No.of Rows: ", JSON.stringify(logTemp.logLineData));
}
//<!-- FLOEL -->
else if (logTemp.logLineData.type === "FLOEL") {
logTemp.eventClassComb = "slds-line-clamp floel";
console.log("No.of Rows: ", JSON.stringify(logTemp.logLineData));
}
log = logTemp;
} else if (log.type === "unit") {
log.isLine = false;
Expand Down
Loading