Skip to content
Merged
Show file tree
Hide file tree
Changes from 16 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
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@
"type": "CONNECTION",
"name": "httpConnection",
"scope": "Global",
"icon": "https://bcentral-packageicons.azureedge.net/images/ballerina_http_2.14.6.png",
"icon": "https://bcentral-packageicons.azureedge.net/images/ballerina_http_2.14.7.png",
"module": "http",
"children": {}
},
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@
"type": "CONNECTION",
"name": "httpClient",
"scope": "Global",
"icon": "https://bcentral-packageicons.azureedge.net/images/ballerina_http_2.14.6.png",
"icon": "https://bcentral-packageicons.azureedge.net/images/ballerina_http_2.14.7.png",
"module": "http",
"children": {}
}
Expand All @@ -41,7 +41,7 @@
"type": "LISTENER",
"name": "refListener",
"scope": "Global",
"icon": "https://bcentral-packageicons.azureedge.net/images/ballerina_http_2.14.6.png",
"icon": "https://bcentral-packageicons.azureedge.net/images/ballerina_http_2.14.7.png",
"module": "http",
"children": {}
},
Expand All @@ -61,7 +61,7 @@
"type": "LISTENER",
"name": "securedEP",
"scope": "Global",
"icon": "https://bcentral-packageicons.azureedge.net/images/ballerina_http_2.14.6.png",
"icon": "https://bcentral-packageicons.azureedge.net/images/ballerina_http_2.14.7.png",
"module": "http",
"children": {}
}
Expand All @@ -83,7 +83,7 @@
"type": "SERVICE",
"name": "HTTP Service - /root/path-id",
"scope": "Global",
"icon": "https://bcentral-packageicons.azureedge.net/images/ballerina_http_2.14.6.png",
"icon": "https://bcentral-packageicons.azureedge.net/images/ballerina_http_2.14.7.png",
"module": "http",
"children": {
"post#data": {
Expand Down Expand Up @@ -199,7 +199,7 @@
"type": "SERVICE",
"name": "HTTP Service - /",
"scope": "Global",
"icon": "https://bcentral-packageicons.azureedge.net/images/ballerina_http_2.14.6.png",
"icon": "https://bcentral-packageicons.azureedge.net/images/ballerina_http_2.14.7.png",
"module": "http",
"children": {
"init": {
Expand Down Expand Up @@ -257,7 +257,7 @@
"type": "SERVICE",
"name": "HTTP Service - /api/v1",
"scope": "Global",
"icon": "https://bcentral-packageicons.azureedge.net/images/ballerina_http_2.14.6.png",
"icon": "https://bcentral-packageicons.azureedge.net/images/ballerina_http_2.14.7.png",
"module": "http",
"children": {
"get#path": {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@
"type": "LISTENER",
"name": "httpDefaultListener",
"scope": "Global",
"icon": "https://bcentral-packageicons.azureedge.net/images/ballerina_http_2.14.6.png",
"icon": "https://bcentral-packageicons.azureedge.net/images/ballerina_http_2.14.7.png",
"module": "http",
"children": {}
},
Expand Down Expand Up @@ -77,7 +77,7 @@
"type": "LISTENER",
"name": "refListener",
"scope": "Global",
"icon": "https://bcentral-packageicons.azureedge.net/images/ballerina_http_2.14.6.png",
"icon": "https://bcentral-packageicons.azureedge.net/images/ballerina_http_2.14.7.png",
"module": "http",
"children": {}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@
"type": "CONNECTION",
"name": "httpClient",
"scope": "Global",
"icon": "https://bcentral-packageicons.azureedge.net/images/ballerina_http_2.14.6.png",
"icon": "https://bcentral-packageicons.azureedge.net/images/ballerina_http_2.14.7.png",
"module": "http",
"children": {}
},
Expand All @@ -39,7 +39,7 @@
"type": "CONNECTION",
"name": "httpClient2",
"scope": "Global",
"icon": "https://bcentral-packageicons.azureedge.net/images/ballerina_http_2.14.6.png",
"icon": "https://bcentral-packageicons.azureedge.net/images/ballerina_http_2.14.7.png",
"module": "http",
"children": {}
}
Expand All @@ -61,7 +61,7 @@
"type": "LISTENER",
"name": "ls",
"scope": "Global",
"icon": "https://bcentral-packageicons.azureedge.net/images/ballerina_http_2.14.6.png",
"icon": "https://bcentral-packageicons.azureedge.net/images/ballerina_http_2.14.7.png",
"module": "http",
"children": {}
},
Expand All @@ -81,7 +81,7 @@
"type": "LISTENER",
"name": "securedEP",
"scope": "Global",
"icon": "https://bcentral-packageicons.azureedge.net/images/ballerina_http_2.14.6.png",
"icon": "https://bcentral-packageicons.azureedge.net/images/ballerina_http_2.14.7.png",
"module": "http",
"children": {}
},
Expand All @@ -101,7 +101,7 @@
"type": "LISTENER",
"name": "securedEP2",
"scope": "Global",
"icon": "https://bcentral-packageicons.azureedge.net/images/ballerina_http_2.14.6.png",
"icon": "https://bcentral-packageicons.azureedge.net/images/ballerina_http_2.14.7.png",
"module": "http",
"children": {}
}
Expand Down Expand Up @@ -161,7 +161,7 @@
"type": "SERVICE",
"name": "HTTP Service - /api2",
"scope": "Global",
"icon": "https://bcentral-packageicons.azureedge.net/images/ballerina_http_2.14.6.png",
"icon": "https://bcentral-packageicons.azureedge.net/images/ballerina_http_2.14.7.png",
"module": "http",
"children": {
"get#path": {
Expand Down Expand Up @@ -201,7 +201,7 @@
"type": "SERVICE",
"name": "HTTP Service - /api1",
"scope": "Global",
"icon": "https://bcentral-packageicons.azureedge.net/images/ballerina_http_2.14.6.png",
"icon": "https://bcentral-packageicons.azureedge.net/images/ballerina_http_2.14.7.png",
"module": "http",
"children": {
"get#path": {
Expand Down Expand Up @@ -259,7 +259,7 @@
"type": "SERVICE",
"name": "HTTP Service - /",
"scope": "Global",
"icon": "https://bcentral-packageicons.azureedge.net/images/ballerina_http_2.14.6.png",
"icon": "https://bcentral-packageicons.azureedge.net/images/ballerina_http_2.14.7.png",
"module": "http",
"children": {
"init": {
Expand Down Expand Up @@ -317,7 +317,7 @@
"type": "SERVICE",
"name": "HTTP Service - /",
"scope": "Global",
"icon": "https://bcentral-packageicons.azureedge.net/images/ballerina_http_2.14.6.png",
"icon": "https://bcentral-packageicons.azureedge.net/images/ballerina_http_2.14.7.png",
"module": "http",
"children": {
"init": {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@
"type": "CONNECTION",
"name": "httpEp",
"scope": "Global",
"icon": "https://bcentral-packageicons.azureedge.net/images/ballerina_http_2.14.6.png",
"icon": "https://bcentral-packageicons.azureedge.net/images/ballerina_http_2.14.7.png",
"module": "http",
"children": {}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -84,7 +84,7 @@
"type": "LISTENER",
"name": "httpListener",
"scope": "Global",
"icon": "https://bcentral-packageicons.azureedge.net/images/ballerina_http_2.14.6.png",
"icon": "https://bcentral-packageicons.azureedge.net/images/ballerina_http_2.14.7.png",
"module": "http",
"children": {}
}
Expand All @@ -108,7 +108,7 @@
"type": "SERVICE",
"name": "HTTP Service - /restaurant",
"scope": "Global",
"icon": "https://bcentral-packageicons.azureedge.net/images/ballerina_http_2.14.6.png",
"icon": "https://bcentral-packageicons.azureedge.net/images/ballerina_http_2.14.7.png",
"module": "http",
"children": {
"post#orders": {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -114,7 +114,7 @@
"type": "CONNECTION",
"name": "httpEp",
"scope": "Global",
"icon": "https://bcentral-packageicons.azureedge.net/images/ballerina_http_2.14.6.png",
"icon": "https://bcentral-packageicons.azureedge.net/images/ballerina_http_2.14.7.png",
"module": "http",
"children": {}
}
Expand Down Expand Up @@ -220,7 +220,7 @@
"type": "LISTENER",
"name": "httpListener",
"scope": "Global",
"icon": "https://bcentral-packageicons.azureedge.net/images/ballerina_http_2.14.6.png",
"icon": "https://bcentral-packageicons.azureedge.net/images/ballerina_http_2.14.7.png",
"module": "http",
"children": {}
}
Expand Down Expand Up @@ -516,7 +516,7 @@
"type": "SERVICE",
"name": "HTTP Service - /restaurant",
"scope": "Global",
"icon": "https://bcentral-packageicons.azureedge.net/images/ballerina_http_2.14.6.png",
"icon": "https://bcentral-packageicons.azureedge.net/images/ballerina_http_2.14.7.png",
"module": "http",
"children": {
"post#orders": {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -114,7 +114,7 @@
"type": "CONNECTION",
"name": "httpEp",
"scope": "Global",
"icon": "https://bcentral-packageicons.azureedge.net/images/ballerina_http_2.14.6.png",
"icon": "https://bcentral-packageicons.azureedge.net/images/ballerina_http_2.14.7.png",
"module": "http",
"children": {}
}
Expand Down Expand Up @@ -232,7 +232,7 @@
"type": "LISTENER",
"name": "httpListener",
"scope": "Global",
"icon": "https://bcentral-packageicons.azureedge.net/images/ballerina_http_2.14.6.png",
"icon": "https://bcentral-packageicons.azureedge.net/images/ballerina_http_2.14.7.png",
"module": "http",
"children": {}
}
Expand Down Expand Up @@ -536,7 +536,7 @@
"type": "SERVICE",
"name": "HTTP Service - /restaurant",
"scope": "Global",
"icon": "https://bcentral-packageicons.azureedge.net/images/ballerina_http_2.14.6.png",
"icon": "https://bcentral-packageicons.azureedge.net/images/ballerina_http_2.14.7.png",
"module": "http",
"children": {
"get#menu": {
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
/*
* Copyright (c) 2025, WSO2 LLC. (http://www.wso2.com)
*
* WSO2 LLC. licenses this file to you under the Apache License,
* Version 2.0 (the "License"); you may not use this file except
* in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing,
* software distributed under the License is distributed on an
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
* KIND, either express or implied. See the License for the
* specific language governing permissions and limitations
* under the License.
*/

package io.ballerina.modelgenerator.commons;

/**
* Represents read-only metadata for a service.
*
* @param metadataKey The key/name of the metadata field
* @param displayName The display name for the metadata field
* @param kind The kind/category of the metadata field (e.g., ANNOTATION, SERVICE_DESCRIPTION, LISTENER_PARAM)
*
* @since 1.0.0
Copy link
Contributor

@pasindufernando1 pasindufernando1 Oct 27, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
* @since 1.0.0
* @since 1.3.0

*/
public record ReadOnlyMetaData(
String metadataKey,
String displayName,
String kind
) {
}
Original file line number Diff line number Diff line change
Expand Up @@ -642,6 +642,36 @@ public List<Annotation> getAnnotationAttachments(String org, String packageName,

}

public List<ReadOnlyMetaData> getReadOnlyMetaData(String orgName, String packageName, String serviceType) {
String sql = "SELECT " +
"metadata_key, " +
"display_name, " +
"kind " +
"FROM ServiceReadOnlyMetaData srmd " +
"JOIN Package p ON srmd.package_id = p.package_id " +
"WHERE p.name = ? AND p.org = ? ";
try (Connection conn = DriverManager.getConnection(dbPath);
PreparedStatement stmt = conn.prepareStatement(sql)) {
stmt.setString(1, packageName);
stmt.setString(2, orgName);

ResultSet rs = stmt.executeQuery();
List<ReadOnlyMetaData> metaDataList = new ArrayList<>();
while (rs.next()) {
metaDataList.add(new ReadOnlyMetaData(
rs.getString("metadata_key"),
rs.getString("display_name"),
rs.getString("kind")
));
}
conn.close();
Copy link

Copilot AI Oct 27, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The connection is already being closed by the try-with-resources statement. This explicit conn.close() call is redundant and should be removed.

Copilot uses AI. Check for mistakes.
return metaDataList;
} catch (SQLException e) {
Logger.getGlobal().severe("Error executing query: " + e.getMessage());
return List.of();
}
}

// Helper builder class
private static class ParameterDataBuilder {

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@
import io.ballerina.projects.Document;
import io.ballerina.projects.Project;
import io.ballerina.servicemodelgenerator.extension.builder.service.AiChatServiceBuilder;
import io.ballerina.servicemodelgenerator.extension.builder.service.AsbServiceBuilder;
import io.ballerina.servicemodelgenerator.extension.builder.service.DefaultServiceBuilder;
import io.ballerina.servicemodelgenerator.extension.builder.service.GraphqlServiceBuilder;
import io.ballerina.servicemodelgenerator.extension.builder.service.HttpServiceBuilder;
Expand Down Expand Up @@ -53,6 +54,7 @@
import java.util.function.Supplier;

import static io.ballerina.servicemodelgenerator.extension.util.Constants.AI;
import static io.ballerina.servicemodelgenerator.extension.util.Constants.ASB;
import static io.ballerina.servicemodelgenerator.extension.util.Constants.GRAPHQL;
import static io.ballerina.servicemodelgenerator.extension.util.Constants.HTTP;
import static io.ballerina.servicemodelgenerator.extension.util.Constants.KAFKA;
Expand All @@ -76,6 +78,7 @@ public class ServiceBuilderRouter {
put(GRAPHQL, GraphqlServiceBuilder::new);
put(MCP, McpServiceBuilder::new);
put(KAFKA, KafkaServiceBuilder::new);
put(ASB, AsbServiceBuilder::new);
}};

public static ServiceNodeBuilder getServiceBuilder(String protocol) {
Expand Down Expand Up @@ -105,7 +108,9 @@ public static Service getServiceFromSource(Node node, Project project,
workspaceManager, filePath, serviceMetadata.serviceType(), serviceMetadata.orgName(),
serviceMetadata.packageName(), serviceMetadata.moduleName());
Service service = serviceBuilder.getModelFromSource(context);
service.getProperties().forEach((k, v) -> v.setAdvanced(false));
if (service != null) {
service.getProperties().forEach((k, v) -> v.setAdvanced(false));
}
return service;
}

Expand Down
Loading
Loading