inhertiance

This commit is contained in:
2026-06-17 21:22:03 +02:00
parent 566a814671
commit 0c9e8de310
20 changed files with 324 additions and 8016 deletions

View File

@@ -1,374 +0,0 @@
{
"metadata" : {
"triggers" : [ {
"event" : "FINISH",
"className" : "click.kamil.examples.statemachine.extended.web.OrderController",
"methodName" : "finishOrder",
"sourceModule" : null,
"stateMachineId" : null,
"lineNumber" : 34
}, {
"event" : "AUDIT_EVENT",
"className" : "click.kamil.examples.statemachine.extended.web.AuditInterceptor",
"methodName" : "preHandle",
"sourceModule" : null,
"stateMachineId" : null,
"lineNumber" : 16
}, {
"event" : "EXTERNAL_TRIGGER",
"className" : "click.kamil.examples.statemachine.extended.service.OrderService",
"methodName" : "processSubmit",
"sourceModule" : null,
"stateMachineId" : null,
"lineNumber" : 19
}, {
"event" : "SUBMIT_EVENT",
"className" : "click.kamil.examples.statemachine.extended.service.OrderService",
"methodName" : "processSubmit",
"sourceModule" : null,
"stateMachineId" : null,
"lineNumber" : 20
}, {
"event" : "CANCEL_EVENT",
"className" : "click.kamil.examples.statemachine.extended.service.OrderService",
"methodName" : "processCancel",
"sourceModule" : null,
"stateMachineId" : null,
"lineNumber" : 25
}, {
"event" : "[LIFECYCLE:RESTORE]",
"className" : "click.kamil.examples.statemachine.extended.service.OrderService",
"methodName" : "resumeOrder",
"sourceModule" : null,
"stateMachineId" : null,
"lineNumber" : 29
}, {
"event" : "REACTIVE_EVENT",
"className" : "click.kamil.examples.statemachine.extended.service.ReactiveOrderService",
"methodName" : "processReactive",
"sourceModule" : null,
"stateMachineId" : null,
"lineNumber" : 18
} ],
"entryPoints" : [ {
"type" : "REST",
"name" : "POST /api/orders/submit",
"className" : "click.kamil.examples.statemachine.extended.web.OrderController",
"methodName" : "submitOrder",
"metadata" : {
"path" : "/api/orders/submit",
"verb" : "POST"
},
"parameters" : [ ]
}, {
"type" : "REST",
"name" : "POST /api/orders/cancel",
"className" : "click.kamil.examples.statemachine.extended.web.OrderController",
"methodName" : "cancelOrder",
"metadata" : {
"path" : "/api/orders/cancel",
"verb" : "POST"
},
"parameters" : [ ]
}, {
"type" : "REST",
"name" : "POST /api/orders/finish",
"className" : "click.kamil.examples.statemachine.extended.web.OrderController",
"methodName" : "finishOrder",
"metadata" : {
"path" : "/api/orders/finish",
"verb" : "POST"
},
"parameters" : [ ]
}, {
"type" : "REST",
"name" : "POST /api/orders/resume",
"className" : "click.kamil.examples.statemachine.extended.web.OrderController",
"methodName" : "resumeOrder",
"metadata" : {
"path" : "/api/orders/resume",
"verb" : "POST"
},
"parameters" : [ {
"name" : "orderId",
"type" : "String",
"annotations" : [ ]
} ]
}, {
"type" : "REST",
"name" : "POST /api/orders/reactive",
"className" : "click.kamil.examples.statemachine.extended.web.OrderController",
"methodName" : "reactiveOrder",
"metadata" : {
"path" : "/api/orders/reactive",
"verb" : "POST"
},
"parameters" : [ {
"name" : "orderId",
"type" : "String",
"annotations" : [ ]
} ]
}, {
"type" : "CUSTOM",
"name" : "INTERCEPTOR: AuditInterceptor.preHandle",
"className" : "click.kamil.examples.statemachine.extended.web.AuditInterceptor",
"methodName" : "preHandle",
"metadata" : {
"interceptorType" : "Spring MVC Interceptor"
},
"parameters" : [ ]
} ],
"callChains" : [ {
"entryPoint" : {
"type" : "REST",
"name" : "POST /api/orders/submit",
"className" : "click.kamil.examples.statemachine.extended.web.OrderController",
"methodName" : "submitOrder",
"metadata" : {
"path" : "/api/orders/submit",
"verb" : "POST"
},
"parameters" : [ ]
},
"methodChain" : [ "click.kamil.examples.statemachine.extended.web.OrderController.submitOrder", "click.kamil.examples.statemachine.extended.service.OrderService.processSubmit" ],
"triggerPoint" : {
"event" : "EXTERNAL_TRIGGER",
"className" : "click.kamil.examples.statemachine.extended.service.OrderService",
"methodName" : "processSubmit",
"sourceModule" : null,
"stateMachineId" : null,
"lineNumber" : 19
}
}, {
"entryPoint" : {
"type" : "REST",
"name" : "POST /api/orders/submit",
"className" : "click.kamil.examples.statemachine.extended.web.OrderController",
"methodName" : "submitOrder",
"metadata" : {
"path" : "/api/orders/submit",
"verb" : "POST"
},
"parameters" : [ ]
},
"methodChain" : [ "click.kamil.examples.statemachine.extended.web.OrderController.submitOrder", "click.kamil.examples.statemachine.extended.service.OrderService.processSubmit" ],
"triggerPoint" : {
"event" : "SUBMIT_EVENT",
"className" : "click.kamil.examples.statemachine.extended.service.OrderService",
"methodName" : "processSubmit",
"sourceModule" : null,
"stateMachineId" : null,
"lineNumber" : 20
}
}, {
"entryPoint" : {
"type" : "REST",
"name" : "POST /api/orders/cancel",
"className" : "click.kamil.examples.statemachine.extended.web.OrderController",
"methodName" : "cancelOrder",
"metadata" : {
"path" : "/api/orders/cancel",
"verb" : "POST"
},
"parameters" : [ ]
},
"methodChain" : [ "click.kamil.examples.statemachine.extended.web.OrderController.cancelOrder", "click.kamil.examples.statemachine.extended.service.OrderService.processCancel" ],
"triggerPoint" : {
"event" : "CANCEL_EVENT",
"className" : "click.kamil.examples.statemachine.extended.service.OrderService",
"methodName" : "processCancel",
"sourceModule" : null,
"stateMachineId" : null,
"lineNumber" : 25
}
}, {
"entryPoint" : {
"type" : "REST",
"name" : "POST /api/orders/finish",
"className" : "click.kamil.examples.statemachine.extended.web.OrderController",
"methodName" : "finishOrder",
"metadata" : {
"path" : "/api/orders/finish",
"verb" : "POST"
},
"parameters" : [ ]
},
"methodChain" : [ "click.kamil.examples.statemachine.extended.web.OrderController.finishOrder" ],
"triggerPoint" : {
"event" : "FINISH",
"className" : "click.kamil.examples.statemachine.extended.web.OrderController",
"methodName" : "finishOrder",
"sourceModule" : null,
"stateMachineId" : null,
"lineNumber" : 34
}
}, {
"entryPoint" : {
"type" : "REST",
"name" : "POST /api/orders/resume",
"className" : "click.kamil.examples.statemachine.extended.web.OrderController",
"methodName" : "resumeOrder",
"metadata" : {
"path" : "/api/orders/resume",
"verb" : "POST"
},
"parameters" : [ {
"name" : "orderId",
"type" : "String",
"annotations" : [ ]
} ]
},
"methodChain" : [ "click.kamil.examples.statemachine.extended.web.OrderController.resumeOrder", "click.kamil.examples.statemachine.extended.service.OrderService.resumeOrder" ],
"triggerPoint" : {
"event" : "[LIFECYCLE:RESTORE]",
"className" : "click.kamil.examples.statemachine.extended.service.OrderService",
"methodName" : "resumeOrder",
"sourceModule" : null,
"stateMachineId" : null,
"lineNumber" : 29
}
}, {
"entryPoint" : {
"type" : "REST",
"name" : "POST /api/orders/reactive",
"className" : "click.kamil.examples.statemachine.extended.web.OrderController",
"methodName" : "reactiveOrder",
"metadata" : {
"path" : "/api/orders/reactive",
"verb" : "POST"
},
"parameters" : [ {
"name" : "orderId",
"type" : "String",
"annotations" : [ ]
} ]
},
"methodChain" : [ "click.kamil.examples.statemachine.extended.web.OrderController.reactiveOrder", "click.kamil.examples.statemachine.extended.service.ReactiveOrderService.processReactive" ],
"triggerPoint" : {
"event" : "REACTIVE_EVENT",
"className" : "click.kamil.examples.statemachine.extended.service.ReactiveOrderService",
"methodName" : "processReactive",
"sourceModule" : null,
"stateMachineId" : null,
"lineNumber" : 18
}
}, {
"entryPoint" : {
"type" : "CUSTOM",
"name" : "INTERCEPTOR: AuditInterceptor.preHandle",
"className" : "click.kamil.examples.statemachine.extended.web.AuditInterceptor",
"methodName" : "preHandle",
"metadata" : {
"interceptorType" : "Spring MVC Interceptor"
},
"parameters" : [ ]
},
"methodChain" : [ "click.kamil.examples.statemachine.extended.web.AuditInterceptor.preHandle" ],
"triggerPoint" : {
"event" : "AUDIT_EVENT",
"className" : "click.kamil.examples.statemachine.extended.web.AuditInterceptor",
"methodName" : "preHandle",
"sourceModule" : null,
"stateMachineId" : null,
"lineNumber" : 16
}
} ],
"properties" : {
"default" : {
"app.states.initial" : "INIT_STATE"
},
"prod" : {
"app.states.initial" : "PROD_INITIAL"
}
}
},
"name" : "click.kamil.examples.statemachine.extended.config.ExtendedStateMachineConfig",
"renderChoicesAsDiamonds" : true,
"startStates" : [ "${app.states.initial:START}" ],
"transitions" : [ {
"type" : "EXTERNAL",
"sourceStates" : [ {
"rawName" : "\"START\"",
"fullIdentifier" : "START"
} ],
"targetStates" : [ {
"rawName" : "\"PROCESSING\"",
"fullIdentifier" : "PROCESSING"
} ],
"event" : "SUBMIT_EVENT",
"guard" : null,
"actions" : [ ],
"order" : null
}, {
"type" : "EXTERNAL",
"sourceStates" : [ {
"rawName" : "\"PROCESSING\"",
"fullIdentifier" : "PROCESSING"
} ],
"targetStates" : [ {
"rawName" : "\"COMPLETED\"",
"fullIdentifier" : "COMPLETED"
} ],
"event" : "FINISH",
"guard" : null,
"actions" : [ ],
"order" : null
}, {
"type" : "EXTERNAL",
"sourceStates" : [ {
"rawName" : "\"PROCESSING\"",
"fullIdentifier" : "PROCESSING"
} ],
"targetStates" : [ {
"rawName" : "\"CANCELLED\"",
"fullIdentifier" : "CANCELLED"
} ],
"event" : "CANCEL_EVENT",
"guard" : null,
"actions" : [ ],
"order" : null
}, {
"type" : "EXTERNAL",
"sourceStates" : [ {
"rawName" : "\"START\"",
"fullIdentifier" : "START"
} ],
"targetStates" : [ {
"rawName" : "\"PROCESSING\"",
"fullIdentifier" : "PROCESSING"
} ],
"event" : "REACTIVE_EVENT",
"guard" : null,
"actions" : [ ],
"order" : null
}, {
"type" : "EXTERNAL",
"sourceStates" : [ {
"rawName" : "\"START\"",
"fullIdentifier" : "START"
} ],
"targetStates" : [ {
"rawName" : "\"START\"",
"fullIdentifier" : "START"
} ],
"event" : "AUDIT_EVENT",
"guard" : null,
"actions" : [ ],
"order" : null
}, {
"type" : "EXTERNAL",
"sourceStates" : [ {
"rawName" : "\"START\"",
"fullIdentifier" : "START"
} ],
"targetStates" : [ {
"rawName" : "\"PROCESSING\"",
"fullIdentifier" : "PROCESSING"
} ],
"event" : "EXTERNAL_TRIGGER",
"guard" : null,
"actions" : [ ],
"order" : null
} ],
"endStates" : [ "CANCELLED", "COMPLETED" ]
}

View File

