Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
49 changes: 49 additions & 0 deletions jArchi_Scripts/01_Basic_Operations/create_elements.ajs
Original file line number Diff line number Diff line change
@@ -0,0 +1,49 @@
/*
* Create Basic ArchiMate Elements
*
* This script demonstrates how to create various ArchiMate elements
* in the current model.
*/

console.log("Creating ArchiMate Elements...");

// Get the current model
var model = $("model").first();

if (!model) {
console.log("No model found. Please open a model first.");
} else {
// Create Business Layer elements
var businessActor = model.createObject("business-actor", "Customer");
var businessRole = model.createObject("business-role", "Sales Manager");
var businessProcess = model.createObject("business-process", "Order Processing");
var businessService = model.createObject("business-service", "Order Service");

// Create Application Layer elements
var appComponent = model.createObject("application-component", "CRM System");
var appService = model.createObject("application-service", "Customer Data Service");
var appInterface = model.createObject("application-interface", "REST API");
var dataObject = model.createObject("data-object", "Customer Record");

// Create Technology Layer elements
var node = model.createObject("node", "Application Server");
var device = model.createObject("device", "Web Server");
var systemSoftware = model.createObject("system-software", "Database Server");
var artifact = model.createObject("artifact", "Configuration File");

// Create Motivation elements
var stakeholder = model.createObject("stakeholder", "Board of Directors");
var driver = model.createObject("driver", "Increase Revenue");
var goal = model.createObject("goal", "Improve Customer Satisfaction");
var requirement = model.createObject("requirement", "System must be available 24/7");

// Create Implementation elements
var workPackage = model.createObject("work-package", "CRM Implementation");
var deliverable = model.createObject("deliverable", "User Documentation");

console.log("✓ Elements created successfully!");
console.log("Business Layer: " + businessActor.name + ", " + businessRole.name);
console.log("Application Layer: " + appComponent.name + ", " + appService.name);
console.log("Technology Layer: " + node.name + ", " + device.name);
console.log("Motivation: " + stakeholder.name + ", " + goal.name);
}
51 changes: 51 additions & 0 deletions jArchi_Scripts/01_Basic_Operations/create_relationships.ajs
Original file line number Diff line number Diff line change
@@ -0,0 +1,51 @@
/*
* Create ArchiMate Relationships
*
* This script demonstrates how to create relationships between
* ArchiMate elements.
*/

console.log("Creating ArchiMate Relationships...");

var model = $("model").first();

if (!model) {
console.log("No model found. Please open a model first.");
} else {
// Create sample elements
var actor = model.createObject("business-actor", "User");
var process = model.createObject("business-process", "Login Process");
var service = model.createObject("business-service", "Authentication Service");
var application = model.createObject("application-component", "Authentication System");
var server = model.createObject("node", "Auth Server");

// Create relationships
// Structural Relationships
var composition = model.createRelationship("composition-relationship",
"Composition", application, service);
var aggregation = model.createRelationship("aggregation-relationship",
"Aggregation", process, service);
var assignment = model.createRelationship("assignment-relationship",
"Assignment", actor, process);
var realization = model.createRelationship("realization-relationship",
"Realization", application, service);

// Dependency Relationships
var serving = model.createRelationship("serving-relationship",
"Serving", service, actor);
var access = model.createRelationship("access-relationship",
"Access", application, server);
var influence = model.createRelationship("influence-relationship",
"Influence", actor, process);
var association = model.createRelationship("association-relationship",
"Association", actor, application);

// Dynamic Relationships
var triggering = model.createRelationship("triggering-relationship",
"Triggering", actor, process);
var flow = model.createRelationship("flow-relationship",
"Flow", process, service);

console.log("✓ Relationships created successfully!");
console.log("Created " + $("relationship").size() + " relationships");
}
51 changes: 51 additions & 0 deletions jArchi_Scripts/01_Basic_Operations/create_view.ajs
Original file line number Diff line number Diff line change
@@ -0,0 +1,51 @@
/*
* Create ArchiMate View with Elements
*
* This script creates a view and adds elements to it with automatic layout.
*/

