001package gudusoft.gsqlparser.analyzer.v2.callgraph;
002
003import gudusoft.gsqlparser.ir.common.SourceAnchor;
004
005/**
006 * An edge representing a call to an external dependency (built-in function,
007 * system procedure, extended procedure, etc.) that does NOT have a
008 * corresponding node in the call graph.
009 * <p>
010 * Used by SQL Server call graph to avoid creating virtual nodes for
011 * GETDATE(), sp_executesql, xp_cmdshell, and other built-in/system objects.
012 */
013public class ExternalCallEdge {
014
015    private final String callerRoutineId;
016    private final String externalName;
017    private final String externalType;
018    private final SourceAnchor callSite;
019    private final boolean securitySensitive;
020
021    public ExternalCallEdge(String callerRoutineId, String externalName,
022                            String externalType, SourceAnchor callSite,
023                            boolean securitySensitive) {
024        this.callerRoutineId = callerRoutineId;
025        this.externalName = externalName;
026        this.externalType = externalType;
027        this.callSite = callSite;
028        this.securitySensitive = securitySensitive;
029    }
030
031    public String getCallerRoutineId() { return callerRoutineId; }
032    public String getExternalName() { return externalName; }
033    public String getExternalType() { return externalType; }
034    public SourceAnchor getCallSite() { return callSite; }
035    public boolean isSecuritySensitive() { return securitySensitive; }
036
037    @Override
038    public String toString() {
039        return "ExternalCallEdge{" + callerRoutineId + " -> " + externalName
040                + " (" + externalType + ")" + "}";
041    }
042}