@@ -1,770 +0,0 @@
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>State Machine Explorer - click.kamil.maven.core.MavenOrderStateMachine</title>
<!-- Popper and Tippy for tooltips -->
<script src="https://unpkg.com/@popperjs/core@2"></script>
<script src="https://unpkg.com/tippy.js@6"></script>
<link rel="stylesheet" href="https://unpkg.com/tippy.js@6/animations/scale.css"/>
<!-- SVG Pan & Zoom -->
<script src="https://cdn.jsdelivr.net/npm/svg-pan-zoom@3.6.1/dist/svg-pan-zoom.min.js"></script>
<!-- Google Fonts -->
<link rel="preconnect" href="https://fonts.googleapis.com">
<link rel="preconnect" href="https://fonts.gstatic.com" crossorigin>
<link href="https://fonts.googleapis.com/css2?family=Inter:wght@400;600;900&family=JetBrains+Mono:wght@400;700&display=swap" rel="stylesheet">
<style>
:root {
--sidebar-bg: #ffffff;
--main-bg: #f8fafc;
--accent: #ef4444;
--primary: #3b82f6;
--text: #0f172a;
--text-muted: #64748b;
--border: #e2e8f0;
}
body {
margin: 0;
display: flex;
height: 100vh;
font-family: 'Inter', -apple-system, sans-serif;
background: var(--main-bg);
color: var(--text);
overflow: hidden;
}
#sidebar {
width: 480px;
min-width: 350px;
max-width: 900px;
background: var(--sidebar-bg);
border-right: 2px solid var(--border);
display: flex;
flex-direction: column;
box-shadow: 10px 0 15px rgba(0,0,0,0.02);
z-index: 10;
overflow-x: hidden;
resize: horizontal;
position: relative;
transition: width 0.3s ease, min-width 0.3s ease, padding 0.3s ease;
}
#sidebar.collapsed {
width: 0 !important;
min-width: 0 !important;
border-right: none;
padding: 0;
overflow: hidden;
resize: none;
}
#toggle-sidebar {
position: absolute;
top: 20px;
left: 20px;
z-index: 50;
background: #fff;
border: 1px solid var(--border);
border-radius: 8px;
padding: 8px;
cursor: pointer;
box-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.1);
display: flex;
align-items: center;
justify-content: center;
transition: all 0.2s ease;
}
#toggle-sidebar:hover {
background: #f8fafc;
border-color: var(--primary);
}
#toggle-sidebar svg {
width: 20px;
height: 20px;
fill: none;
stroke: var(--text-muted);
stroke-width: 2;
stroke-linecap: round;
stroke-linejoin: round;
}
#sidebar::after {
content: '⋮';
position: absolute;
right: 2px; top: 50%;
transform: translateY(-50%);
color: var(--border);
font-size: 1.2rem;
pointer-events: none;
}
.sidebar-header {
padding: 30px 30px 10px;
}
header h1 { font-weight: 900; font-size: 1.6rem; color: var(--text); margin: 0 0 5px 0; letter-spacing: -0.5px; }
header p { font-family: 'JetBrains Mono', monospace; font-size: 0.7rem; color: var(--text-muted); margin: 0 0 15px 0; opacity: 0.7; }
.tabs {
display: flex;
padding: 0 30px;
border-bottom: 1px solid var(--border);
gap: 20px;
}
.tab {
padding: 10px 0;
font-size: 0.85rem;
font-weight: 600;
color: var(--text-muted);
cursor: pointer;
position: relative;
transition: color 0.2s;
}
.tab:hover { color: var(--text); }
.tab.active { color: var(--primary); }
.tab.active::after {
content: '';
position: absolute;
bottom: -1px; left: 0; right: 0;
height: 2px;
background: var(--primary);
}
.tab-content {
flex-grow: 1;
padding: 25px 30px;
overflow-y: auto;
display: none;
}
.tab-content.active { display: block; }
.ep-card, .flow-card {
padding: 18px;
background: #fff;
border: 1px solid var(--border);
border-radius: 14px;
margin-bottom: 15px;
cursor: pointer;
transition: all 0.25s cubic-bezier(0.4, 0, 0.2, 1);
box-shadow: 0 1px 3px rgba(0,0,0,0.04);
position: relative;
word-break: break-all;
overflow-wrap: anywhere;
}
.ep-card:hover, .flow-card:hover {
border-color: var(--primary);
transform: translateX(5px);
box-shadow: 0 15px 30px -10px rgba(59, 130, 246, 0.15);
}
.ep-type {
font-size: 0.6rem;
font-weight: 900;
padding: 3px 8px;
border-radius: 6px;
display: inline-block;
margin-bottom: 10px;
text-transform: uppercase;
letter-spacing: 0.8px;
}
.type-rest { background: #eff6ff; color: #1d4ed8; }
.type-custom { background: #fef2f2; color: #b91c1c; }
.type-jms { background: #f5f3ff; color: #7c3aed; }
.type-sqs { background: #fff7ed; color: #ea580c; }
.type-sns { background: #fff1f2; color: #e11d48; }
.type-kafka { background: #fefce8; color: #854d0e; }
.type-rabbit { background: #f0fdf4; color: #166534; }
.ep-name, .flow-name { font-weight: 700; font-size: 0.95rem; margin-bottom: 6px; color: var(--text); }
.ep-fqn, .flow-desc { font-family: 'Inter', sans-serif; font-size: 0.75rem; color: var(--text-muted); opacity: 0.9; line-height: 1.4; }
#main { flex-grow: 1; position: relative; background: var(--main-bg); overflow: hidden; }
#svg-container {
position: absolute;
top: 0; left: 0; right: 0; bottom: 0;
display: flex;
align-items: center;
justify-content: center;
}
svg {
width: 100%;
height: 100%;
display: block;
}
/* SVG Interactivity Styles */
svg a { text-decoration: none !important; }
.active-path {
stroke: var(--accent) !important;
stroke-width: 2.5px !important;
filter: drop-shadow(0 0 8px rgba(239, 68, 68, 0.3));
transition: all 0.3s;
}
.active-path text, a.active-path text {
fill: #000 !important;
font-weight: 900 !important;
paint-order: stroke;
stroke: #fff;
stroke-width: 3.5px;
}
.dimmed {
opacity: 0.2 !important;
filter: grayscale(1);
transition: opacity 0.4s ease;
pointer-events: none;
}
/* Tippy Styling */
.tippy-box[data-theme~='modern'] {
background-color: #fff;
color: var(--text);
box-shadow: 0 25px 50px -12px rgba(0,0,0,0.25);
border: 1px solid var(--border);
border-radius: 16px;
padding: 0;
max-width: 550px !important;
}
.tooltip-content {
padding: 20px;
max-width: 500px;
word-break: break-word;
overflow-wrap: anywhere;
}
.payload-box {
background: #0f172a;
color: #e2e8f0;
border-radius: 8px;
padding: 12px;
font-family: 'JetBrains Mono', monospace;
font-size: 0.75rem;
line-height: 1.5;
margin-top: 10px;
}
.payload-param {
margin-bottom: 4px;
}
.payload-param:last-child { margin-bottom: 0; }
</style>
</head>
<body>
<div id="sidebar">
<div class="sidebar-header">
<header>
<h1>Explorer</h1>
<p>click.kamil.maven.core.MavenOrderStateMachine</p>
</header>
</div>
<div class="tabs">
<div class="tab active" data-tab="explorer">Explorer</div>
<div class="tab" data-tab="flows">Business Flows</div>
</div>
<div id="tab-explorer" class="tab-content active">
<div id="ep-list"></div>
</div>
<div id="tab-flows" class="tab-content">
<div id="flow-list"></div>
</div>
</div>
<div id="main">
<button id="toggle-sidebar" aria-label="Toggle Sidebar" title="Toggle Sidebar">
<svg viewBox="0 0 24 24"><path d="M4 6h16M4 12h16M4 18h16"></path></svg>
</button>
<div id="svg-container">
<?xml version="1.0" encoding="us-ascii" standalone="no"?><svg xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" contentStyleType="text/css" height="100%" preserveAspectRatio="xMidYMid meet" version="1.1" viewBox="0 0 159 405" width="100%" zoomAndPan="magnify"><defs/><g><ellipse cx="35.5208" cy="25.2083" fill="#222222" rx="11.4583" ry="11.4583" style="stroke:#222222;stroke-width:1.1458333333333333;"/><rect fill="#FFFFFF" height="45.8333" rx="14.3229" ry="14.3229" style="stroke:#94A3B8;stroke-width:1.1458333333333333;" width="57.2917" x="6.875" y="83.6458"/><text fill="#000000" font-family="Inter" font-size="10.3125" font-weight="bold" lengthAdjust="spacing" textLength="21.7708" x="24.6354" y="110.4599">INIT</text><rect fill="#FFFFFF" height="45.8333" rx="14.3229" ry="14.3229" style="stroke:#94A3B8;stroke-width:1.1458333333333333;" width="57.2917" x="6.875" y="184.4792"/><text fill="#000000" font-family="Inter" font-size="10.3125" font-weight="bold" lengthAdjust="spacing" textLength="27.5" x="21.7708" y="211.2932">BUSY</text><rect fill="#FFFFFF" height="45.8333" rx="14.3229" ry="14.3229" style="stroke:#94A3B8;stroke-width:1.1458333333333333;" width="57.2917" x="6.875" y="285.3125"/><text fill="#000000" font-family="Inter" font-size="10.3125" font-weight="bold" lengthAdjust="spacing" textLength="29.7917" x="20.625" y="312.1266">DONE</text><ellipse cx="35.5208" cy="386.1458" fill="none" rx="12.6042" ry="12.6042" style="stroke:#222222;stroke-width:1.1458333333333333;"/><ellipse cx="35.5208" cy="386.1458" fill="#222222" rx="6.875" ry="6.875" style="stroke:#222222;stroke-width:1.1458333333333333;"/><polygon fill="#CBD5E1" points="35.5208,83.3979,40.1042,73.0854,35.5208,77.6688,30.9375,73.0854,35.5208,83.3979" style="stroke:#CBD5E1;stroke-width:1.1458333333333333;"/><path d="M35.5208,41.323 C35.5208,52.7366 35.5208,62.8874 35.5208,76.5229 " fill="none" style="stroke:#CBD5E1;stroke-width:1.1458333333333333;"/><polygon fill="#1E90FF" points="35.5208,184.4415,40.1042,174.129,35.5208,178.7124,30.9375,174.129,35.5208,184.4415" style="stroke:#1E90FF;stroke-width:1.1458333333333333;"/><path d="M35.5208,129.5779 C35.5208,145.908 35.5208,161.2512 35.5208,177.5665 " fill="none" style="stroke:#1E90FF;stroke-width:2.2916666666666665;"/><a href="#link_SUBMIT" target="_self" title="#link_SUBMIT" xlink:actuate="onRequest" xlink:href="#link_SUBMIT" xlink:show="new" xlink:title="#link_SUBMIT" xlink:type="simple"><text fill="#0000FF" font-family="JetBrains Mono" font-size="9.1667" lengthAdjust="spacing" text-decoration="underline" textLength="113.4375" x="36.6667" y="160.1123">SUBMIT / loggingAction()</text></a><polygon fill="#1E90FF" points="35.5208,285.2749,40.1042,274.9624,35.5208,279.5457,30.9375,274.9624,35.5208,285.2749" style="stroke:#1E90FF;stroke-width:1.1458333333333333;"/><path d="M35.5208,230.4113 C35.5208,246.7413 35.5208,262.0846 35.5208,278.3999 " fill="none" style="stroke:#1E90FF;stroke-width:2.2916666666666665;"/><a href="#link_ORDER_EVENT" target="_self" title="#link_ORDER_EVENT" xlink:actuate="onRequest" xlink:href="#link_ORDER_EVENT" xlink:show="new" xlink:title="#link_ORDER_EVENT" xlink:type="simple"><text fill="#0000FF" font-family="JetBrains Mono" font-size="9.1667" lengthAdjust="spacing" text-decoration="underline" textLength="61.875" x="36.6667" y="260.9456">ORDER_EVENT</text></a><polygon fill="#CBD5E1" points="35.5208,373.4202,40.1042,363.1077,35.5208,367.6911,30.9375,363.1077,35.5208,373.4202" style="stroke:#CBD5E1;stroke-width:1.1458333333333333;"/><path d="M35.5208,331.1691 C35.5208,344.8226 35.5208,355.0691 35.5208,366.5452 " fill="none" style="stroke:#CBD5E1;stroke-width:1.1458333333333333;"/><!--SRC=[RP7RJW8n48Rl-nHZk54ZaVMGW24a84k24J0SJ0mXPDWEIqEttRH5HEExsmN4LRpgp3Vj_yzCJrA3SO8WSQDN3cn23XKoIpwc50qwRK1fHMmXE04bgTi09niPaJgXrGvRHuQqswJ4x5Aex5tY8Jg23mRGm6WP6xrI_5vBhxTU24SPruQJsR52vGQlP-K37Iv4j5HaBGIUjRHoNKm8sifRxS50l1DKlXEtaGGpBRa7_PsNKMJWgkJ14t8kLEorFlCTBf3hTSRdA6s-zxenUdqmVI3NC2YKXOvM-hzhsrRAVolxoQ8PlwNWRp4_u4-9fmA2e9HlyZL-56evH1FxJvbQadF6nkSJA1PhqEwsXuonx83Yk124bLAhTP5jOUAhZT7W1QfLUlCxKoXhjIoP3aQDJdleapiOZmlIQ-yHx8zBa3gE_LhgKVR5fsUJ2TjA7JiqUztmsA7NRuRzQVWSTd_Rv3ZaOY_FjaBPH7woBm00]--></g></svg>
</div>
</div>
<script id="metadata-json" type="application/json">
{
"name" : "click.kamil.maven.core.MavenOrderStateMachine",
"states" : [ {
"rawName" : "DONE",
"fullIdentifier" : "DONE"
}, {
"rawName" : "\"INIT\"",
"fullIdentifier" : "INIT"
}, {
"rawName" : "\"BUSY\"",
"fullIdentifier" : "BUSY"
}, {
"rawName" : "INIT",
"fullIdentifier" : "INIT"
}, {
"rawName" : "\"DONE\"",
"fullIdentifier" : "DONE"
} ],
"transitions" : [ {
"type" : "EXTERNAL",
"sourceStates" : [ {
"rawName" : "\"INIT\"",
"fullIdentifier" : "INIT"
} ],
"targetStates" : [ {
"rawName" : "\"BUSY\"",
"fullIdentifier" : "BUSY"
} ],
"event" : "SUBMIT",
"guard" : null,
"actions" : [ {
"expression" : "loggingAction()",
"isLambda" : false,
"internalLogic" : "context -> {\n System.out.println(\"LOG: State transition in progress...\");\n}\n",
"lineNumber" : 25,
"className" : "click.kamil.maven.core.MavenOrderStateMachine",
"sourceFile" : "core-module/src/main/java/click/kamil/maven/core/MavenOrderStateMachine.java"
} ],
"order" : null
}, {
"type" : "EXTERNAL",
"sourceStates" : [ {
"rawName" : "\"BUSY\"",
"fullIdentifier" : "BUSY"
} ],
"targetStates" : [ {
"rawName" : "\"DONE\"",
"fullIdentifier" : "DONE"
} ],
"event" : "ORDER_EVENT",
"guard" : null,
"actions" : [ ],
"order" : null
} ],
"startStates" : [ "INIT" ],
"endStates" : [ "DONE" ],
"renderChoicesAsDiamonds" : true,
"flows" : [ ],
"metadata" : {
"triggers" : [ {
"event" : "SUBMIT",
"className" : "click.kamil.maven.core.MavenOrderStateMachine.OrderController",
"methodName" : "submitOrder",
"sourceFile" : "core-module/src/main/java/click/kamil/maven/core/MavenOrderStateMachine.java",
"sourceModule" : null,
"stateMachineId" : null,
"lineNumber" : 40
}, {
"event" : "ORDER_EVENT",
"className" : "click.kamil.maven.core.MavenOrderStateMachine.OrderService",
"methodName" : "onMessage",
"sourceFile" : "core-module/src/main/java/click/kamil/maven/core/MavenOrderStateMachine.java",
"sourceModule" : null,
"stateMachineId" : null,
"lineNumber" : 52
} ],
"entryPoints" : [ {
"type" : "REST",
"name" : "POST /maven/orders/submit",
"className" : "click.kamil.maven.core.MavenOrderStateMachine.OrderController",
"methodName" : "submitOrder",
"sourceFile" : "core-module/src/main/java/click/kamil/maven/core/MavenOrderStateMachine.java",
"metadata" : {
"path" : "/maven/orders/submit",
"verb" : "POST"
},
"parameters" : [ {
"name" : "orderId",
"type" : "String",
"annotations" : [ "RequestBody" ]
} ]
}, {
"type" : "REST",
"name" : "POST /reactive/order",
"className" : "click.kamil.maven.api.ReactiveOrderApi",
"methodName" : "orderRoutes",
"sourceFile" : "api-module/src/main/java/click/kamil/maven/api/ReactiveOrderApi.java",
"metadata" : {
"path" : "/reactive/order",
"verb" : "POST",
"style" : "WebFlux Functional"
},
"parameters" : [ ]
}, {
"type" : "REST",
"name" : "POST /maven/orders/submit",
"className" : "click.kamil.maven.api.MavenOrderApi",
"methodName" : "submitOrder",
"sourceFile" : "api-module/src/main/java/click/kamil/maven/api/MavenOrderApi.java",
"metadata" : {
"path" : "/maven/orders/submit",
"verb" : "POST"
},
"parameters" : [ {
"name" : "orderId",
"type" : "String",
"annotations" : [ "RequestBody" ]
} ]
}, {
"type" : "JMS",
"name" : "JMS: order.queue",
"className" : "click.kamil.maven.api.JmsOrderListener",
"methodName" : "onMessage",
"sourceFile" : null,
"metadata" : {
"protocol" : "JMS",
"destination" : "order.queue"
},
"parameters" : [ {
"name" : "message",
"type" : "String",
"annotations" : [ ]
} ]
} ],
"callChains" : [ {
"entryPoint" : {
"type" : "REST",
"name" : "POST /maven/orders/submit",
"className" : "click.kamil.maven.core.MavenOrderStateMachine.OrderController",
"methodName" : "submitOrder",
"sourceFile" : "core-module/src/main/java/click/kamil/maven/core/MavenOrderStateMachine.java",
"metadata" : {
"path" : "/maven/orders/submit",
"verb" : "POST"
},
"parameters" : [ {
"name" : "orderId",
"type" : "String",
"annotations" : [ "RequestBody" ]
} ]
},
"methodChain" : [ "click.kamil.maven.core.MavenOrderStateMachine.OrderController.submitOrder" ],
"triggerPoint" : {
"event" : "SUBMIT",
"className" : "click.kamil.maven.core.MavenOrderStateMachine.OrderController",
"methodName" : "submitOrder",
"sourceFile" : "core-module/src/main/java/click/kamil/maven/core/MavenOrderStateMachine.java",
"sourceModule" : null,
"stateMachineId" : null,
"lineNumber" : 40
}
} ],
"properties" : {
"default" : { }
}
}
}
</script>
<script>
const metadata = JSON.parse(document.getElementById('metadata-json').textContent);
let panZoomInstance;
document.addEventListener('DOMContentLoaded', () => {
const svg = document.querySelector('#svg-container svg');
panZoomInstance = svgPanZoom(svg, { zoomEnabled: true, controlIconsEnabled: true, fit: true, center: true });
document.getElementById('toggle-sidebar').addEventListener('click', () => {
const sidebar = document.getElementById('sidebar');
sidebar.classList.toggle('collapsed');
// Re-center SVG pan-zoom after transition
setTimeout(() => {
if (panZoomInstance) {
panZoomInstance.resize();
panZoomInstance.center();
}
}, 300);
});
setupTabs();
populateSidebar();
populateFlows();
attachInteractivity();
});
function setupTabs() {
const flows = metadata.flows || [];
if (flows.length === 0) {
document.querySelector('.tabs').style.display = 'none';
document.querySelector('.tab-content[data-tab="flows"]')?.remove();
return;
}
document.querySelectorAll('.tab').forEach(tab => {
tab.addEventListener('click', () => {
document.querySelectorAll('.tab, .tab-content').forEach(el => el.classList.remove('active'));
tab.classList.add('active');
document.getElementById('tab-' + tab.dataset.tab).classList.add('active');
});
});
}
function populateSidebar() {
const list = document.getElementById('ep-list');
const entryPoints = metadata.metadata.entryPoints || [];
const machineEvents = new Set(metadata.transitions.map(t => t.event).filter(Boolean));
entryPoints.forEach(ep => {
// Quality Filter: Hide if it doesn't trigger a machine event
const chains = (metadata.metadata.callChains || []).filter(c =>
c.entryPoint.className === ep.className &&
c.entryPoint.methodName === ep.methodName &&
machineEvents.has(c.triggerPoint.event)
);
if (chains.length === 0) return;
const card = document.createElement('div');
card.className = 'ep-card';
const sourceHint = ep.sourceFile ? `<div style="font-size:0.65rem; color:var(--text-muted); margin-top:4px; font-style:italic;">${ep.sourceFile}</div>` : '';
card.innerHTML = `
<div class="ep-type type-${ep.type.toLowerCase()}">${ep.type}</div>
<div class="ep-name">${ep.name}</div>
<div class="ep-fqn">${ep.className}.${ep.methodName}</div>
${sourceHint}
`;
card.onmouseenter = () => highlightEntryPoint(ep);
card.onmouseleave = clearHighlights;
list.appendChild(card);
});
}
function populateFlows() {
const list = document.getElementById('flow-list');
const flows = metadata.flows || [];
if (flows.length === 0) {
list.innerHTML = '<p style="color:var(--text-muted); font-size:0.8rem; font-style:italic;">No business flows defined.</p>';
return;
}
flows.forEach(flow => {
const card = document.createElement('div');
card.className = 'flow-card';
card.innerHTML = `
<div class="flow-name">${flow.name}</div>
<div class="flow-desc">${flow.description}</div>
`;
card.onmouseenter = () => highlightFlow(flow);
card.onmouseleave = clearHighlights;
list.appendChild(card);
});
}
function highlightEntryPoint(ep) {
clearHighlights();
const machineEvents = new Set(metadata.transitions.map(t => t.event).filter(Boolean));
const chains = metadata.metadata.callChains || [];
const relevantEvents = chains
.filter(c => c.entryPoint.className === ep.className && c.entryPoint.methodName === ep.methodName && machineEvents.has(c.triggerPoint.event))
.map(c => c.triggerPoint.event);
if (relevantEvents.length === 0) return;
highlightEvents(relevantEvents);
}
function highlightFlow(flow) {
clearHighlights();
if (!flow.steps || flow.steps.length === 0) return;
highlightEvents(flow.steps);
}
function highlightEvents(steps) {
const svg = document.querySelector('#svg-container svg');
// Dim everything first
svg.querySelectorAll('path, rect, circle, ellipse, text, polygon').forEach(el => {
el.classList.add('dimmed');
});
steps.forEach(step => {
let linkId = "";
if (step.includes("->")) {
// Named Choice Branch: "SRC->TGT"
const parts = step.split("->");
linkId = "#link_anon_" + normalize(parts[0]) + "_" + normalize(parts[1]);
} else {
// Standard Event
linkId = "#link_" + normalize(step);
}
svg.querySelectorAll('a').forEach(link => {
const href = link.getAttribute('xlink:href') || link.getAttribute('href');
if (href === linkId) {
highlightLinkGroup(link);
}
});
});
// Un-dim all state nodes for context
svg.querySelectorAll('rect, circle, ellipse, polygon').forEach(el => {
const isChoice = el.tagName === 'polygon' && el.points?.numberOfItems === 4;
if (isChoice || ['rect', 'circle', 'ellipse'].includes(el.tagName)) {
el.classList.remove('dimmed');
let next = el.nextElementSibling;
while(next && next.tagName === 'text') {
next.classList.remove('dimmed');
next = next.nextElementSibling;
}
}
});
}
function highlightLinkGroup(link) {
link.classList.add('active-path');
link.querySelectorAll('*').forEach(child => child.classList.remove('dimmed'));
// Find path and polygon immediately before the <a> tag (interleaved)
let prev = link.previousElementSibling;
let foundPath = false;
let foundPolygon = false;
while (prev) {
if (prev.tagName === 'path' && !foundPath) {
prev.classList.remove('dimmed');
prev.classList.add('active-path');
foundPath = true;
} else if (prev.tagName === 'polygon' && !foundPolygon && prev.points?.numberOfItems !== 4) {
prev.classList.remove('dimmed');
prev.classList.add('active-path');
foundPolygon = true;
} else if (['rect', 'circle', 'ellipse'].includes(prev.tagName) ||
(prev.tagName === 'polygon' && prev.points?.numberOfItems === 4)) {
// Hit a state node, stop traversal
break;
}
if (foundPath && foundPolygon) break;
prev = prev.previousElementSibling;
}
}
function clearHighlights() {
document.querySelectorAll('.dimmed, .active-path').forEach(el => {
el.classList.remove('dimmed', 'active-path');
});
}
function attachInteractivity() {
const svg = document.querySelector('#svg-container svg');
const transitions = metadata.transitions || [];
svg.querySelectorAll('a').forEach(link => {
const href = link.getAttribute('xlink:href') || link.getAttribute('href');
if (!href || !href.startsWith('#link_')) return;
const linkId = href.replace('#link_', '');
const isAnon = linkId.startsWith('anon_');
let metaTrans = null;
if (isAnon) {
metaTrans = transitions.find(t =>
!t.event &&
"anon_" + normalize(t.sourceStates[0].fullIdentifier) + "_" + normalize(t.targetStates[0].fullIdentifier) === linkId
);
} else {
metaTrans = transitions.find(t => normalize(t.event) === linkId);
}
if (metaTrans || isAnon) {
link.style.cursor = 'pointer';
const setupTippy = (el) => {
tippy(el, {
content: createTooltip(isAnon ? "Internal logic" : linkId, metaTrans),
allowHTML: true,
theme: 'modern',
interactive: true,
appendTo: document.body,
placement: 'right',
offset: [0, 20]
});
};
setupTippy(link);
let path = link.previousElementSibling;
while(path && path.tagName !== 'path') path = path.previousElementSibling;
if (path) {
path.style.cursor = 'pointer';
setupTippy(path);
}
}
});
}
function normalize(s) {
if (!s) return "";
return s.replace(/[^a-zA-Z0-9]/g, '_');
}
function createTooltip(name, trans) {
const chains = (metadata.metadata.callChains || []).filter(c => normalize(c.triggerPoint.event) === name);
let html = `<div class="tooltip-content">
<div style="font-weight:900; font-size:1.1rem; margin-bottom:12px; border-bottom:1px solid #eee; padding-bottom:8px; line-height:1.3;">
${name === 'Internal logic' ? name : 'Event: <span style="color:var(--accent)">' + name + '</span>'}
</div>`;
if (trans && trans.guard) {
const lineInfo = trans.guard.lineNumber ? ` <span style="color:#94a3b8; font-weight:400; font-size:0.6rem;">(${trans.guard.sourceFile || 'Source'}:${trans.guard.lineNumber})</span>` : '';
html += `<div style="font-size:0.7rem; font-weight:800; color:#94a3b8; text-transform:uppercase; margin-bottom:4px">Guard${lineInfo}</div>
<div style="background:#f1f5f9; padding:6px; border-radius:4px; font-family:monospace; font-size:0.8rem; margin-bottom:12px; border:1px solid #e2e8f0;">${trans.guard.expression}</div>`;
if (trans.guard.internalLogic) {
html += `<div style="font-size:0.65rem; font-weight:800; color:#cbd5e1; text-transform:uppercase; margin-bottom:4px">Internal Logic</div>
<pre style="background:#1e293b; color:#f8fafc; padding:8px; border-radius:4px; font-family:'JetBrains Mono', monospace; font-size:0.7rem; overflow-x:auto; margin-bottom:12px;"><code>${trans.guard.internalLogic.replace(/</g, '&lt;').replace(/>/g, '&gt;')}</code></pre>`;
}
}
if (trans && trans.actions && trans.actions.length > 0) {
html += `<div style="font-size:0.7rem; font-weight:800; color:#94a3b8; text-transform:uppercase; margin-bottom:4px">Actions</div>`;
trans.actions.forEach(action => {
const lineInfo = action.lineNumber ? ` <span style="color:#94a3b8; font-weight:400; font-size:0.6rem;">(${action.sourceFile || 'Source'}:${action.lineNumber})</span>` : '';
html += `<div style="font-size:0.7rem; font-weight:800; color:#94a3b8; text-transform:uppercase; margin-bottom:4px">Action${lineInfo}</div>
<div style="background:#f1f5f9; padding:6px; border-radius:4px; font-family:monospace; font-size:0.8rem; margin-bottom:12px; border:1px solid #e2e8f0;">${action.expression}</div>`;
if (action.internalLogic) {
html += `<div style="font-size:0.65rem; font-weight:800; color:#cbd5e1; text-transform:uppercase; margin-bottom:4px">Internal Logic</div>
<pre style="background:#1e293b; color:#f8fafc; padding:8px; border-radius:4px; font-family:'JetBrains Mono', monospace; font-size:0.7rem; overflow-x:auto; margin-bottom:12px;"><code>${action.internalLogic.replace(/</g, '&lt;').replace(/>/g, '&gt;')}</code></pre>`;
}
});
}
if (chains && chains.length > 0) {
html += `<div style="font-size:0.7rem; font-weight:800; color:#94a3b8; text-transform:uppercase; margin-bottom:10px; border-top:1px solid #eee; padding-top:10px">Triggered by</div>`;
chains.forEach(c => {
const triggerInfo = c.triggerPoint.sourceFile ? ` <span style="color:#94a3b8; font-weight:400; font-size:0.6rem;">(${c.triggerPoint.sourceFile}:${c.triggerPoint.lineNumber})</span>` : '';
html += `<div style="margin-bottom:20px">
<div style="font-weight:700; font-size:0.85rem; color:var(--text);">${c.entryPoint.name}</div>
<div style="font-size:0.65rem; color:#64748b; font-family:monospace; margin-top:2px;">Trigger: ${c.triggerPoint.methodName}${triggerInfo}</div>
${renderParameters(c.entryPoint.parameters)}
<div style="margin-left:10px; border-left:2px solid #e2e8f0; padding-left:12px; margin-top:10px">
${c.methodChain.map((m, i) => `<div style="font-size:0.7rem; color:#475569; margin-top:4px; font-family:'JetBrains Mono', monospace;"><b>${i+1}</b> ${m}</div>`).join('')}
</div>
</div>`;
});
}
html += `</div>`;
return html;
}
function renderParameters(params) {
if (!params || params.length === 0) return "";
let html = `<div style="font-size:0.65rem; font-weight:700; color:#94a3b8; margin-top:8px; margin-bottom:4px; text-transform:uppercase;">Input Data</div>`;
html += `<div class="payload-box">`;
params.forEach(p => {
const annotation = (p.annotations || []).find(a => a.endsWith("RequestBody") || a.endsWith("PathVariable") || a.endsWith("RequestParam"));
const cleanAnn = annotation ? "@" + annotation.substring(annotation.lastIndexOf('.') + 1) : "";
html += `<div class="payload-param">
<span style="color:#f43f5e; font-size:0.65rem; font-weight:bold;">${cleanAnn}</span>
<span style="color:#38bdf8;">${p.type}</span>
<span style="color:#a3e635;">${p.name}</span>
</div>`;
});
html += `</div>`;
return html;
}
</script>
</body>
</html>

View File

@@ -1,150 +0,0 @@
{
"metadata" : {
"triggers" : [ {
"event" : "SUBMIT",
"className" : "click.kamil.maven.core.MavenOrderStateMachine.OrderController",
"methodName" : "submitOrder",
"sourceFile" : "core-module/src/main/java/click/kamil/maven/core/MavenOrderStateMachine.java",
"sourceModule" : null,
"stateMachineId" : null,
"lineNumber" : 40
}, {
"event" : "ORDER_EVENT",
"className" : "click.kamil.maven.core.MavenOrderStateMachine.OrderService",
"methodName" : "onMessage",
"sourceFile" : "core-module/src/main/java/click/kamil/maven/core/MavenOrderStateMachine.java",
"sourceModule" : null,
"stateMachineId" : null,
"lineNumber" : 52
} ],
"entryPoints" : [ {
"type" : "REST",
"name" : "POST /maven/orders/submit",
"className" : "click.kamil.maven.core.MavenOrderStateMachine.OrderController",
"methodName" : "submitOrder",
"sourceFile" : "core-module/src/main/java/click/kamil/maven/core/MavenOrderStateMachine.java",
"metadata" : {
"path" : "/maven/orders/submit",
"verb" : "POST"
},
"parameters" : [ {
"name" : "orderId",
"type" : "String",
"annotations" : [ "RequestBody" ]
} ]
}, {
"type" : "REST",
"name" : "POST /reactive/order",
"className" : "click.kamil.maven.api.ReactiveOrderApi",
"methodName" : "orderRoutes",
"sourceFile" : "api-module/src/main/java/click/kamil/maven/api/ReactiveOrderApi.java",
"metadata" : {
"path" : "/reactive/order",
"verb" : "POST",
"style" : "WebFlux Functional"
},
"parameters" : [ ]
}, {
"type" : "REST",
"name" : "POST /maven/orders/submit",
"className" : "click.kamil.maven.api.MavenOrderApi",
"methodName" : "submitOrder",
"sourceFile" : "api-module/src/main/java/click/kamil/maven/api/MavenOrderApi.java",
"metadata" : {
"path" : "/maven/orders/submit",
"verb" : "POST"
},
"parameters" : [ {
"name" : "orderId",
"type" : "String",
"annotations" : [ "RequestBody" ]
} ]
}, {
"type" : "JMS",
"name" : "JMS: order.queue",
"className" : "click.kamil.maven.api.JmsOrderListener",
"methodName" : "onMessage",
"sourceFile" : null,
"metadata" : {
"protocol" : "JMS",
"destination" : "order.queue"
},
"parameters" : [ {
"name" : "message",
"type" : "String",
"annotations" : [ ]
} ]
} ],
"callChains" : [ {
"entryPoint" : {
"type" : "REST",
"name" : "POST /maven/orders/submit",
"className" : "click.kamil.maven.core.MavenOrderStateMachine.OrderController",
"methodName" : "submitOrder",
"sourceFile" : "core-module/src/main/java/click/kamil/maven/core/MavenOrderStateMachine.java",
"metadata" : {
"path" : "/maven/orders/submit",
"verb" : "POST"
},
"parameters" : [ {
"name" : "orderId",
"type" : "String",
"annotations" : [ "RequestBody" ]
} ]
},
"methodChain" : [ "click.kamil.maven.core.MavenOrderStateMachine.OrderController.submitOrder" ],
"triggerPoint" : {
"event" : "SUBMIT",
"className" : "click.kamil.maven.core.MavenOrderStateMachine.OrderController",
"methodName" : "submitOrder",
"sourceFile" : "core-module/src/main/java/click/kamil/maven/core/MavenOrderStateMachine.java",
"sourceModule" : null,
"stateMachineId" : null,
"lineNumber" : 40
}
} ],
"properties" : {
"default" : { }
}
},
"name" : "click.kamil.maven.core.MavenOrderStateMachine",
"renderChoicesAsDiamonds" : true,
"startStates" : [ "INIT" ],
"transitions" : [ {
"type" : "EXTERNAL",
"sourceStates" : [ {
"rawName" : "\"INIT\"",
"fullIdentifier" : "INIT"
} ],
"targetStates" : [ {
"rawName" : "\"BUSY\"",
"fullIdentifier" : "BUSY"
} ],
"event" : "SUBMIT",
"guard" : null,
"actions" : [ {
"expression" : "loggingAction()",
"isLambda" : false,
"internalLogic" : "context -> {\n System.out.println(\"LOG: State transition in progress...\");\n}\n",
"lineNumber" : 25,
"className" : "click.kamil.maven.core.MavenOrderStateMachine",
"sourceFile" : "core-module/src/main/java/click/kamil/maven/core/MavenOrderStateMachine.java"
} ],
"order" : null
}, {
"type" : "EXTERNAL",
"sourceStates" : [ {
"rawName" : "\"BUSY\"",
"fullIdentifier" : "BUSY"
} ],
"targetStates" : [ {
"rawName" : "\"DONE\"",
"fullIdentifier" : "DONE"
} ],
"event" : "ORDER_EVENT",
"guard" : null,
"actions" : [ ],
"order" : null
} ],
"endStates" : [ "DONE" ]
}

View File

@@ -1,31 +0,0 @@
@startuml
!pragma layout smetana
set separator none
hide empty description
hide stereotype
skinparam state {
BackgroundColor white
BorderColor #94a3b8
BorderThickness 1
FontName Inter
FontSize 9
FontStyle bold
RoundCorner 20
Padding 1
}
skinparam shadowing false
skinparam ArrowFontName JetBrains Mono
skinparam ArrowFontSize 8
skinparam ArrowColor #cbd5e1
skinparam ArrowThickness 1
skinparam dpi 110
skinparam svgLinkTarget _self
[*] --> INIT
INIT -[#1E90FF,bold]-> BUSY <<external>> <<e_ORDER_EVENT>> : ORDER_EVENT / loggingAction()
DONE --> [*]
@enduml

View File

@@ -1,735 +0,0 @@
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>State Machine Explorer - click.kamil.multi.core.OrderStateMachineConfig</title>
<!-- Popper and Tippy for tooltips -->
<script src="https://unpkg.com/@popperjs/core@2"></script>
<script src="https://unpkg.com/tippy.js@6"></script>
<link rel="stylesheet" href="https://unpkg.com/tippy.js@6/animations/scale.css"/>
<!-- SVG Pan & Zoom -->
<script src="https://cdn.jsdelivr.net/npm/svg-pan-zoom@3.6.1/dist/svg-pan-zoom.min.js"></script>
<!-- Google Fonts -->
<link rel="preconnect" href="https://fonts.googleapis.com">
<link rel="preconnect" href="https://fonts.gstatic.com" crossorigin>
<link href="https://fonts.googleapis.com/css2?family=Inter:wght@400;600;900&family=JetBrains+Mono:wght@400;700&display=swap" rel="stylesheet">
<style>
:root {
--sidebar-bg: #ffffff;
--main-bg: #f8fafc;
--accent: #ef4444;
--primary: #3b82f6;
--text: #0f172a;
--text-muted: #64748b;
--border: #e2e8f0;
}
body {
margin: 0;
display: flex;
height: 100vh;
font-family: 'Inter', -apple-system, sans-serif;
background: var(--main-bg);
color: var(--text);
overflow: hidden;
}
#sidebar {
width: 480px;
min-width: 350px;
max-width: 900px;
background: var(--sidebar-bg);
border-right: 2px solid var(--border);
display: flex;
flex-direction: column;
box-shadow: 10px 0 15px rgba(0,0,0,0.02);
z-index: 10;
overflow-x: hidden;
resize: horizontal;
position: relative;
transition: width 0.3s ease, min-width 0.3s ease, padding 0.3s ease;
}
#sidebar.collapsed {
width: 0 !important;
min-width: 0 !important;
border-right: none;
padding: 0;
overflow: hidden;
resize: none;
}
#toggle-sidebar {
position: absolute;
top: 20px;
left: 20px;
z-index: 50;
background: #fff;
border: 1px solid var(--border);
border-radius: 8px;
padding: 8px;
cursor: pointer;
box-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.1);
display: flex;
align-items: center;
justify-content: center;
transition: all 0.2s ease;
}
#toggle-sidebar:hover {
background: #f8fafc;
border-color: var(--primary);
}
#toggle-sidebar svg {
width: 20px;
height: 20px;
fill: none;
stroke: var(--text-muted);
stroke-width: 2;
stroke-linecap: round;
stroke-linejoin: round;
}
#sidebar::after {
content: '⋮';
position: absolute;
right: 2px; top: 50%;
transform: translateY(-50%);
color: var(--border);
font-size: 1.2rem;
pointer-events: none;
}
.sidebar-header {
padding: 30px 30px 10px;
}
header h1 { font-weight: 900; font-size: 1.6rem; color: var(--text); margin: 0 0 5px 0; letter-spacing: -0.5px; }
header p { font-family: 'JetBrains Mono', monospace; font-size: 0.7rem; color: var(--text-muted); margin: 0 0 15px 0; opacity: 0.7; }
.tabs {
display: flex;
padding: 0 30px;
border-bottom: 1px solid var(--border);
gap: 20px;
}
.tab {
padding: 10px 0;
font-size: 0.85rem;
font-weight: 600;
color: var(--text-muted);
cursor: pointer;
position: relative;
transition: color 0.2s;
}
.tab:hover { color: var(--text); }
.tab.active { color: var(--primary); }
.tab.active::after {
content: '';
position: absolute;
bottom: -1px; left: 0; right: 0;
height: 2px;
background: var(--primary);
}
.tab-content {
flex-grow: 1;
padding: 25px 30px;
overflow-y: auto;
display: none;
}
.tab-content.active { display: block; }
.ep-card, .flow-card {
padding: 18px;
background: #fff;
border: 1px solid var(--border);
border-radius: 14px;
margin-bottom: 15px;
cursor: pointer;
transition: all 0.25s cubic-bezier(0.4, 0, 0.2, 1);
box-shadow: 0 1px 3px rgba(0,0,0,0.04);
position: relative;
word-break: break-all;
overflow-wrap: anywhere;
}
.ep-card:hover, .flow-card:hover {
border-color: var(--primary);
transform: translateX(5px);
box-shadow: 0 15px 30px -10px rgba(59, 130, 246, 0.15);
}
.ep-type {
font-size: 0.6rem;
font-weight: 900;
padding: 3px 8px;
border-radius: 6px;
display: inline-block;
margin-bottom: 10px;
text-transform: uppercase;
letter-spacing: 0.8px;
}
.type-rest { background: #eff6ff; color: #1d4ed8; }
.type-custom { background: #fef2f2; color: #b91c1c; }
.type-jms { background: #f5f3ff; color: #7c3aed; }
.type-sqs { background: #fff7ed; color: #ea580c; }
.type-sns { background: #fff1f2; color: #e11d48; }
.type-kafka { background: #fefce8; color: #854d0e; }
.type-rabbit { background: #f0fdf4; color: #166534; }
.ep-name, .flow-name { font-weight: 700; font-size: 0.95rem; margin-bottom: 6px; color: var(--text); }
.ep-fqn, .flow-desc { font-family: 'Inter', sans-serif; font-size: 0.75rem; color: var(--text-muted); opacity: 0.9; line-height: 1.4; }
#main { flex-grow: 1; position: relative; background: var(--main-bg); overflow: hidden; }
#svg-container {
position: absolute;
top: 0; left: 0; right: 0; bottom: 0;
display: flex;
align-items: center;
justify-content: center;
}
svg {
width: 100%;
height: 100%;
display: block;
}
/* SVG Interactivity Styles */
svg a { text-decoration: none !important; }
.active-path {
stroke: var(--accent) !important;
stroke-width: 2.5px !important;
filter: drop-shadow(0 0 8px rgba(239, 68, 68, 0.3));
transition: all 0.3s;
}
.active-path text, a.active-path text {
fill: #000 !important;
font-weight: 900 !important;
paint-order: stroke;
stroke: #fff;
stroke-width: 3.5px;
}
.dimmed {
opacity: 0.2 !important;
filter: grayscale(1);
transition: opacity 0.4s ease;
pointer-events: none;
}
/* Tippy Styling */
.tippy-box[data-theme~='modern'] {
background-color: #fff;
color: var(--text);
box-shadow: 0 25px 50px -12px rgba(0,0,0,0.25);
border: 1px solid var(--border);
border-radius: 16px;
padding: 0;
max-width: 550px !important;
}
.tooltip-content {
padding: 20px;
max-width: 500px;
word-break: break-word;
overflow-wrap: anywhere;
}
.payload-box {
background: #0f172a;
color: #e2e8f0;
border-radius: 8px;
padding: 12px;
font-family: 'JetBrains Mono', monospace;
font-size: 0.75rem;
line-height: 1.5;
margin-top: 10px;
}
.payload-param {
margin-bottom: 4px;
}
.payload-param:last-child { margin-bottom: 0; }
</style>
</head>
<body>
<div id="sidebar">
<div class="sidebar-header">
<header>
<h1>Explorer</h1>
<p>click.kamil.multi.core.OrderStateMachineConfig</p>
</header>
</div>
<div class="tabs">
<div class="tab active" data-tab="explorer">Explorer</div>
<div class="tab" data-tab="flows">Business Flows</div>
</div>
<div id="tab-explorer" class="tab-content active">
<div id="ep-list"></div>
</div>
<div id="tab-flows" class="tab-content">
<div id="flow-list"></div>
</div>
</div>
<div id="main">
<button id="toggle-sidebar" aria-label="Toggle Sidebar" title="Toggle Sidebar">
<svg viewBox="0 0 24 24"><path d="M4 6h16M4 12h16M4 18h16"></path></svg>
</button>
<div id="svg-container">
<?xml version="1.0" encoding="us-ascii" standalone="no"?><svg xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" contentStyleType="text/css" height="100%" preserveAspectRatio="xMidYMid meet" version="1.1" viewBox="0 0 168 405" width="100%" zoomAndPan="magnify"><defs/><g><ellipse cx="45.2604" cy="25.2083" fill="#222222" rx="11.4583" ry="11.4583" style="stroke:#222222;stroke-width:1.1458333333333333;"/><rect fill="#FFFFFF" height="45.8333" rx="14.3229" ry="14.3229" style="stroke:#94A3B8;stroke-width:1.1458333333333333;" width="57.2917" x="16.6146" y="83.6458"/><text fill="#000000" font-family="Inter" font-size="10.3125" font-weight="bold" lengthAdjust="spacing" textLength="22.9167" x="33.8021" y="110.4599">NEW</text><rect fill="#FFFFFF" height="45.8333" rx="14.3229" ry="14.3229" style="stroke:#94A3B8;stroke-width:1.1458333333333333;" width="76.7708" x="6.875" y="184.4792"/><text fill="#000000" font-family="Inter" font-size="10.3125" font-weight="bold" lengthAdjust="spacing" textLength="65.3125" x="12.6042" y="211.2932">PROCESSING</text><rect fill="#FFFFFF" height="45.8333" rx="14.3229" ry="14.3229" style="stroke:#94A3B8;stroke-width:1.1458333333333333;" width="74.4792" x="8.0208" y="285.3125"/><text fill="#000000" font-family="Inter" font-size="10.3125" font-weight="bold" lengthAdjust="spacing" textLength="63.0208" x="13.75" y="312.1266">COMPLETED</text><ellipse cx="45.2604" cy="386.1458" fill="none" rx="12.6042" ry="12.6042" style="stroke:#222222;stroke-width:1.1458333333333333;"/><ellipse cx="45.2604" cy="386.1458" fill="#222222" rx="6.875" ry="6.875" style="stroke:#222222;stroke-width:1.1458333333333333;"/><polygon fill="#CBD5E1" points="45.2604,83.3979,49.8438,73.0854,45.2604,77.6688,40.6771,73.0854,45.2604,83.3979" style="stroke:#CBD5E1;stroke-width:1.1458333333333333;"/><path d="M45.2604,41.323 C45.2604,52.7366 45.2604,62.8874 45.2604,76.5229 " fill="none" style="stroke:#CBD5E1;stroke-width:1.1458333333333333;"/><polygon fill="#1E90FF" points="45.2604,184.4415,49.8438,174.129,45.2604,178.7124,40.6771,174.129,45.2604,184.4415" style="stroke:#1E90FF;stroke-width:1.1458333333333333;"/><path d="M45.2604,129.5779 C45.2604,145.908 45.2604,161.2512 45.2604,177.5665 " fill="none" style="stroke:#1E90FF;stroke-width:2.2916666666666665;"/><a href="#link_SUBMIT" target="_self" title="#link_SUBMIT" xlink:actuate="onRequest" xlink:href="#link_SUBMIT" xlink:show="new" xlink:title="#link_SUBMIT" xlink:type="simple"><text fill="#0000FF" font-family="JetBrains Mono" font-size="9.1667" lengthAdjust="spacing" text-decoration="underline" textLength="113.4375" x="46.4063" y="160.1123">SUBMIT / processAction()</text></a><polygon fill="#1E90FF" points="45.2604,285.2749,49.8438,274.9624,45.2604,279.5457,40.6771,274.9624,45.2604,285.2749" style="stroke:#1E90FF;stroke-width:1.1458333333333333;"/><path d="M45.2604,230.4113 C45.2604,246.7413 45.2604,262.0846 45.2604,278.3999 " fill="none" style="stroke:#1E90FF;stroke-width:2.2916666666666665;"/><a href="#link_FINISH" target="_self" title="#link_FINISH" xlink:actuate="onRequest" xlink:href="#link_FINISH" xlink:show="new" xlink:title="#link_FINISH" xlink:type="simple"><text fill="#0000FF" font-family="JetBrains Mono" font-size="9.1667" lengthAdjust="spacing" text-decoration="underline" textLength="27.5" x="46.4063" y="260.9456">FINISH</text></a><polygon fill="#CBD5E1" points="45.2604,373.4202,49.8438,363.1077,45.2604,367.6911,40.6771,363.1077,45.2604,373.4202" style="stroke:#CBD5E1;stroke-width:1.1458333333333333;"/><path d="M45.2604,331.1691 C45.2604,344.8226 45.2604,355.0691 45.2604,366.5452 " fill="none" style="stroke:#CBD5E1;stroke-width:1.1458333333333333;"/><!--SRC=[RP5TJy8m58Rl-okEuKQDHEP78iQG20wT4IGEumKXvh0UHyFMBcqLqVZVFNEey-DctNbE-xxlQJSAYscEaE7AF7fmENdKA1pnFnLeqHiBscWISoK9A2_y2YIvnAh2AwChx3nPCdvLa70BfSjpEKFq1Ay2e8l98hNcKSkUoLXlELUUIcwi95knHli0zsT7NtGyLyb2atCGCEiRxOUO4qIQhTOWLYy4xS_2hpA2cSaaWvlAosgoiDTYC48fbKvPwwsUS8xIB4l-W9chPp-rrYo_J2_9ToqgxM1WjFblsqUKez-TzMJ9J1vIyBjP7_2x9Gi5GT2gXtnAhvHUZD6c_2ZtZh878IRRKsWsEp0CxuGG_8Ncf164xLQ_lrFUmPHxevlhNXZ7qV0SJaxecUzDOzRfbCLzVDiTH6CkZc4oQMIilqQmNdQXi2RXTAT9-SoRMzEfg0d-TUjT3qPNuJWy-slMZuPHVF73h49GBImjle-NO_5uxm00]--></g></svg>
</div>
</div>
<script id="metadata-json" type="application/json">
{
"name" : "click.kamil.multi.core.OrderStateMachineConfig",
"states" : [ {
"rawName" : "COMPLETED",
"fullIdentifier" : "COMPLETED"
}, {
"rawName" : "\"PROCESSING\"",
"fullIdentifier" : "PROCESSING"
}, {
"rawName" : "\"COMPLETED\"",
"fullIdentifier" : "COMPLETED"
}, {
"rawName" : "NEW",
"fullIdentifier" : "NEW"
}, {
"rawName" : "\"NEW\"",
"fullIdentifier" : "NEW"
} ],
"transitions" : [ {
"type" : "EXTERNAL",
"sourceStates" : [ {
"rawName" : "\"NEW\"",
"fullIdentifier" : "NEW"
} ],
"targetStates" : [ {
"rawName" : "\"PROCESSING\"",
"fullIdentifier" : "PROCESSING"
} ],
"event" : "SUBMIT",
"guard" : null,
"actions" : [ {
"expression" : "processAction()",
"isLambda" : false,
"internalLogic" : "@Override default void execute(StateContext<String,String> context){\n System.out.println(\"Processing order: \" + context.getMessageHeader(\"orderId\"));\n}\n",
"lineNumber" : 31,
"className" : "click.kamil.multi.core.OrderStateMachineConfig",
"sourceFile" : "core-module/src/main/java/click/kamil/multi/core/OrderStateMachineConfig.java"
} ],
"order" : null
}, {
"type" : "EXTERNAL",
"sourceStates" : [ {
"rawName" : "\"PROCESSING\"",
"fullIdentifier" : "PROCESSING"
} ],
"targetStates" : [ {
"rawName" : "\"COMPLETED\"",
"fullIdentifier" : "COMPLETED"
} ],
"event" : "FINISH",
"guard" : null,
"actions" : [ ],
"order" : null
} ],
"startStates" : [ "NEW" ],
"endStates" : [ "COMPLETED" ],
"renderChoicesAsDiamonds" : true,
"flows" : [ ],
"metadata" : {
"triggers" : [ {
"event" : "SUBMIT",
"className" : "click.kamil.multi.core.OrderController",
"methodName" : "submitOrder",
"sourceFile" : "core-module/src/main/java/click/kamil/multi/core/OrderController.java",
"sourceModule" : null,
"stateMachineId" : null,
"lineNumber" : 18
} ],
"entryPoints" : [ {
"type" : "REST",
"name" : "POST /orders/submit",
"className" : "click.kamil.multi.core.OrderController",
"methodName" : "submitOrder",
"sourceFile" : "core-module/src/main/java/click/kamil/multi/core/OrderController.java",
"metadata" : {
"path" : "/orders/submit",
"verb" : "POST"
},
"parameters" : [ {
"name" : "orderId",
"type" : "String",
"annotations" : [ "RequestBody" ]
} ]
}, {
"type" : "REST",
"name" : "POST /orders/submit",
"className" : "click.kamil.multi.api.OrderApi",
"methodName" : "submitOrder",
"sourceFile" : "api-module/src/main/java/click/kamil/multi/api/OrderApi.java",
"metadata" : {
"path" : "/orders/submit",
"verb" : "POST"
},
"parameters" : [ {
"name" : "orderId",
"type" : "String",
"annotations" : [ "RequestBody" ]
} ]
} ],
"callChains" : [ {
"entryPoint" : {
"type" : "REST",
"name" : "POST /orders/submit",
"className" : "click.kamil.multi.core.OrderController",
"methodName" : "submitOrder",
"sourceFile" : "core-module/src/main/java/click/kamil/multi/core/OrderController.java",
"metadata" : {
"path" : "/orders/submit",
"verb" : "POST"
},
"parameters" : [ {
"name" : "orderId",
"type" : "String",
"annotations" : [ "RequestBody" ]
} ]
},
"methodChain" : [ "click.kamil.multi.core.OrderController.submitOrder" ],
"triggerPoint" : {
"event" : "SUBMIT",
"className" : "click.kamil.multi.core.OrderController",
"methodName" : "submitOrder",
"sourceFile" : "core-module/src/main/java/click/kamil/multi/core/OrderController.java",
"sourceModule" : null,
"stateMachineId" : null,
"lineNumber" : 18
}
} ],
"properties" : {
"default" : { }
}
}
}
</script>
<script>
const metadata = JSON.parse(document.getElementById('metadata-json').textContent);
let panZoomInstance;
document.addEventListener('DOMContentLoaded', () => {
const svg = document.querySelector('#svg-container svg');
panZoomInstance = svgPanZoom(svg, { zoomEnabled: true, controlIconsEnabled: true, fit: true, center: true });
document.getElementById('toggle-sidebar').addEventListener('click', () => {
const sidebar = document.getElementById('sidebar');
sidebar.classList.toggle('collapsed');
// Re-center SVG pan-zoom after transition
setTimeout(() => {
if (panZoomInstance) {
panZoomInstance.resize();
panZoomInstance.center();
}
}, 300);
});
setupTabs();
populateSidebar();
populateFlows();
attachInteractivity();
});
function setupTabs() {
const flows = metadata.flows || [];
if (flows.length === 0) {
document.querySelector('.tabs').style.display = 'none';
document.querySelector('.tab-content[data-tab="flows"]')?.remove();
return;
}
document.querySelectorAll('.tab').forEach(tab => {
tab.addEventListener('click', () => {
document.querySelectorAll('.tab, .tab-content').forEach(el => el.classList.remove('active'));
tab.classList.add('active');
document.getElementById('tab-' + tab.dataset.tab).classList.add('active');
});
});
}
function populateSidebar() {
const list = document.getElementById('ep-list');
const entryPoints = metadata.metadata.entryPoints || [];
const machineEvents = new Set(metadata.transitions.map(t => t.event).filter(Boolean));
entryPoints.forEach(ep => {
// Quality Filter: Hide if it doesn't trigger a machine event
const chains = (metadata.metadata.callChains || []).filter(c =>
c.entryPoint.className === ep.className &&
c.entryPoint.methodName === ep.methodName &&
machineEvents.has(c.triggerPoint.event)
);
if (chains.length === 0) return;
const card = document.createElement('div');
card.className = 'ep-card';
const sourceHint = ep.sourceFile ? `<div style="font-size:0.65rem; color:var(--text-muted); margin-top:4px; font-style:italic;">${ep.sourceFile}</div>` : '';
card.innerHTML = `
<div class="ep-type type-${ep.type.toLowerCase()}">${ep.type}</div>
<div class="ep-name">${ep.name}</div>
<div class="ep-fqn">${ep.className}.${ep.methodName}</div>
${sourceHint}
`;
card.onmouseenter = () => highlightEntryPoint(ep);
card.onmouseleave = clearHighlights;
list.appendChild(card);
});
}
function populateFlows() {
const list = document.getElementById('flow-list');
const flows = metadata.flows || [];
if (flows.length === 0) {
list.innerHTML = '<p style="color:var(--text-muted); font-size:0.8rem; font-style:italic;">No business flows defined.</p>';
return;
}
flows.forEach(flow => {
const card = document.createElement('div');
card.className = 'flow-card';
card.innerHTML = `
<div class="flow-name">${flow.name}</div>
<div class="flow-desc">${flow.description}</div>
`;
card.onmouseenter = () => highlightFlow(flow);
card.onmouseleave = clearHighlights;
list.appendChild(card);
});
}
function highlightEntryPoint(ep) {
clearHighlights();
const machineEvents = new Set(metadata.transitions.map(t => t.event).filter(Boolean));
const chains = metadata.metadata.callChains || [];
const relevantEvents = chains
.filter(c => c.entryPoint.className === ep.className && c.entryPoint.methodName === ep.methodName && machineEvents.has(c.triggerPoint.event))
.map(c => c.triggerPoint.event);
if (relevantEvents.length === 0) return;
highlightEvents(relevantEvents);
}
function highlightFlow(flow) {
clearHighlights();
if (!flow.steps || flow.steps.length === 0) return;
highlightEvents(flow.steps);
}
function highlightEvents(steps) {
const svg = document.querySelector('#svg-container svg');
// Dim everything first
svg.querySelectorAll('path, rect, circle, ellipse, text, polygon').forEach(el => {
el.classList.add('dimmed');
});
steps.forEach(step => {
let linkId = "";
if (step.includes("->")) {
// Named Choice Branch: "SRC->TGT"
const parts = step.split("->");
linkId = "#link_anon_" + normalize(parts[0]) + "_" + normalize(parts[1]);
} else {
// Standard Event
linkId = "#link_" + normalize(step);
}
svg.querySelectorAll('a').forEach(link => {
const href = link.getAttribute('xlink:href') || link.getAttribute('href');
if (href === linkId) {
highlightLinkGroup(link);
}
});
});
// Un-dim all state nodes for context
svg.querySelectorAll('rect, circle, ellipse, polygon').forEach(el => {
const isChoice = el.tagName === 'polygon' && el.points?.numberOfItems === 4;
if (isChoice || ['rect', 'circle', 'ellipse'].includes(el.tagName)) {
el.classList.remove('dimmed');
let next = el.nextElementSibling;
while(next && next.tagName === 'text') {
next.classList.remove('dimmed');
next = next.nextElementSibling;
}
}
});
}
function highlightLinkGroup(link) {
link.classList.add('active-path');
link.querySelectorAll('*').forEach(child => child.classList.remove('dimmed'));
// Find path and polygon immediately before the <a> tag (interleaved)
let prev = link.previousElementSibling;
let foundPath = false;
let foundPolygon = false;
while (prev) {
if (prev.tagName === 'path' && !foundPath) {
prev.classList.remove('dimmed');
prev.classList.add('active-path');
foundPath = true;
} else if (prev.tagName === 'polygon' && !foundPolygon && prev.points?.numberOfItems !== 4) {
prev.classList.remove('dimmed');
prev.classList.add('active-path');
foundPolygon = true;
} else if (['rect', 'circle', 'ellipse'].includes(prev.tagName) ||
(prev.tagName === 'polygon' && prev.points?.numberOfItems === 4)) {
// Hit a state node, stop traversal
break;
}
if (foundPath && foundPolygon) break;
prev = prev.previousElementSibling;
}
}
function clearHighlights() {
document.querySelectorAll('.dimmed, .active-path').forEach(el => {
el.classList.remove('dimmed', 'active-path');
});
}
function attachInteractivity() {
const svg = document.querySelector('#svg-container svg');
const transitions = metadata.transitions || [];
svg.querySelectorAll('a').forEach(link => {
const href = link.getAttribute('xlink:href') || link.getAttribute('href');
if (!href || !href.startsWith('#link_')) return;
const linkId = href.replace('#link_', '');
const isAnon = linkId.startsWith('anon_');
let metaTrans = null;
if (isAnon) {
metaTrans = transitions.find(t =>
!t.event &&
"anon_" + normalize(t.sourceStates[0].fullIdentifier) + "_" + normalize(t.targetStates[0].fullIdentifier) === linkId
);
} else {
metaTrans = transitions.find(t => normalize(t.event) === linkId);
}
if (metaTrans || isAnon) {
link.style.cursor = 'pointer';
const setupTippy = (el) => {
tippy(el, {
content: createTooltip(isAnon ? "Internal logic" : linkId, metaTrans),
allowHTML: true,
theme: 'modern',
interactive: true,
appendTo: document.body,
placement: 'right',
offset: [0, 20]
});
};
setupTippy(link);
let path = link.previousElementSibling;
while(path && path.tagName !== 'path') path = path.previousElementSibling;
if (path) {
path.style.cursor = 'pointer';
setupTippy(path);
}
}
});
}
function normalize(s) {
if (!s) return "";
return s.replace(/[^a-zA-Z0-9]/g, '_');
}
function createTooltip(name, trans) {
const chains = (metadata.metadata.callChains || []).filter(c => normalize(c.triggerPoint.event) === name);
let html = `<div class="tooltip-content">
<div style="font-weight:900; font-size:1.1rem; margin-bottom:12px; border-bottom:1px solid #eee; padding-bottom:8px; line-height:1.3;">
${name === 'Internal logic' ? name : 'Event: <span style="color:var(--accent)">' + name + '</span>'}
</div>`;
if (trans && trans.guard) {
const lineInfo = trans.guard.lineNumber ? ` <span style="color:#94a3b8; font-weight:400; font-size:0.6rem;">(${trans.guard.sourceFile || 'Source'}:${trans.guard.lineNumber})</span>` : '';
html += `<div style="font-size:0.7rem; font-weight:800; color:#94a3b8; text-transform:uppercase; margin-bottom:4px">Guard${lineInfo}</div>
<div style="background:#f1f5f9; padding:6px; border-radius:4px; font-family:monospace; font-size:0.8rem; margin-bottom:12px; border:1px solid #e2e8f0;">${trans.guard.expression}</div>`;
if (trans.guard.internalLogic) {
html += `<div style="font-size:0.65rem; font-weight:800; color:#cbd5e1; text-transform:uppercase; margin-bottom:4px">Internal Logic</div>
<pre style="background:#1e293b; color:#f8fafc; padding:8px; border-radius:4px; font-family:'JetBrains Mono', monospace; font-size:0.7rem; overflow-x:auto; margin-bottom:12px;"><code>${trans.guard.internalLogic.replace(/</g, '&lt;').replace(/>/g, '&gt;')}</code></pre>`;
}
}
if (trans && trans.actions && trans.actions.length > 0) {
html += `<div style="font-size:0.7rem; font-weight:800; color:#94a3b8; text-transform:uppercase; margin-bottom:4px">Actions</div>`;
trans.actions.forEach(action => {
const lineInfo = action.lineNumber ? ` <span style="color:#94a3b8; font-weight:400; font-size:0.6rem;">(${action.sourceFile || 'Source'}:${action.lineNumber})</span>` : '';
html += `<div style="font-size:0.7rem; font-weight:800; color:#94a3b8; text-transform:uppercase; margin-bottom:4px">Action${lineInfo}</div>
<div style="background:#f1f5f9; padding:6px; border-radius:4px; font-family:monospace; font-size:0.8rem; margin-bottom:12px; border:1px solid #e2e8f0;">${action.expression}</div>`;
if (action.internalLogic) {
html += `<div style="font-size:0.65rem; font-weight:800; color:#cbd5e1; text-transform:uppercase; margin-bottom:4px">Internal Logic</div>
<pre style="background:#1e293b; color:#f8fafc; padding:8px; border-radius:4px; font-family:'JetBrains Mono', monospace; font-size:0.7rem; overflow-x:auto; margin-bottom:12px;"><code>${action.internalLogic.replace(/</g, '&lt;').replace(/>/g, '&gt;')}</code></pre>`;
}
});
}
if (chains && chains.length > 0) {
html += `<div style="font-size:0.7rem; font-weight:800; color:#94a3b8; text-transform:uppercase; margin-bottom:10px; border-top:1px solid #eee; padding-top:10px">Triggered by</div>`;
chains.forEach(c => {
const triggerInfo = c.triggerPoint.sourceFile ? ` <span style="color:#94a3b8; font-weight:400; font-size:0.6rem;">(${c.triggerPoint.sourceFile}:${c.triggerPoint.lineNumber})</span>` : '';
html += `<div style="margin-bottom:20px">
<div style="font-weight:700; font-size:0.85rem; color:var(--text);">${c.entryPoint.name}</div>
<div style="font-size:0.65rem; color:#64748b; font-family:monospace; margin-top:2px;">Trigger: ${c.triggerPoint.methodName}${triggerInfo}</div>
${renderParameters(c.entryPoint.parameters)}
<div style="margin-left:10px; border-left:2px solid #e2e8f0; padding-left:12px; margin-top:10px">
${c.methodChain.map((m, i) => `<div style="font-size:0.7rem; color:#475569; margin-top:4px; font-family:'JetBrains Mono', monospace;"><b>${i+1}</b> ${m}</div>`).join('')}
</div>
</div>`;
});
}
html += `</div>`;
return html;
}
function renderParameters(params) {
if (!params || params.length === 0) return "";
let html = `<div style="font-size:0.65rem; font-weight:700; color:#94a3b8; margin-top:8px; margin-bottom:4px; text-transform:uppercase;">Input Data</div>`;
html += `<div class="payload-box">`;
params.forEach(p => {
const annotation = (p.annotations || []).find(a => a.endsWith("RequestBody") || a.endsWith("PathVariable") || a.endsWith("RequestParam"));
const cleanAnn = annotation ? "@" + annotation.substring(annotation.lastIndexOf('.') + 1) : "";
html += `<div class="payload-param">
<span style="color:#f43f5e; font-size:0.65rem; font-weight:bold;">${cleanAnn}</span>
<span style="color:#38bdf8;">${p.type}</span>
<span style="color:#a3e635;">${p.name}</span>
</div>`;
});
html += `</div>`;
return html;
}
</script>
</body>
</html>

View File

@@ -1,115 +0,0 @@
{
"metadata" : {
"triggers" : [ {
"event" : "SUBMIT",
"className" : "click.kamil.multi.core.OrderController",
"methodName" : "submitOrder",
"sourceFile" : "core-module/src/main/java/click/kamil/multi/core/OrderController.java",
"sourceModule" : null,
"stateMachineId" : null,
"lineNumber" : 18
} ],
"entryPoints" : [ {
"type" : "REST",
"name" : "POST /orders/submit",
"className" : "click.kamil.multi.core.OrderController",
"methodName" : "submitOrder",
"sourceFile" : "core-module/src/main/java/click/kamil/multi/core/OrderController.java",
"metadata" : {
"path" : "/orders/submit",
"verb" : "POST"
},
"parameters" : [ {
"name" : "orderId",
"type" : "String",
"annotations" : [ "RequestBody" ]
} ]
}, {
"type" : "REST",
"name" : "POST /orders/submit",
"className" : "click.kamil.multi.api.OrderApi",
"methodName" : "submitOrder",
"sourceFile" : "api-module/src/main/java/click/kamil/multi/api/OrderApi.java",
"metadata" : {
"path" : "/orders/submit",
"verb" : "POST"
},
"parameters" : [ {
"name" : "orderId",
"type" : "String",
"annotations" : [ "RequestBody" ]
} ]
} ],
"callChains" : [ {
"entryPoint" : {
"type" : "REST",
"name" : "POST /orders/submit",
"className" : "click.kamil.multi.core.OrderController",
"methodName" : "submitOrder",
"sourceFile" : "core-module/src/main/java/click/kamil/multi/core/OrderController.java",
"metadata" : {
"path" : "/orders/submit",
"verb" : "POST"
},
"parameters" : [ {
"name" : "orderId",
"type" : "String",
"annotations" : [ "RequestBody" ]
} ]
},
"methodChain" : [ "click.kamil.multi.core.OrderController.submitOrder" ],
"triggerPoint" : {
"event" : "SUBMIT",
"className" : "click.kamil.multi.core.OrderController",
"methodName" : "submitOrder",
"sourceFile" : "core-module/src/main/java/click/kamil/multi/core/OrderController.java",
"sourceModule" : null,
"stateMachineId" : null,
"lineNumber" : 18
}
} ],
"properties" : {
"default" : { }
}
},
"name" : "click.kamil.multi.core.OrderStateMachineConfig",
"renderChoicesAsDiamonds" : true,
"startStates" : [ "NEW" ],
"transitions" : [ {
"type" : "EXTERNAL",
"sourceStates" : [ {
"rawName" : "\"NEW\"",
"fullIdentifier" : "NEW"
} ],
"targetStates" : [ {
"rawName" : "\"PROCESSING\"",
"fullIdentifier" : "PROCESSING"
} ],
"event" : "SUBMIT",
"guard" : null,
"actions" : [ {
"expression" : "processAction()",
"isLambda" : false,
"internalLogic" : "@Override default void execute(StateContext<String,String> context){\n System.out.println(\"Processing order: \" + context.getMessageHeader(\"orderId\"));\n}\n",
"lineNumber" : 31,
"className" : "click.kamil.multi.core.OrderStateMachineConfig",
"sourceFile" : "core-module/src/main/java/click/kamil/multi/core/OrderStateMachineConfig.java"
} ],
"order" : null
}, {
"type" : "EXTERNAL",
"sourceStates" : [ {
"rawName" : "\"PROCESSING\"",
"fullIdentifier" : "PROCESSING"
} ],
"targetStates" : [ {
"rawName" : "\"COMPLETED\"",
"fullIdentifier" : "COMPLETED"
} ],
"event" : "FINISH",
"guard" : null,
"actions" : [ ],
"order" : null
} ],
"endStates" : [ "COMPLETED" ]
}

View File

@@ -1,32 +0,0 @@
@startuml
!pragma layout smetana
set separator none
hide empty description
hide stereotype
skinparam state {
BackgroundColor white
BorderColor #94a3b8
BorderThickness 1
FontName Inter
FontSize 9
FontStyle bold
RoundCorner 20
Padding 1
}
skinparam shadowing false
skinparam ArrowFontName JetBrains Mono
skinparam ArrowFontSize 8
skinparam ArrowColor #cbd5e1
skinparam ArrowThickness 1
skinparam dpi 110
skinparam svgLinkTarget _self
[*] --> NEW
NEW -[#1E90FF,bold]-> PROCESSING <<external>> <<e_SUBMIT>> : SUBMIT / processAction()
PROCESSING -[#1E90FF,bold]-> COMPLETED <<external>> <<e_FINISH>> : FINISH
COMPLETED --> [*]
@enduml

View File

@@ -4,19 +4,32 @@ import click.kamil.springstatemachineexporter.analysis.model.CallChain;
import click.kamil.springstatemachineexporter.analysis.model.EntryPoint;
import click.kamil.springstatemachineexporter.analysis.model.TriggerPoint;
import click.kamil.springstatemachineexporter.ast.common.CodebaseContext;
import lombok.RequiredArgsConstructor;
import click.kamil.springstatemachineexporter.analysis.resolver.ConstantResolver;
import lombok.extern.slf4j.Slf4j;
import org.eclipse.jdt.core.dom.*;
import java.util.*;
@Slf4j
@RequiredArgsConstructor
public class CallGraphBuilder {
private final CodebaseContext context;
private final ConstantResolver constantResolver;
private String currentMethodFqn;
private Map<String, List<CallEdge>> graph;
@lombok.Data
private static class CallEdge {
private final String targetMethod;
private final List<String> arguments;
}
public CallGraphBuilder(CodebaseContext context) {
this.context = context;
this.constantResolver = new ConstantResolver();
}
public List<CallChain> findChains(List<EntryPoint> entryPoints, List<TriggerPoint> triggers) {
Map<String, List<String>> callGraph = buildCallGraph();
Map<String, List<CallEdge>> callGraph = buildCallGraph();
List<CallChain> chains = new ArrayList<>();
for (EntryPoint ep : entryPoints) {
@@ -25,9 +38,10 @@ public class CallGraphBuilder {
String targetMethod = tp.getClassName() + "." + tp.getMethodName();
List<String> path = findPath(startMethod, targetMethod, callGraph, new HashSet<>());
if (path != null) {
TriggerPoint resolvedTp = resolveTriggerPointParameters(tp, path, callGraph);
chains.add(CallChain.builder()
.entryPoint(ep)
.triggerPoint(tp)
.triggerPoint(resolvedTp)
.methodChain(path)
.build());
}
@@ -36,12 +50,57 @@ public class CallGraphBuilder {
return chains;
}
private Map<String, List<String>> buildCallGraph() {
Map<String, List<String>> graph = new HashMap<>();
private TriggerPoint resolveTriggerPointParameters(TriggerPoint tp, List<String> path, Map<String, List<CallEdge>> callGraph) {
if (path.size() < 2) return tp;
String event = tp.getEvent();
if (event == null || event.isEmpty() || event.contains("\"")) return tp;
TypeDeclaration td = context.getTypeDeclaration(tp.getClassName());
if (td != null) {
MethodDeclaration md = context.findMethodDeclaration(td, tp.getMethodName(), true);
if (md != null) {
int paramIndex = -1;
for (int i = 0; i < md.parameters().size(); i++) {
SingleVariableDeclaration svd = (SingleVariableDeclaration) md.parameters().get(i);
if (svd.getName().getIdentifier().equals(event)) {
paramIndex = i;
break;
}
}
if (paramIndex >= 0) {
String caller = path.get(path.size() - 2);
String target = path.get(path.size() - 1);
List<CallEdge> edges = callGraph.get(caller);
if (edges != null) {
for (CallEdge edge : edges) {
if (edge.getTargetMethod().equals(target) || isHeuristicMatch(edge.getTargetMethod(), target)) {
if (paramIndex < edge.getArguments().size()) {
String resolvedValue = edge.getArguments().get(paramIndex);
if (resolvedValue != null) {
return TriggerPoint.builder()
.event(resolvedValue)
.className(tp.getClassName())
.methodName(tp.getMethodName())
.sourceFile(tp.getSourceFile())
.lineNumber(tp.getLineNumber())
.build();
}
}
}
}
}
}
}
}
return tp;
}
private Map<String, List<CallEdge>> buildCallGraph() {
graph = new HashMap<>();
for (CompilationUnit cu : context.getCompilationUnits()) {
cu.accept(new ASTVisitor() {
private String currentMethodFqn;
@Override
public boolean visit(MethodDeclaration node) {
TypeDeclaration td = findEnclosingType(node);
@@ -55,8 +114,31 @@ public class CallGraphBuilder {
public boolean visit(MethodInvocation node) {
if (currentMethodFqn != null) {
List<String> calledMethods = resolveCalledMethodsPolymorphic(node);
List<String> args = resolveArguments(node.arguments());
for (String calledMethod : calledMethods) {
graph.computeIfAbsent(currentMethodFqn, k -> new ArrayList<>()).add(calledMethod);
graph.computeIfAbsent(currentMethodFqn, k -> new ArrayList<>()).add(new CallEdge(calledMethod, args));
}
}
return super.visit(node);
}
@Override
public boolean visit(SuperMethodInvocation node) {
if (currentMethodFqn != null) {
String methodName = node.getName().getIdentifier();
TypeDeclaration td = findEnclosingType(node);
if (td != null) {
String superFqn = context.getSuperclassFqn(td);
if (superFqn != null) {
TypeDeclaration superTd = context.getTypeDeclaration(superFqn);
if (superTd != null) {
String calledMethod = resolveMethodInType(superTd, methodName);
if (calledMethod != null) {
List<String> args = resolveArguments(node.arguments());
graph.computeIfAbsent(currentMethodFqn, k -> new ArrayList<>()).add(new CallEdge(calledMethod, args));
}
}
}
}
}
return super.visit(node);
@@ -66,6 +148,19 @@ public class CallGraphBuilder {
return graph;
}
private List<String> resolveArguments(List<?> astArguments) {
List<String> args = new ArrayList<>();
for (Object argObj : astArguments) {
Expression expr = (Expression) argObj;
String val = constantResolver.resolve(expr, context);
if (val == null && expr instanceof SimpleName sn) {
val = sn.getIdentifier();
}
args.add(val);
}
return args;
}
private List<String> resolveCalledMethodsPolymorphic(MethodInvocation node) {
String baseCalled = resolveCalledMethod(node);
if (baseCalled == null) return Collections.emptyList();
@@ -73,7 +168,6 @@ public class CallGraphBuilder {
List<String> allResolved = new ArrayList<>();
allResolved.add(baseCalled);
// Polymorphic fan-out
if (baseCalled.contains(".")) {
String className = baseCalled.substring(0, baseCalled.lastIndexOf('.'));
String methodName = baseCalled.substring(baseCalled.lastIndexOf('.') + 1);
@@ -92,39 +186,43 @@ public class CallGraphBuilder {
String methodName = node.getName().getIdentifier();
if (receiver == null) {
// Local call or static import (simplified)
TypeDeclaration td = findEnclosingType(node);
return td != null ? context.getFqn(td) + "." + methodName : null;
if (td != null) {
return resolveMethodInType(td, methodName);
}
return null;
}
// Try to resolve receiver type
// This is a simplified resolution without full JDT bindings.
// It works for local variables and fields within the same project.
ITypeBinding binding = receiver.resolveTypeBinding();
if (binding != null) {
return binding.getQualifiedName() + "." + methodName;
}
// Fallback: heuristic resolution for simple cases like 'orderService.process()'
if (receiver instanceof SimpleName sn) {
String receiverName = sn.getIdentifier();
// Look for fields or variables (simplified)
// For now, we'll return a "best guess" if we can't resolve it perfectly
// In a real implementation, we'd use JDT bindings more heavily.
return receiverName + "." + methodName;
}
return null;
}
private List<String> findPath(String start, String target, Map<String, List<String>> graph, Set<String> visited) {
private String resolveMethodInType(TypeDeclaration td, String methodName) {
MethodDeclaration md = context.findMethodDeclaration(td, methodName, true);
if (md != null) {
TypeDeclaration declaringTd = findEnclosingType(md);
return context.getFqn(declaringTd) + "." + methodName;
}
return null;
}
private List<String> findPath(String start, String target, Map<String, List<CallEdge>> graph, Set<String> visited) {
if (start.equals(target)) return new ArrayList<>(List.of(start));
if (!visited.add(start)) return null;
List<String> neighbors = graph.get(start);
List<CallEdge> neighbors = graph.get(start);
if (neighbors != null) {
for (String neighbor : neighbors) {
// Heuristic: neighbor might be 'orderService.process' while target is 'click.kamil...OrderService.process'
for (CallEdge edge : neighbors) {
String neighbor = edge.getTargetMethod();
if (neighbor.equals(target) || isHeuristicMatch(neighbor, target)) {
return new ArrayList<>(List.of(start, target));
}
@@ -139,14 +237,10 @@ public class CallGraphBuilder {
}
private boolean isHeuristicMatch(String neighbor, String target) {
// Match 'orderService.process' with 'click.kamil.OrderService.process'
if (target.endsWith("." + neighbor)) return true;
// Match simple names if we don't have FQN
String simpleTarget = target.contains(".") ? target.substring(target.lastIndexOf('.') + 1) : target;
String simpleNeighbor = neighbor.contains(".") ? neighbor.substring(neighbor.lastIndexOf('.') + 1) : neighbor;
// Very basic heuristic for now
return neighbor.toLowerCase().contains(simpleTarget.toLowerCase()) || target.toLowerCase().contains(simpleNeighbor.toLowerCase());
return simpleNeighbor.equals(simpleTarget);
}
private TypeDeclaration findEnclosingType(ASTNode node) {

View File

@@ -21,7 +21,11 @@ public class GenericEventDetector {
public List<TriggerPoint> detect(CompilationUnit cu) {
List<TriggerPoint> triggers = new ArrayList<>();
String fileName = cu.getJavaElement() != null ? cu.getJavaElement().getElementName() : "unknown";
String fileName = "unknown";
try {
if (cu.getJavaElement() != null) fileName = cu.getJavaElement().getElementName();
} catch (Exception e) {}
log.debug("Scanning for triggers in {}", fileName);
cu.accept(new ASTVisitor() {
@@ -29,12 +33,10 @@ public class GenericEventDetector {
public boolean visit(MethodInvocation node) {
String methodName = node.getName().getIdentifier();
// 1. Core sendEvent
if ("sendEvent".equals(methodName)) {
processSendEvent(node, cu, triggers);
}
// 2. Library Hints
processHints(node, cu, triggers);
return super.visit(node);
@@ -44,10 +46,9 @@ public class GenericEventDetector {
}
private void processSendEvent(MethodInvocation node, CompilationUnit cu, List<TriggerPoint> triggers) {
log.info("Found potential trigger: {}", node);
TriggerPoint trigger = buildTriggerPoint(node, cu, null);
if (trigger != null) {
log.info("Successfully built trigger point: {}", trigger.getEvent());
log.debug("Successfully built trigger point: {}", trigger.getEvent());
triggers.add(trigger);
}
}
@@ -58,14 +59,11 @@ public class GenericEventDetector {
String calledMethod = resolveCalledMethodName(node);
if (calledMethod == null) return;
log.info("Checking method call '{}' against {} hints", calledMethod, hints.size());
for (LibraryHint hint : hints) {
if (calledMethod.equals(hint.getMethodFqn()) || isHintMatch(calledMethod, hint.getMethodFqn())) {
log.info("MATCH! Found hint for '{}'", calledMethod);
TriggerPoint trigger = buildTriggerPoint(node, cu, hint.getEvent());
if (trigger != null) {
log.info("Successfully built synthetic trigger point from hint: {}", trigger.getEvent());
log.debug("Successfully built synthetic trigger point from hint: {}", trigger.getEvent());
triggers.add(trigger);
}
}
@@ -104,15 +102,20 @@ public class GenericEventDetector {
}
private TriggerPoint buildTriggerPoint(MethodInvocation node, CompilationUnit cu, String forcedEvent) {
String eventValue;
String eventValue = null;
if (forcedEvent != null) {
eventValue = forcedEvent;
eventValue = context.resolveString(forcedEvent);
} else {
if (node.arguments().isEmpty()) return null;
Expression eventExpr = (Expression) node.arguments().get(0);
eventValue = constantResolver.resolve(eventExpr, context);
if (eventValue == null) {
eventValue = eventExpr.toString();
// Try MessageBuilder extraction first
eventValue = extractEventFromMessageBuilder(eventExpr);
if (eventValue != null) {
eventValue = context.resolveString(eventValue);
} else {
eventValue = context.resolveExpression(eventExpr);
}
}
@@ -130,6 +133,35 @@ public class GenericEventDetector {
.build();
}
private String extractEventFromMessageBuilder(Expression expr) {
if (!(expr instanceof MethodInvocation mi)) return null;
// Trace back chain: MessageBuilder.withPayload(event).setHeader(...).build()
MethodInvocation current = mi;
while (current != null) {
String name = current.getName().getIdentifier();
if ("withPayload".equals(name) && !current.arguments().isEmpty()) {
Expression payloadExpr = (Expression) current.arguments().get(0);
String resolved = constantResolver.resolve(payloadExpr, context);
if (resolved != null) return resolved;
// If not a constant, it might be a parameter like 'event'
if (payloadExpr instanceof SimpleName sn) {
return sn.getIdentifier(); // Return the parameter name so the call graph can fill it
}
return payloadExpr.toString();
}
Expression receiver = current.getExpression();
if (receiver instanceof MethodInvocation nextMi) {
current = nextMi;
} else {
current = null;
}
}
return null;
}
private MethodDeclaration findEnclosingMethod(ASTNode node) {
ASTNode parent = node.getParent();
while (parent != null && !(parent instanceof MethodDeclaration)) {

View File

@@ -1,7 +1,6 @@
package click.kamil.springstatemachineexporter.analysis.service;
import click.kamil.springstatemachineexporter.analysis.model.EntryPoint;
import click.kamil.springstatemachineexporter.analysis.resolver.ConstantResolver;
import click.kamil.springstatemachineexporter.ast.common.CodebaseContext;
import lombok.RequiredArgsConstructor;
import org.eclipse.jdt.core.dom.*;
@@ -14,7 +13,6 @@ import java.util.Map;
@RequiredArgsConstructor
public class MessagingDetector {
private final CodebaseContext context;
private final ConstantResolver constantResolver = new ConstantResolver();
public List<EntryPoint> detect(CompilationUnit cu) {
List<EntryPoint> entryPoints = new ArrayList<>();
@@ -99,13 +97,11 @@ public class MessagingDetector {
if (value instanceof ArrayInitializer ai) {
List<String> values = new ArrayList<>();
for (Object o : ai.expressions()) {
String resolved = constantResolver.resolve((Expression) o, context);
values.add(resolved != null ? resolved : o.toString());
values.add(context.resolveExpression((Expression) o));
}
return String.join(", ", values);
}
String resolved = constantResolver.resolve(value, context);
return resolved != null ? resolved : value.toString();
return context.resolveExpression(value);
}
return "unknown";
}

View File

@@ -44,13 +44,7 @@ public class SpringMvcDetector {
String verb = getHttpVerb(name);
if (verb != null && !call.arguments().isEmpty()) {
Expression pathArg = (Expression) call.arguments().get(0);
String path = constantResolver.resolve(pathArg, context);
if (path != null) {
path = context.resolveString(path);
} else {
path = pathArg.toString().replaceAll("\"", "");
path = context.resolveString(path);
}
String path = context.resolveExpression(pathArg);
entryPoints.add(EntryPoint.builder()
.type(EntryPoint.Type.REST)
@@ -224,11 +218,7 @@ public class SpringMvcDetector {
}
if (value != null) {
String resolved = constantResolver.resolve(value, context);
if (resolved == null) {
resolved = value.toString().replaceAll("^\"|\"$", "");
}
return context.resolveString(resolved);
return context.resolveExpression(value);
}
return "";
}

View File

@@ -114,6 +114,17 @@ public class CodebaseContext {
return PlaceholderResolver.resolve(input, merged);
}
public String resolveExpression(Expression expr) {
if (expr == null) return null;
String astResolved = constantResolver.resolve(expr, this);
if (astResolved == null) {
astResolved = expr.toString().replaceAll("^\"|\"$", "");
}
return resolveString(astResolved);
}
public TypeDeclaration resolveStaticImport(String memberName, CompilationUnit contextCu) {
if (contextCu == null) return null;
@@ -416,6 +427,57 @@ public class CodebaseContext {
return getTypeDeclaration(name);
}
public String getSuperclassFqn(TypeDeclaration td) {
Type superType = td.getSuperclassType();
if (superType == null) return null;
String superName = extractTypeName(superType);
CompilationUnit cu = (CompilationUnit) td.getRoot();
TypeDeclaration superTd = getTypeDeclaration(superName, cu);
return superTd != null ? getFqn(superTd) : superName;
}
private String extractTypeName(Type type) {
if (type.isParameterizedType()) {
return extractTypeName(((ParameterizedType) type).getType());
} else if (type.isSimpleType()) {
return ((SimpleType) type).getName().getFullyQualifiedName();
} else if (type.isQualifiedType()) {
return ((QualifiedType) type).getName().getFullyQualifiedName();
}
return type.toString();
}
public MethodDeclaration findMethodDeclaration(TypeDeclaration td, String methodName, boolean includeSuper) {
for (MethodDeclaration method : td.getMethods()) {
if (method.getName().getIdentifier().equals(methodName)) {
return method;
}
}
if (includeSuper) {
String superFqn = getSuperclassFqn(td);
if (superFqn != null) {
TypeDeclaration superTd = getTypeDeclaration(superFqn);
if (superTd != null) {
return findMethodDeclaration(superTd, methodName, true);
}
}
// Check interfaces
for (Object interfaceTypeObj : td.superInterfaceTypes()) {
Type interfaceType = (Type) interfaceTypeObj;
String interfaceName = extractTypeName(interfaceType);
TypeDeclaration interfaceTd = getTypeDeclaration(interfaceName, (CompilationUnit) td.getRoot());
if (interfaceTd != null) {
MethodDeclaration found = findMethodDeclaration(interfaceTd, methodName, true);
if (found != null) return found;
}
}
}
return null;
}
public String getFqn(TypeDeclaration td) {
StringBuilder sb = new StringBuilder(td.getName().getIdentifier());
ASTNode current = td.getParent();

View File

@@ -0,0 +1,90 @@
package click.kamil.springstatemachineexporter.analysis;
import click.kamil.springstatemachineexporter.analysis.model.CallChain;
import click.kamil.springstatemachineexporter.analysis.model.EntryPoint;
import click.kamil.springstatemachineexporter.analysis.model.TriggerPoint;
import click.kamil.springstatemachineexporter.analysis.resolver.ConstantResolver;
import click.kamil.springstatemachineexporter.analysis.service.CallGraphBuilder;
import click.kamil.springstatemachineexporter.analysis.service.GenericEventDetector;
import click.kamil.springstatemachineexporter.analysis.service.SpringMvcDetector;
import click.kamil.springstatemachineexporter.ast.common.CodebaseContext;
import org.eclipse.jdt.core.dom.CompilationUnit;
import org.eclipse.jdt.core.dom.TypeDeclaration;
import org.junit.jupiter.api.Test;
import org.junit.jupiter.api.io.TempDir;
import java.io.IOException;
import java.nio.file.Files;
import java.nio.file.Path;
import java.util.List;
import static org.assertj.core.api.Assertions.assertThat;
public class InheritedEventDetectionTest {
@Test
void testInheritedMessageBuilderEvent(@TempDir Path tempDir) throws IOException {
Path srcDir = tempDir.resolve("src/main/java/com/example");
Files.createDirectories(srcDir);
// 1. Abstract Base Controller with protected method using MessageBuilder
Files.writeString(srcDir.resolve("BaseController.java"),
"package com.example;\n" +
"import org.springframework.messaging.support.MessageBuilder;\n" +
"import org.springframework.statemachine.StateMachine;\n" +
"public abstract class BaseController {\n" +
" protected StateMachine<String, String> stateMachine;\n" +
" \n" +
" protected void send(String event) {\n" +
" stateMachine.sendEvent(MessageBuilder.withPayload(event).build());\n" +
" }\n" +
"}");
// 2. Child Controller calling super.send()
Files.writeString(srcDir.resolve("ChildController.java"),
"package com.example;\n" +
"import org.springframework.web.bind.annotation.*;\n" +
"@RestController\n" +
"public class ChildController extends BaseController {\n" +
" \n" +
" @GetMapping(\"/trigger\")\n" +
" public void trigger() {\n" +
" super.send(\"MY_EVENT\");\n" +
" }\n" +
"}");
CodebaseContext context = new CodebaseContext();
context.scan(tempDir);
// Detect Entry Points
SpringMvcDetector mvcDetector = new SpringMvcDetector(context, new ConstantResolver());
TypeDeclaration childTd = context.getTypeDeclaration("com.example.ChildController");
CompilationUnit childCu = (CompilationUnit) childTd.getRoot();
List<EntryPoint> entryPoints = mvcDetector.detect(childCu);
assertThat(entryPoints).hasSize(1);
EntryPoint ep = entryPoints.get(0);
// Detect Trigger Points
GenericEventDetector eventDetector = new GenericEventDetector(context, new ConstantResolver(), List.of());
TypeDeclaration baseTd = context.getTypeDeclaration("com.example.BaseController");
CompilationUnit baseCu = (CompilationUnit) baseTd.getRoot();
List<TriggerPoint> triggers = eventDetector.detect(baseCu);
assertThat(triggers).describedAs("Should detect sendEvent in BaseController").hasSize(1);
TriggerPoint tp = triggers.get(0);
assertThat(tp.getEvent()).isEqualTo("event");
// Build Call Chains
CallGraphBuilder callGraphBuilder = new CallGraphBuilder(context);
List<CallChain> chains = callGraphBuilder.findChains(entryPoints, triggers);
assertThat(chains).describedAs("Should link ChildController.trigger to BaseController.send").hasSize(1);
CallChain chain = chains.get(0);
assertThat(chain.getMethodChain()).containsExactly(
"com.example.ChildController.trigger",
"com.example.BaseController.send"
);
assertThat(chain.getTriggerPoint().getEvent()).isEqualTo("MY_EVENT");
}
}

View File

@@ -1,614 +0,0 @@
{
"metadata" : {
"triggers" : [ ],
"entryPoints" : [ ],
"callChains" : [ ],
"properties" : {
"default" : {
"spring.application.name" : "statemachinedemo"
}
}
},
"name" : "click.kamil.examples.statemachine.complex.ComplexStateMachineConfig",
"renderChoicesAsDiamonds" : true,
"startStates" : [ "States.STATE1" ],
"transitions" : [ {
"type" : "EXTERNAL",
"sourceStates" : [ {
"rawName" : "States.STATE1",
"fullIdentifier" : "States.STATE1"
} ],
"targetStates" : [ {
"rawName" : "States.STATE2",
"fullIdentifier" : "States.STATE2"
} ],
"event" : "Events.EVENT1",
"guard" : null,
"actions" : [ ],
"order" : null
}, {
"type" : "EXTERNAL",
"sourceStates" : [ {
"rawName" : "States.STATE2",
"fullIdentifier" : "States.STATE2"
} ],
"targetStates" : [ {
"rawName" : "States.STATE3",
"fullIdentifier" : "States.STATE3"
} ],
"event" : "Events.EVENT2",
"guard" : null,
"actions" : [ ],
"order" : null
}, {
"type" : "EXTERNAL",
"sourceStates" : [ {
"rawName" : "States.STATE3",
"fullIdentifier" : "States.STATE3"
} ],
"targetStates" : [ {
"rawName" : "States.STATE4",
"fullIdentifier" : "States.STATE4"
} ],
"event" : "Events.EVENT3",
"guard" : null,
"actions" : [ ],
"order" : null
}, {
"type" : "EXTERNAL",
"sourceStates" : [ {
"rawName" : "States.STATE4",
"fullIdentifier" : "States.STATE4"
} ],
"targetStates" : [ {
"rawName" : "States.STATE5",
"fullIdentifier" : "States.STATE5"
} ],
"event" : "Events.EVENT4",
"guard" : null,
"actions" : [ ],
"order" : null
}, {
"type" : "EXTERNAL",
"sourceStates" : [ {
"rawName" : "States.STATE5",
"fullIdentifier" : "States.STATE5"
} ],
"targetStates" : [ {
"rawName" : "States.STATE6",
"fullIdentifier" : "States.STATE6"
} ],
"event" : "Events.EVENT5",
"guard" : null,
"actions" : [ ],
"order" : null
}, {
"type" : "EXTERNAL",
"sourceStates" : [ {
"rawName" : "States.STATE6",
"fullIdentifier" : "States.STATE6"
} ],
"targetStates" : [ {
"rawName" : "States.STATE7",
"fullIdentifier" : "States.STATE7"
} ],
"event" : "Events.EVENT6",
"guard" : null,
"actions" : [ ],
"order" : null
}, {
"type" : "EXTERNAL",
"sourceStates" : [ {
"rawName" : "States.STATE7",
"fullIdentifier" : "States.STATE7"
} ],
"targetStates" : [ {
"rawName" : "States.STATE8",
"fullIdentifier" : "States.STATE8"
} ],
"event" : "Events.EVENT7",
"guard" : null,
"actions" : [ ],
"order" : null
}, {
"type" : "EXTERNAL",
"sourceStates" : [ {
"rawName" : "States.STATE8",
"fullIdentifier" : "States.STATE8"
} ],
"targetStates" : [ {
"rawName" : "States.STATE9",
"fullIdentifier" : "States.STATE9"
} ],
"event" : "Events.EVENT8",
"guard" : null,
"actions" : [ ],
"order" : null
}, {
"type" : "EXTERNAL",
"sourceStates" : [ {
"rawName" : "States.STATE9",
"fullIdentifier" : "States.STATE9"
} ],
"targetStates" : [ {
"rawName" : "States.STATE10",
"fullIdentifier" : "States.STATE10"
} ],
"event" : "Events.EVENT9",
"guard" : null,
"actions" : [ ],
"order" : null
}, {
"type" : "EXTERNAL",
"sourceStates" : [ {
"rawName" : "States.STATE10",
"fullIdentifier" : "States.STATE10"
} ],
"targetStates" : [ {
"rawName" : "States.STATE11",
"fullIdentifier" : "States.STATE11"
} ],
"event" : "Events.EVENT10",
"guard" : null,
"actions" : [ ],
"order" : null
}, {
"type" : "EXTERNAL",
"sourceStates" : [ {
"rawName" : "States.STATE11",
"fullIdentifier" : "States.STATE11"
} ],
"targetStates" : [ {
"rawName" : "States.STATE12",
"fullIdentifier" : "States.STATE12"
} ],
"event" : "Events.EVENT11",
"guard" : null,
"actions" : [ ],
"order" : null
}, {
"type" : "EXTERNAL",
"sourceStates" : [ {
"rawName" : "States.STATE12",
"fullIdentifier" : "States.STATE12"
} ],
"targetStates" : [ {
"rawName" : "States.STATE13",
"fullIdentifier" : "States.STATE13"
} ],
"event" : "Events.EVENT12",
"guard" : null,
"actions" : [ ],
"order" : null
}, {
"type" : "EXTERNAL",
"sourceStates" : [ {
"rawName" : "States.STATE13",
"fullIdentifier" : "States.STATE13"
} ],
"targetStates" : [ {
"rawName" : "States.STATE14",
"fullIdentifier" : "States.STATE14"
} ],
"event" : "Events.EVENT13",
"guard" : null,
"actions" : [ ],
"order" : null
}, {
"type" : "EXTERNAL",
"sourceStates" : [ {
"rawName" : "States.STATE14",
"fullIdentifier" : "States.STATE14"
} ],
"targetStates" : [ {
"rawName" : "States.STATE15",
"fullIdentifier" : "States.STATE15"
} ],
"event" : "Events.EVENT14",
"guard" : null,
"actions" : [ ],
"order" : null
}, {
"type" : "EXTERNAL",
"sourceStates" : [ {
"rawName" : "States.STATE15",
"fullIdentifier" : "States.STATE15"
} ],
"targetStates" : [ {
"rawName" : "States.STATE16",
"fullIdentifier" : "States.STATE16"
} ],
"event" : "Events.EVENT15",
"guard" : null,
"actions" : [ ],
"order" : null
}, {
"type" : "CHOICE",
"sourceStates" : [ {
"rawName" : "States.STATE16",
"fullIdentifier" : "States.STATE16"
} ],
"targetStates" : [ {
"rawName" : "States.STATE17",
"fullIdentifier" : "States.STATE17"
} ],
"event" : null,
"guard" : {
"expression" : "guardVarEquals(\"value1\")",
"isLambda" : false,
"internalLogic" : null,
"lineNumber" : 86
},
"actions" : [ ],
"order" : 0
}, {
"type" : "CHOICE",
"sourceStates" : [ {
"rawName" : "States.STATE16",
"fullIdentifier" : "States.STATE16"
} ],
"targetStates" : [ {
"rawName" : "States.STATE18",
"fullIdentifier" : "States.STATE18"
} ],
"event" : null,
"guard" : {
"expression" : "guardVarEquals(\"value2\")",
"isLambda" : false,
"internalLogic" : null,
"lineNumber" : 87
},
"actions" : [ ],
"order" : 1
}, {
"type" : "CHOICE",
"sourceStates" : [ {
"rawName" : "States.STATE16",
"fullIdentifier" : "States.STATE16"
} ],
"targetStates" : [ {
"rawName" : "States.STATE19",
"fullIdentifier" : "States.STATE19"
} ],
"event" : null,
"guard" : null,
"actions" : [ ],
"order" : 2
}, {
"type" : "CHOICE",
"sourceStates" : [ {
"rawName" : "States.STATE17",
"fullIdentifier" : "States.STATE17"
} ],
"targetStates" : [ {
"rawName" : "States.STATE20",
"fullIdentifier" : "States.STATE20"
} ],
"event" : null,
"guard" : {
"expression" : "guardEventHeaderEquals(\"header1\",\"foo\")",
"isLambda" : false,
"internalLogic" : null,
"lineNumber" : 92
},
"actions" : [ ],
"order" : 0
}, {
"type" : "CHOICE",
"sourceStates" : [ {
"rawName" : "States.STATE17",
"fullIdentifier" : "States.STATE17"
} ],
"targetStates" : [ {
"rawName" : "States.STATE16",
"fullIdentifier" : "States.STATE16"
} ],
"event" : null,
"guard" : null,
"actions" : [ ],
"order" : 1
}, {
"type" : "CHOICE",
"sourceStates" : [ {
"rawName" : "States.STATE18",
"fullIdentifier" : "States.STATE18"
} ],
"targetStates" : [ {
"rawName" : "States.STATE19",
"fullIdentifier" : "States.STATE19"
} ],
"event" : null,
"guard" : {
"expression" : "guardVarEquals(\"value3\")",
"isLambda" : false,
"internalLogic" : null,
"lineNumber" : 97
},
"actions" : [ ],
"order" : 0
}, {
"type" : "CHOICE",
"sourceStates" : [ {
"rawName" : "States.STATE18",
"fullIdentifier" : "States.STATE18"
} ],
"targetStates" : [ {
"rawName" : "States.STATE20",
"fullIdentifier" : "States.STATE20"
} ],
"event" : null,
"guard" : null,
"actions" : [ ],
"order" : 1
}, {
"type" : "CHOICE",
"sourceStates" : [ {
"rawName" : "States.STATE19",
"fullIdentifier" : "States.STATE19"
} ],
"targetStates" : [ {
"rawName" : "States.STATE1",
"fullIdentifier" : "States.STATE1"
} ],
"event" : null,
"guard" : {
"expression" : "guardVarEquals(\"reset\")",
"isLambda" : false,
"internalLogic" : null,
"lineNumber" : 102
},
"actions" : [ ],
"order" : 0
}, {
"type" : "CHOICE",
"sourceStates" : [ {
"rawName" : "States.STATE19",
"fullIdentifier" : "States.STATE19"
} ],
"targetStates" : [ {
"rawName" : "States.STATE20",
"fullIdentifier" : "States.STATE20"
} ],
"event" : null,
"guard" : null,
"actions" : [ ],
"order" : 1
}, {
"type" : "CHOICE",
"sourceStates" : [ {
"rawName" : "States.STATE20",
"fullIdentifier" : "States.STATE20"
} ],
"targetStates" : [ {
"rawName" : "States.STATE5",
"fullIdentifier" : "States.STATE5"
} ],
"event" : null,
"guard" : {
"expression" : "guardEventHeaderEquals(\"header2\",\"bar\")",
"isLambda" : false,
"internalLogic" : null,
"lineNumber" : 107
},
"actions" : [ ],
"order" : 0
}, {
"type" : "CHOICE",
"sourceStates" : [ {
"rawName" : "States.STATE20",
"fullIdentifier" : "States.STATE20"
} ],
"targetStates" : [ {
"rawName" : "States.STATE1",
"fullIdentifier" : "States.STATE1"
} ],
"event" : null,
"guard" : null,
"actions" : [ ],
"order" : 1
}, {
"type" : "CHOICE",
"sourceStates" : [ {
"rawName" : "States.STATE11",
"fullIdentifier" : "States.STATE11"
} ],
"targetStates" : [ {
"rawName" : "States.STATE13",
"fullIdentifier" : "States.STATE13"
} ],
"event" : null,
"guard" : {
"expression" : "guardVarEquals(\"goTo13\")",
"isLambda" : false,
"internalLogic" : null,
"lineNumber" : 112
},
"actions" : [ ],
"order" : 0
}, {
"type" : "CHOICE",
"sourceStates" : [ {
"rawName" : "States.STATE11",
"fullIdentifier" : "States.STATE11"
} ],
"targetStates" : [ {
"rawName" : "States.STATE14",
"fullIdentifier" : "States.STATE14"
} ],
"event" : null,
"guard" : {
"expression" : "guardVarEquals(\"goTo14\")",
"isLambda" : false,
"internalLogic" : null,
"lineNumber" : 113
},
"actions" : [ ],
"order" : 1
}, {
"type" : "CHOICE",
"sourceStates" : [ {
"rawName" : "States.STATE11",
"fullIdentifier" : "States.STATE11"
} ],
"targetStates" : [ {
"rawName" : "States.STATE15",
"fullIdentifier" : "States.STATE15"
} ],
"event" : null,
"guard" : null,
"actions" : [ ],
"order" : 2
}, {
"type" : "CHOICE",
"sourceStates" : [ {
"rawName" : "States.STATE12",
"fullIdentifier" : "States.STATE12"
} ],
"targetStates" : [ {
"rawName" : "States.STATE10",
"fullIdentifier" : "States.STATE10"
} ],
"event" : null,
"guard" : {
"expression" : "guardVarEquals(\"goBack10\")",
"isLambda" : false,
"internalLogic" : null,
"lineNumber" : 118
},
"actions" : [ ],
"order" : 0
}, {
"type" : "CHOICE",
"sourceStates" : [ {
"rawName" : "States.STATE12",
"fullIdentifier" : "States.STATE12"
} ],
"targetStates" : [ {
"rawName" : "States.STATE11",
"fullIdentifier" : "States.STATE11"
} ],
"event" : null,
"guard" : null,
"actions" : [ ],
"order" : 1
}, {
"type" : "CHOICE",
"sourceStates" : [ {
"rawName" : "States.STATE14",
"fullIdentifier" : "States.STATE14"
} ],
"targetStates" : [ {
"rawName" : "States.STATE12",
"fullIdentifier" : "States.STATE12"
} ],
"event" : null,
"guard" : {
"expression" : "guardVarEquals(\"loop12\")",
"isLambda" : false,
"internalLogic" : null,
"lineNumber" : 123
},
"actions" : [ ],
"order" : 0
}, {
"type" : "CHOICE",
"sourceStates" : [ {
"rawName" : "States.STATE14",
"fullIdentifier" : "States.STATE14"
} ],
"targetStates" : [ {
"rawName" : "States.STATE16",
"fullIdentifier" : "States.STATE16"
} ],
"event" : null,
"guard" : null,
"actions" : [ ],
"order" : 1
}, {
"type" : "CHOICE",
"sourceStates" : [ {
"rawName" : "States.STATE9",
"fullIdentifier" : "States.STATE9"
} ],
"targetStates" : [ {
"rawName" : "States.STATE8",
"fullIdentifier" : "States.STATE8"
} ],
"event" : null,
"guard" : {
"expression" : "guardVarEquals(\"stepBack\")",
"isLambda" : false,
"internalLogic" : null,
"lineNumber" : 128
},
"actions" : [ ],
"order" : 0
}, {
"type" : "CHOICE",
"sourceStates" : [ {
"rawName" : "States.STATE9",
"fullIdentifier" : "States.STATE9"
} ],
"targetStates" : [ {
"rawName" : "States.STATE7",
"fullIdentifier" : "States.STATE7"
} ],
"event" : null,
"guard" : {
"expression" : "guardVarEquals(\"stepBackMore\")",
"isLambda" : false,
"internalLogic" : null,
"lineNumber" : 129
},
"actions" : [ ],
"order" : 1
}, {
"type" : "CHOICE",
"sourceStates" : [ {
"rawName" : "States.STATE9",
"fullIdentifier" : "States.STATE9"
} ],
"targetStates" : [ {
"rawName" : "States.STATE6",
"fullIdentifier" : "States.STATE6"
} ],
"event" : null,
"guard" : null,
"actions" : [ ],
"order" : 2
}, {
"type" : "CHOICE",
"sourceStates" : [ {
"rawName" : "States.STATE8",
"fullIdentifier" : "States.STATE8"
} ],
"targetStates" : [ {
"rawName" : "States.STATE9",
"fullIdentifier" : "States.STATE9"
} ],
"event" : null,
"guard" : {
"expression" : "guardVarEquals(\"forward9\")",
"isLambda" : false,
"internalLogic" : null,
"lineNumber" : 134
},
"actions" : [ ],
"order" : 0
}, {
"type" : "CHOICE",
"sourceStates" : [ {
"rawName" : "States.STATE8",
"fullIdentifier" : "States.STATE8"
} ],
"targetStates" : [ {
"rawName" : "States.STATE10",
"fullIdentifier" : "States.STATE10"
} ],
"event" : null,
"guard" : null,
"actions" : [ ],
"order" : 1
} ],
"endStates" : [ ]
}

View File

@@ -1,390 +0,0 @@
{
"metadata" : {
"triggers" : [ {
"event" : "AUDIT_EVENT",
"className" : "click.kamil.examples.enterprise.api.SecurityInterceptor",
"methodName" : "preHandle",
"sourceModule" : null,
"stateMachineId" : null,
"lineNumber" : 17
}, {
"event" : "PLACE_ORDER",
"className" : "click.kamil.examples.enterprise.service.OrderServiceImpl",
"methodName" : "place",
"sourceModule" : null,
"stateMachineId" : null,
"lineNumber" : 16
}, {
"event" : "CANCEL_ORDER",
"className" : "click.kamil.examples.enterprise.service.OrderServiceImpl",
"methodName" : "cancel",
"sourceModule" : null,
"stateMachineId" : null,
"lineNumber" : 21
}, {
"event" : "PAY_ORDER",
"className" : "click.kamil.examples.enterprise.service.ReactivePaymentService",
"methodName" : "processPayment",
"sourceModule" : null,
"stateMachineId" : null,
"lineNumber" : 18
}, {
"event" : "SHIP_ORDER",
"className" : "click.kamil.examples.enterprise.messaging.ShippingJmsListener",
"methodName" : "onShippingReady",
"sourceModule" : null,
"stateMachineId" : null,
"lineNumber" : 17
}, {
"event" : "RETURN_ORDER",
"className" : "click.kamil.examples.enterprise.messaging.ReturnsRabbitListener",
"methodName" : "onReturn",
"sourceModule" : null,
"stateMachineId" : null,
"lineNumber" : 17
} ],
"entryPoints" : [ {
"type" : "REST",
"name" : "POST /api/enterprise/orders/place",
"className" : "click.kamil.examples.enterprise.api.OrderController",
"methodName" : "placeOrder",
"metadata" : {
"path" : "/api/enterprise/orders/place",
"verb" : "POST"
},
"parameters" : [ ]
}, {
"type" : "REST",
"name" : "POST /api/enterprise/orders/{id}/cancel",
"className" : "click.kamil.examples.enterprise.api.OrderController",
"methodName" : "cancelOrder",
"metadata" : {
"path" : "/api/enterprise/orders/{id}/cancel",
"verb" : "POST"
},
"parameters" : [ {
"name" : "id",
"type" : "String",
"annotations" : [ "PathVariable" ]
} ]
}, {
"type" : "CUSTOM",
"name" : "INTERCEPTOR: SecurityInterceptor.preHandle",
"className" : "click.kamil.examples.enterprise.api.SecurityInterceptor",
"methodName" : "preHandle",
"metadata" : {
"interceptorType" : "Spring MVC Interceptor"
},
"parameters" : [ ]
}, {
"type" : "REST",
"name" : "POST /api/enterprise/payments",
"className" : "click.kamil.examples.enterprise.api.ReactivePaymentController",
"methodName" : "pay",
"metadata" : {
"path" : "/api/enterprise/payments",
"verb" : "POST"
},
"parameters" : [ {
"name" : "orderId",
"type" : "String",
"annotations" : [ "RequestBody" ]
} ]
}, {
"type" : "JMS",
"name" : "JMS: shipping.queue",
"className" : "click.kamil.examples.enterprise.messaging.ShippingJmsListener",
"methodName" : "onShippingReady",
"metadata" : {
"protocol" : "JMS",
"destination" : "shipping.queue"
},
"parameters" : [ {
"name" : "orderId",
"type" : "String",
"annotations" : [ ]
} ]
}, {
"type" : "RABBIT",
"name" : "RABBIT: returns.queue",
"className" : "click.kamil.examples.enterprise.messaging.ReturnsRabbitListener",
"methodName" : "onReturn",
"metadata" : {
"protocol" : "RABBIT",
"destination" : "returns.queue"
},
"parameters" : [ {
"name" : "orderId",
"type" : "String",
"annotations" : [ ]
} ]
} ],
"callChains" : [ {
"entryPoint" : {
"type" : "REST",
"name" : "POST /api/enterprise/orders/place",
"className" : "click.kamil.examples.enterprise.api.OrderController",
"methodName" : "placeOrder",
"metadata" : {
"path" : "/api/enterprise/orders/place",
"verb" : "POST"
},
"parameters" : [ ]
},
"methodChain" : [ "click.kamil.examples.enterprise.api.OrderController.placeOrder", "click.kamil.examples.enterprise.service.OrderServiceImpl.place" ],
"triggerPoint" : {
"event" : "PLACE_ORDER",
"className" : "click.kamil.examples.enterprise.service.OrderServiceImpl",
"methodName" : "place",
"sourceModule" : null,
"stateMachineId" : null,
"lineNumber" : 16
}
}, {
"entryPoint" : {
"type" : "REST",
"name" : "POST /api/enterprise/orders/{id}/cancel",
"className" : "click.kamil.examples.enterprise.api.OrderController",
"methodName" : "cancelOrder",
"metadata" : {
"path" : "/api/enterprise/orders/{id}/cancel",
"verb" : "POST"
},
"parameters" : [ {
"name" : "id",
"type" : "String",
"annotations" : [ "PathVariable" ]
} ]
},
"methodChain" : [ "click.kamil.examples.enterprise.api.OrderController.cancelOrder", "click.kamil.examples.enterprise.service.OrderServiceImpl.cancel" ],
"triggerPoint" : {
"event" : "CANCEL_ORDER",
"className" : "click.kamil.examples.enterprise.service.OrderServiceImpl",
"methodName" : "cancel",
"sourceModule" : null,
"stateMachineId" : null,
"lineNumber" : 21
}
}, {
"entryPoint" : {
"type" : "CUSTOM",
"name" : "INTERCEPTOR: SecurityInterceptor.preHandle",
"className" : "click.kamil.examples.enterprise.api.SecurityInterceptor",
"methodName" : "preHandle",
"metadata" : {
"interceptorType" : "Spring MVC Interceptor"
},
"parameters" : [ ]
},
"methodChain" : [ "click.kamil.examples.enterprise.api.SecurityInterceptor.preHandle" ],
"triggerPoint" : {
"event" : "AUDIT_EVENT",
"className" : "click.kamil.examples.enterprise.api.SecurityInterceptor",
"methodName" : "preHandle",
"sourceModule" : null,
"stateMachineId" : null,
"lineNumber" : 17
}
}, {
"entryPoint" : {
"type" : "REST",
"name" : "POST /api/enterprise/payments",
"className" : "click.kamil.examples.enterprise.api.ReactivePaymentController",
"methodName" : "pay",
"metadata" : {
"path" : "/api/enterprise/payments",
"verb" : "POST"
},
"parameters" : [ {
"name" : "orderId",
"type" : "String",
"annotations" : [ "RequestBody" ]
} ]
},
"methodChain" : [ "click.kamil.examples.enterprise.api.ReactivePaymentController.pay", "click.kamil.examples.enterprise.service.ReactivePaymentService.processPayment" ],
"triggerPoint" : {
"event" : "PAY_ORDER",
"className" : "click.kamil.examples.enterprise.service.ReactivePaymentService",
"methodName" : "processPayment",
"sourceModule" : null,
"stateMachineId" : null,
"lineNumber" : 18
}
}, {
"entryPoint" : {
"type" : "JMS",
"name" : "JMS: shipping.queue",
"className" : "click.kamil.examples.enterprise.messaging.ShippingJmsListener",
"methodName" : "onShippingReady",
"metadata" : {
"protocol" : "JMS",
"destination" : "shipping.queue"
},
"parameters" : [ {
"name" : "orderId",
"type" : "String",
"annotations" : [ ]
} ]
},
"methodChain" : [ "click.kamil.examples.enterprise.messaging.ShippingJmsListener.onShippingReady" ],
"triggerPoint" : {
"event" : "SHIP_ORDER",
"className" : "click.kamil.examples.enterprise.messaging.ShippingJmsListener",
"methodName" : "onShippingReady",
"sourceModule" : null,
"stateMachineId" : null,
"lineNumber" : 17
}
}, {
"entryPoint" : {
"type" : "RABBIT",
"name" : "RABBIT: returns.queue",
"className" : "click.kamil.examples.enterprise.messaging.ReturnsRabbitListener",
"methodName" : "onReturn",
"metadata" : {
"protocol" : "RABBIT",
"destination" : "returns.queue"
},
"parameters" : [ {
"name" : "orderId",
"type" : "String",
"annotations" : [ ]
} ]
},
"methodChain" : [ "click.kamil.examples.enterprise.messaging.ReturnsRabbitListener.onReturn" ],
"triggerPoint" : {
"event" : "RETURN_ORDER",
"className" : "click.kamil.examples.enterprise.messaging.ReturnsRabbitListener",
"methodName" : "onReturn",
"sourceModule" : null,
"stateMachineId" : null,
"lineNumber" : 17
}
} ],
"properties" : {
"default" : { }
}
},
"name" : "click.kamil.examples.enterprise.config.EnterpriseStateMachineConfig",
"renderChoicesAsDiamonds" : true,
"startStates" : [ "NEW" ],
"transitions" : [ {
"type" : "EXTERNAL",
"sourceStates" : [ {
"rawName" : "\"NEW\"",
"fullIdentifier" : "NEW"
} ],
"targetStates" : [ {
"rawName" : "\"CHECK_AVAILABILITY\"",
"fullIdentifier" : "CHECK_AVAILABILITY"
} ],
"event" : "PLACE_ORDER",
"guard" : null,
"actions" : [ ],
"order" : null
}, {
"type" : "CHOICE",
"sourceStates" : [ {
"rawName" : "\"CHECK_AVAILABILITY\"",
"fullIdentifier" : "CHECK_AVAILABILITY"
} ],
"targetStates" : [ {
"rawName" : "\"PENDING_PAYMENT\"",
"fullIdentifier" : "PENDING_PAYMENT"
} ],
"event" : null,
"guard" : {
"expression" : "(c) -> true",
"isLambda" : true,
"internalLogic" : "(c) -> true",
"lineNumber" : 41
},
"actions" : [ ],
"order" : 0
}, {
"type" : "CHOICE",
"sourceStates" : [ {
"rawName" : "\"CHECK_AVAILABILITY\"",
"fullIdentifier" : "CHECK_AVAILABILITY"
} ],
"targetStates" : [ {
"rawName" : "\"CANCELLED\"",
"fullIdentifier" : "CANCELLED"
} ],
"event" : null,
"guard" : null,
"actions" : [ ],
"order" : 1
}, {
"type" : "EXTERNAL",
"sourceStates" : [ {
"rawName" : "\"PENDING_PAYMENT\"",
"fullIdentifier" : "PENDING_PAYMENT"
} ],
"targetStates" : [ {
"rawName" : "\"PAID\"",
"fullIdentifier" : "PAID"
} ],
"event" : "PAY_ORDER",
"guard" : null,
"actions" : [ ],
"order" : null
}, {
"type" : "EXTERNAL",
"sourceStates" : [ {
"rawName" : "\"PAID\"",
"fullIdentifier" : "PAID"
} ],
"targetStates" : [ {
"rawName" : "\"SHIPPED\"",
"fullIdentifier" : "SHIPPED"
} ],
"event" : "SHIP_ORDER",
"guard" : null,
"actions" : [ ],
"order" : null
}, {
"type" : "EXTERNAL",
"sourceStates" : [ {
"rawName" : "\"SHIPPED\"",
"fullIdentifier" : "SHIPPED"
} ],
"targetStates" : [ {
"rawName" : "\"DELIVERED\"",
"fullIdentifier" : "DELIVERED"
} ],
"event" : "FINALIZE",
"guard" : null,
"actions" : [ ],
"order" : null
}, {
"type" : "EXTERNAL",
"sourceStates" : [ {
"rawName" : "\"PAID\"",
"fullIdentifier" : "PAID"
} ],
"targetStates" : [ {
"rawName" : "\"CANCELLED\"",
"fullIdentifier" : "CANCELLED"
} ],
"event" : "CANCEL_ORDER",
"guard" : null,
"actions" : [ ],
"order" : null
}, {
"type" : "EXTERNAL",
"sourceStates" : [ {
"rawName" : "\"DELIVERED\"",
"fullIdentifier" : "DELIVERED"
} ],
"targetStates" : [ {
"rawName" : "\"RETURNED\"",
"fullIdentifier" : "RETURNED"
} ],
"event" : "RETURN_ORDER",
"guard" : null,
"actions" : [ ],
"order" : null
} ],
"endStates" : [ "CANCELLED", "DELIVERED", "RETURNED" ]
}

View File

@@ -1,390 +0,0 @@
{
"metadata" : {
"triggers" : [ {
"event" : "AUDIT_EVENT",
"className" : "click.kamil.examples.enterprise.api.SecurityInterceptor",
"methodName" : "preHandle",
"sourceModule" : null,
"stateMachineId" : null,
"lineNumber" : 17
}, {
"event" : "PLACE_ORDER",
"className" : "click.kamil.examples.enterprise.service.OrderServiceImpl",
"methodName" : "place",
"sourceModule" : null,
"stateMachineId" : null,
"lineNumber" : 16
}, {
"event" : "CANCEL_ORDER",
"className" : "click.kamil.examples.enterprise.service.OrderServiceImpl",
"methodName" : "cancel",
"sourceModule" : null,
"stateMachineId" : null,
"lineNumber" : 21
}, {
"event" : "PAY_ORDER",
"className" : "click.kamil.examples.enterprise.service.ReactivePaymentService",
"methodName" : "processPayment",
"sourceModule" : null,
"stateMachineId" : null,
"lineNumber" : 18
}, {
"event" : "SHIP_ORDER",
"className" : "click.kamil.examples.enterprise.messaging.ShippingJmsListener",
"methodName" : "onShippingReady",
"sourceModule" : null,
"stateMachineId" : null,
"lineNumber" : 17
}, {
"event" : "RETURN_ORDER",
"className" : "click.kamil.examples.enterprise.messaging.ReturnsRabbitListener",
"methodName" : "onReturn",
"sourceModule" : null,
"stateMachineId" : null,
"lineNumber" : 17
} ],
"entryPoints" : [ {
"type" : "REST",
"name" : "POST /api/enterprise/orders/place",
"className" : "click.kamil.examples.enterprise.api.OrderController",
"methodName" : "placeOrder",
"metadata" : {
"path" : "/api/enterprise/orders/place",
"verb" : "POST"
},
"parameters" : [ ]
}, {
"type" : "REST",
"name" : "POST /api/enterprise/orders/{id}/cancel",
"className" : "click.kamil.examples.enterprise.api.OrderController",
"methodName" : "cancelOrder",
"metadata" : {
"path" : "/api/enterprise/orders/{id}/cancel",
"verb" : "POST"
},
"parameters" : [ {
"name" : "id",
"type" : "String",
"annotations" : [ "PathVariable" ]
} ]
}, {
"type" : "CUSTOM",
"name" : "INTERCEPTOR: SecurityInterceptor.preHandle",
"className" : "click.kamil.examples.enterprise.api.SecurityInterceptor",
"methodName" : "preHandle",
"metadata" : {
"interceptorType" : "Spring MVC Interceptor"
},
"parameters" : [ ]
}, {
"type" : "REST",
"name" : "POST /api/enterprise/payments",
"className" : "click.kamil.examples.enterprise.api.ReactivePaymentController",
"methodName" : "pay",
"metadata" : {
"path" : "/api/enterprise/payments",
"verb" : "POST"
},
"parameters" : [ {
"name" : "orderId",
"type" : "String",
"annotations" : [ "RequestBody" ]
} ]
}, {
"type" : "JMS",
"name" : "JMS: shipping.queue",
"className" : "click.kamil.examples.enterprise.messaging.ShippingJmsListener",
"methodName" : "onShippingReady",
"metadata" : {
"protocol" : "JMS",
"destination" : "shipping.queue"
},
"parameters" : [ {
"name" : "orderId",
"type" : "String",
"annotations" : [ ]
} ]
}, {
"type" : "RABBIT",
"name" : "RABBIT: returns.queue",
"className" : "click.kamil.examples.enterprise.messaging.ReturnsRabbitListener",
"methodName" : "onReturn",
"metadata" : {
"protocol" : "RABBIT",
"destination" : "returns.queue"
},
"parameters" : [ {
"name" : "orderId",
"type" : "String",
"annotations" : [ ]
} ]
} ],
"callChains" : [ {
"entryPoint" : {
"type" : "REST",
"name" : "POST /api/enterprise/orders/place",
"className" : "click.kamil.examples.enterprise.api.OrderController",
"methodName" : "placeOrder",
"metadata" : {
"path" : "/api/enterprise/orders/place",
"verb" : "POST"
},
"parameters" : [ ]
},
"methodChain" : [ "click.kamil.examples.enterprise.api.OrderController.placeOrder", "click.kamil.examples.enterprise.service.OrderServiceImpl.place" ],
"triggerPoint" : {
"event" : "PLACE_ORDER",
"className" : "click.kamil.examples.enterprise.service.OrderServiceImpl",
"methodName" : "place",
"sourceModule" : null,
"stateMachineId" : null,
"lineNumber" : 16
}
}, {
"entryPoint" : {
"type" : "REST",
"name" : "POST /api/enterprise/orders/{id}/cancel",
"className" : "click.kamil.examples.enterprise.api.OrderController",
"methodName" : "cancelOrder",
"metadata" : {
"path" : "/api/enterprise/orders/{id}/cancel",
"verb" : "POST"
},
"parameters" : [ {
"name" : "id",
"type" : "String",
"annotations" : [ "PathVariable" ]
} ]
},
"methodChain" : [ "click.kamil.examples.enterprise.api.OrderController.cancelOrder", "click.kamil.examples.enterprise.service.OrderServiceImpl.cancel" ],
"triggerPoint" : {
"event" : "CANCEL_ORDER",
"className" : "click.kamil.examples.enterprise.service.OrderServiceImpl",
"methodName" : "cancel",
"sourceModule" : null,
"stateMachineId" : null,
"lineNumber" : 21
}
}, {
"entryPoint" : {
"type" : "CUSTOM",
"name" : "INTERCEPTOR: SecurityInterceptor.preHandle",
"className" : "click.kamil.examples.enterprise.api.SecurityInterceptor",
"methodName" : "preHandle",
"metadata" : {
"interceptorType" : "Spring MVC Interceptor"
},
"parameters" : [ ]
},
"methodChain" : [ "click.kamil.examples.enterprise.api.SecurityInterceptor.preHandle" ],
"triggerPoint" : {
"event" : "AUDIT_EVENT",
"className" : "click.kamil.examples.enterprise.api.SecurityInterceptor",
"methodName" : "preHandle",
"sourceModule" : null,
"stateMachineId" : null,
"lineNumber" : 17
}
}, {
"entryPoint" : {
"type" : "REST",
"name" : "POST /api/enterprise/payments",
"className" : "click.kamil.examples.enterprise.api.ReactivePaymentController",
"methodName" : "pay",
"metadata" : {
"path" : "/api/enterprise/payments",
"verb" : "POST"
},
"parameters" : [ {
"name" : "orderId",
"type" : "String",
"annotations" : [ "RequestBody" ]
} ]
},
"methodChain" : [ "click.kamil.examples.enterprise.api.ReactivePaymentController.pay", "click.kamil.examples.enterprise.service.ReactivePaymentService.processPayment" ],
"triggerPoint" : {
"event" : "PAY_ORDER",
"className" : "click.kamil.examples.enterprise.service.ReactivePaymentService",
"methodName" : "processPayment",
"sourceModule" : null,
"stateMachineId" : null,
"lineNumber" : 18
}
}, {
"entryPoint" : {
"type" : "JMS",
"name" : "JMS: shipping.queue",
"className" : "click.kamil.examples.enterprise.messaging.ShippingJmsListener",
"methodName" : "onShippingReady",
"metadata" : {
"protocol" : "JMS",
"destination" : "shipping.queue"
},
"parameters" : [ {
"name" : "orderId",
"type" : "String",
"annotations" : [ ]
} ]
},
"methodChain" : [ "click.kamil.examples.enterprise.messaging.ShippingJmsListener.onShippingReady" ],
"triggerPoint" : {
"event" : "SHIP_ORDER",
"className" : "click.kamil.examples.enterprise.messaging.ShippingJmsListener",
"methodName" : "onShippingReady",
"sourceModule" : null,
"stateMachineId" : null,
"lineNumber" : 17
}
}, {
"entryPoint" : {
"type" : "RABBIT",
"name" : "RABBIT: returns.queue",
"className" : "click.kamil.examples.enterprise.messaging.ReturnsRabbitListener",
"methodName" : "onReturn",
"metadata" : {
"protocol" : "RABBIT",
"destination" : "returns.queue"
},
"parameters" : [ {
"name" : "orderId",
"type" : "String",
"annotations" : [ ]
} ]
},
"methodChain" : [ "click.kamil.examples.enterprise.messaging.ReturnsRabbitListener.onReturn" ],
"triggerPoint" : {
"event" : "RETURN_ORDER",
"className" : "click.kamil.examples.enterprise.messaging.ReturnsRabbitListener",
"methodName" : "onReturn",
"sourceModule" : null,
"stateMachineId" : null,
"lineNumber" : 17
}
} ],
"properties" : {
"default" : { }
}
},
"name" : "click.kamil.examples.enterprise.config.EnterpriseStateMachineConfig",
"renderChoicesAsDiamonds" : false,
"startStates" : [ "${order.initial.state:NEW}" ],
"transitions" : [ {
"type" : "EXTERNAL",
"sourceStates" : [ {
"rawName" : "\"NEW\"",
"fullIdentifier" : "NEW"
} ],
"targetStates" : [ {
"rawName" : "\"CHECK_AVAILABILITY\"",
"fullIdentifier" : "CHECK_AVAILABILITY"
} ],
"event" : "PLACE_ORDER",
"guard" : null,
"actions" : [ ],
"order" : null
}, {
"type" : "CHOICE",
"sourceStates" : [ {
"rawName" : "\"CHECK_AVAILABILITY\"",
"fullIdentifier" : "CHECK_AVAILABILITY"
} ],
"targetStates" : [ {
"rawName" : "\"PENDING_PAYMENT\"",
"fullIdentifier" : "PENDING_PAYMENT"
} ],
"event" : null,
"guard" : {
"expression" : "(c) -> true",
"isLambda" : true,
"internalLogic" : "(c) -> true",
"lineNumber" : 41
},
"actions" : [ ],
"order" : 0
}, {
"type" : "CHOICE",
"sourceStates" : [ {
"rawName" : "\"CHECK_AVAILABILITY\"",
"fullIdentifier" : "CHECK_AVAILABILITY"
} ],
"targetStates" : [ {
"rawName" : "\"CANCELLED\"",
"fullIdentifier" : "CANCELLED"
} ],
"event" : null,
"guard" : null,
"actions" : [ ],
"order" : 1
}, {
"type" : "EXTERNAL",
"sourceStates" : [ {
"rawName" : "\"PENDING_PAYMENT\"",
"fullIdentifier" : "PENDING_PAYMENT"
} ],
"targetStates" : [ {
"rawName" : "\"PAID\"",
"fullIdentifier" : "PAID"
} ],
"event" : "PAY_ORDER",
"guard" : null,
"actions" : [ ],
"order" : null
}, {
"type" : "EXTERNAL",
"sourceStates" : [ {
"rawName" : "\"PAID\"",
"fullIdentifier" : "PAID"
} ],
"targetStates" : [ {
"rawName" : "\"SHIPPED\"",
"fullIdentifier" : "SHIPPED"
} ],
"event" : "SHIP_ORDER",
"guard" : null,
"actions" : [ ],
"order" : null
}, {
"type" : "EXTERNAL",
"sourceStates" : [ {
"rawName" : "\"SHIPPED\"",
"fullIdentifier" : "SHIPPED"
} ],
"targetStates" : [ {
"rawName" : "\"DELIVERED\"",
"fullIdentifier" : "DELIVERED"
} ],
"event" : "FINALIZE",
"guard" : null,
"actions" : [ ],
"order" : null
}, {
"type" : "EXTERNAL",
"sourceStates" : [ {
"rawName" : "\"PAID\"",
"fullIdentifier" : "PAID"
} ],
"targetStates" : [ {
"rawName" : "\"CANCELLED\"",
"fullIdentifier" : "CANCELLED"
} ],
"event" : "CANCEL_ORDER",
"guard" : null,
"actions" : [ ],
"order" : null
}, {
"type" : "EXTERNAL",
"sourceStates" : [ {
"rawName" : "\"DELIVERED\"",
"fullIdentifier" : "DELIVERED"
} ],
"targetStates" : [ {
"rawName" : "\"RETURNED\"",
"fullIdentifier" : "RETURNED"
} ],
"event" : "RETURN_ORDER",
"guard" : null,
"actions" : [ ],
"order" : null
} ],
"endStates" : [ "CANCELLED", "DELIVERED", "RETURNED" ]
}