console.log("Creating ArchiMate View...");

var model = $("model").first();

if (!model) {
console.log("No model found. Please open a model first.");
} else {
// Create a new view
var view = model.createArchimateView("Sample Business Process View");

// Create elements
var customer = model.createObject("business-actor", "Customer");
var salesRep = model.createObject("business-role", "Sales Representative");
var orderProcess = model.createObject("business-process", "Order Processing");
var crmSystem = model.createObject("application-component", "CRM System");
var database = model.createObject("node", "Customer Database");

// Create relationships
var assignment = model.createRelationship("assignment-relationship",
"Performs", salesRep, orderProcess);
var serving = model.createRelationship("serving-relationship",
"Serves", orderProcess, customer);
var realization = model.createRelationship("realization-relationship",
"Supports", crmSystem, orderProcess);
var access = model.createRelationship("access-relationship",
"Stores", crmSystem, database);

// Add elements to view with positions
var x = 50, y = 50, spacing = 200;

view.add(customer, x, y, 120, 55);
view.add(salesRep, x + spacing, y, 120, 55);
view.add(orderProcess, x + spacing, y + 100, 120, 55);
view.add(crmSystem, x + spacing, y + 200, 120, 55);
view.add(database, x + spacing, y + 300, 120, 55);

// Add relationships to view
view.add(assignment);
view.add(serving);
view.add(realization);
view.add(access);

console.log("✓ View created successfully: " + view.name);
console.log("Added " + $(view).find("element").size() + " elements to view");
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,97 @@
/*
* Generate Application Landscape
*
* This script generates a complete application landscape with:
* - Multiple application components
* - Data objects
* - Application services
* - Relationships between them
*/

console.log("Generating Application Landscape...");

var model = $("model").first();

if (!model) {
console.log("No model found. Please open a model first.");
} else {
// Define application landscape structure
var applications = [
{name: "CRM System", services: ["Customer Management", "Sales Tracking"], data: ["Customer Data", "Sales Data"]},
{name: "ERP System", services: ["Inventory Management", "Financial Reporting"], data: ["Inventory Data", "Financial Data"]},
{name: "E-Commerce Platform", services: ["Product Catalog", "Shopping Cart"], data: ["Product Data", "Order Data"]},
{name: "Analytics Platform", services: ["Data Analysis", "Reporting"], data: ["Analytics Data"]}
];

// Create view
var view = model.createArchimateView("Application Landscape");

var x = 50, y = 50;
var appWidth = 150, appHeight = 80;
var spacing = 50;

applications.forEach(function(app, index) {
// Create application component
var appComponent = model.createObject("application-component", app.name);
var appX = x + (index * (appWidth + spacing));
view.add(appComponent, appX, y, appWidth, appHeight);

var serviceY = y + appHeight + 30;

// Create services
app.services.forEach(function(serviceName, sIndex) {
var service = model.createObject("application-service", serviceName);
var serviceX = appX + (sIndex * 80);
view.add(service, serviceX, serviceY, 120, 55);

// Create realization relationship
var rel = model.createRelationship("realization-relationship", "", appComponent, service);
view.add(rel);
});

var dataY = serviceY + 100;

// Create data objects
app.data.forEach(function(dataName, dIndex) {
var dataObj = model.createObject("data-object", dataName);
var dataX = appX + (dIndex * 80);
view.add(dataObj, dataX, dataY, 120, 55);

// Create access relationship
var rel = model.createRelationship("access-relationship", "", appComponent, dataObj);
view.add(rel);
});
});

// Create integration relationships between applications
var apps = $("application-component").filter(function(app) {
return applications.some(function(a) { return a.name === app.name; });
});

if (apps.size() >= 2) {
// Example: CRM flows to ERP
var flow1 = model.createRelationship("flow-relationship", "Customer Orders",
apps.eq(0), apps.eq(1));
view.add(flow1);

// Example: E-Commerce uses CRM
if (apps.size() >= 3) {
var flow2 = model.createRelationship("flow-relationship", "Customer Info",
apps.eq(2), apps.eq(0));
view.add(flow2);
}

// Example: Analytics accesses all
if (apps.size() >= 4) {
for (var i = 0; i < 3; i++) {
var access = model.createRelationship("access-relationship", "",
apps.eq(3), apps.eq(i));
view.add(access);
}
}
}

console.log("✓ Application Landscape generated successfully!");
console.log("Created " + applications.length + " applications");
console.log("View: " + view.name);
}
84 changes: 84 additions & 0 deletions jArchi_Scripts/02_Model_Generation/generate_layered_view.ajs
Original file line number Diff line number Diff line change
@@ -0,0 +1,84 @@
/*
* Generate Layered ArchiMate View
*
* Creates a complete layered architecture view with:
* - Business Layer
* - Application Layer
* - Technology Layer
* Including proper relationships between layers
*/

console.log("Generating Layered Architecture View...");

var model = $("model").first();

if (!model) {
console.log("No model found. Please open a model first.");
} else {
// Create view
var view = model.createArchimateView("Layered Architecture View");

// Layout parameters
var margin = 50;
var layerHeight = 150;
var elementWidth = 140;
var elementHeight = 60;
var spacing = 30;

// Business Layer
var businessY = margin;
var businessActor = model.createObject("business-actor", "Customer");
var businessProcess = model.createObject("business-process", "Order Management");
var businessService = model.createObject("business-service", "Order Service");

view.add(businessActor, margin, businessY, elementWidth, elementHeight);
view.add(businessProcess, margin + elementWidth + spacing, businessY, elementWidth, elementHeight);
view.add(businessService, margin + 2 * (elementWidth + spacing), businessY, elementWidth, elementHeight);

// Business relationships
var busRel1 = model.createRelationship("triggering-relationship", "", businessActor, businessProcess);
var busRel2 = model.createRelationship("realization-relationship", "", businessProcess, businessService);
view.add(busRel1);
view.add(busRel2);

// Application Layer
var appY = businessY + layerHeight;
var appComponent = model.createObject("application-component", "Order Management System");
var appService = model.createObject("application-service", "Order Processing Service");
var dataObject = model.createObject("data-object", "Order Data");

view.add(appComponent, margin, appY, elementWidth, elementHeight);
view.add(appService, margin + elementWidth + spacing, appY, elementWidth, elementHeight);
view.add(dataObject, margin + 2 * (elementWidth + spacing), appY, elementWidth, elementHeight);

// Application relationships
var appRel1 = model.createRelationship("realization-relationship", "", appComponent, appService);
var appRel2 = model.createRelationship("access-relationship", "reads/writes", appComponent, dataObject);
view.add(appRel1);
view.add(appRel2);

// Technology Layer
var techY = appY + layerHeight;
var node = model.createObject("node", "Application Server");
var systemSoftware = model.createObject("system-software", "Database System");
var artifact = model.createObject("artifact", "Application Package");

view.add(node, margin, techY, elementWidth, elementHeight);
view.add(systemSoftware, margin + elementWidth + spacing, techY, elementWidth, elementHeight);
view.add(artifact, margin + 2 * (elementWidth + spacing), techY, elementWidth, elementHeight);

// Technology relationships
var techRel1 = model.createRelationship("assignment-relationship", "", artifact, node);
var techRel2 = model.createRelationship("assignment-relationship", "", systemSoftware, node);
view.add(techRel1);
view.add(techRel2);

// Cross-layer relationships
var crossRel1 = model.createRelationship("realization-relationship", "", appService, businessService);
var crossRel2 = model.createRelationship("assignment-relationship", "", appComponent, node);
view.add(crossRel1);
view.add(crossRel2);

console.log("✓ Layered Architecture View created successfully!");
console.log("View contains 3 layers with interconnected elements");
}
Loading