Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
20 commits
Select commit Hold shift + click to select a range
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 @@ -103,7 +103,8 @@ public record Artifact(String id, LineRange location, String type, String name,
*/
private static final Map<String, String[]> moduleAnnotationFields = Map.of(
"solace", new String[]{"queueName", "topicName"},
"mssql", new String[]{"tables"}
"mssql", new String[]{"tables"},
"ftp", new String[]{"path"}
);

public static String getCategory(String type) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -364,11 +364,20 @@ public static Optional<String> extractServiceAnnotationField(ServiceDeclarationN

if (fieldName.equals(currentFieldName)) {
Optional<ExpressionNode> valueExpr = specificField.valueExpr();
if (valueExpr.isPresent() && valueExpr.get() instanceof BasicLiteralNode literalNode) {
if (valueExpr.isEmpty()) {
return Optional.empty();
}
ExpressionNode expr = valueExpr.get();
if (expr instanceof BasicLiteralNode literalNode) {
String value = literalNode.literalToken().text().trim();
// Remove quotes if present
return Optional.of(value.replace("\"", ""));
}
String value = expr.toSourceCode().trim();
if (!value.isEmpty()) {
return Optional.of(value);
}
return Optional.empty();
}
}
}
Expand Down
1 change: 1 addition & 0 deletions gradle.properties
Original file line number Diff line number Diff line change
Expand Up @@ -83,6 +83,7 @@ graphqlToolVersion=0.14.0

# Ballerinax Module Versions
ballerinaFtpVersion=2.16.0
ballerinaDataCsvVersion=0.8.1
ballerinaxRedisVersion=3.1.0
ballerinaxTriggerSalesforceVersion=0.10.0
ballerinaxGithubVersion=5.1.0
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -131,6 +131,7 @@ jar {
}

test.dependsOn rootProject.pullBallerinaModule('ftp', ballerinaFtpVersion, 'ballerina')
test.dependsOn rootProject.pullBallerinaModule('data.csv', ballerinaDataCsvVersion, 'ballerina')

compileJava {
doFirst {
Expand Down

Large diffs are not rendered by default.

Original file line number Diff line number Diff line change
Expand Up @@ -93,6 +93,7 @@
import java.util.ArrayList;
import java.util.Arrays;
import java.util.HashMap;
import java.util.LinkedHashMap;
import java.util.List;
import java.util.Locale;
import java.util.Map;
Expand Down Expand Up @@ -769,6 +770,7 @@ public static void updateValue(FunctionReturnType target, FunctionReturnType sou
public static List<String> getAnnotationEdits(Service service) {
Map<String, Value> properties = service.getProperties();
List<String> annots = new ArrayList<>();
Map<String, List<String>> serviceAnnotations = new LinkedHashMap<>();
for (Map.Entry<String, Value> property : properties.entrySet()) {
Value value = property.getValue();
if (Objects.nonNull(value.getCodedata()) && Objects.nonNull(value.getCodedata().getType()) &&
Expand All @@ -777,8 +779,31 @@ public static List<String> getAnnotationEdits(Service service) {
+ ":" + value.getCodedata().getOriginalName();
String annotTemplate = "@%s%s".formatted(ref, value.getValue());
annots.add(annotTemplate);
} else if (Objects.nonNull(value.getCodedata()) && Objects.nonNull(value.getCodedata().getType())
&& value.getCodedata().getType().equals("SERVICE_ANNOTATION") && value.isEnabledWithValue()) {
String annotName = value.getCodedata().getOriginalName();
if (annotName == null || annotName.isEmpty()) {
annotName = property.getKey();
}
String moduleName = value.getCodedata().getModuleName();
String ref = "";
if (Objects.nonNull(moduleName) && !moduleName.isEmpty()) {
ref = getProtocol(moduleName) + COLON;
}
ref += annotName;
String fieldValue = value.getLiteralValue();
if (fieldValue != null) {
serviceAnnotations.computeIfAbsent(ref, key -> new ArrayList<>())
.add(property.getKey() + ": " + fieldValue);
}
}
}
for (Map.Entry<String, List<String>> entry : serviceAnnotations.entrySet()) {
String fields = String.join("," + NEW_LINE + " ", entry.getValue());
String annotTemplate = "@%s {%s%s%s}".formatted(entry.getKey(), NEW_LINE,
" " + fields, NEW_LINE);
annots.add(annotTemplate);
}
return annots;
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,9 +5,9 @@
"orgName": "ballerina",
"packageName": "ftp",
"moduleName": "ftp",
"version": "2.16.0",
"version": "2.17.0",
"type": "ftp",
"icon": "https://bcentral-packageicons.azureedge.net/images/ballerina_ftp_2.16.0.png",
"icon": "https://bcentral-packageicons.azureedge.net/images/ballerina_ftp_2.17.0.png",
"properties": {
"designApproach": {
"metadata": {
Expand Down Expand Up @@ -100,36 +100,6 @@
"argType": "LISTENER_PARAM_INCLUDED_DEFAULTABLE_FIELD"
}
},
"folderPath": {
"metadata": {
"label": "Folder Path",
"description": "The folder on the remote server to monitor for file actions (e.g., /uploads or /incoming)"
},
"enabled": true,
"editable": true,
"value": "\"/\"",
"types": [
{
"fieldType": "TEXT",
"ballerinaType": "string",
"selected": true
},
{
"fieldType": "EXPRESSION",
"ballerinaType": "string",
"selected": false
}
],
"valueType": "EXPRESSION",
"valueTypeConstraint": "string",
"isType": false,
"placeholder": "/",
"optional": false,
"advanced": false,
"codedata": {
"argType": "LISTENER_PARAM_INCLUDED_DEFAULTABLE_FIELD"
}
},
"authentication": {
"metadata": {
"label": "Authentication",
Expand Down Expand Up @@ -310,36 +280,6 @@
"argType": "LISTENER_PARAM_INCLUDED_DEFAULTABLE_FIELD"
}
},
"folderPath": {
"metadata": {
"label": "Folder Path",
"description": "The folder on the remote server to monitor for file actions (e.g., /uploads or /incoming)"
},
"enabled": true,
"editable": true,
"value": "\"/\"",
"types": [
{
"fieldType": "TEXT",
"ballerinaType": "string",
"selected": true
},
{
"fieldType": "EXPRESSION",
"ballerinaType": "string",
"selected": false
}
],
"valueType": "EXPRESSION",
"valueTypeConstraint": "string",
"isType": false,
"placeholder": "/",
"optional": false,
"advanced": false,
"codedata": {
"argType": "LISTENER_PARAM_INCLUDED_DEFAULTABLE_FIELD"
}
},
"authentication": {
"metadata": {
"label": "Authentication",
Expand Down Expand Up @@ -402,7 +342,7 @@
"typeMembers": [
{
"type": "PrivateKey",
"packageInfo": "ballerina:ftp:2.16.0",
"packageInfo": "ballerina:ftp:2.17.0",
"packageName": "ftp",
"kind": "RECORD_TYPE",
"selected": true
Expand Down Expand Up @@ -532,36 +472,6 @@
"argType": "LISTENER_PARAM_INCLUDED_DEFAULTABLE_FIELD"
}
},
"folderPath": {
"metadata": {
"label": "Folder Path",
"description": "The folder on the remote server to monitor for file actions (e.g., /uploads or /incoming)"
},
"enabled": true,
"editable": true,
"value": "\"/\"",
"types": [
{
"fieldType": "TEXT",
"ballerinaType": "string",
"selected": true
},
{
"fieldType": "EXPRESSION",
"ballerinaType": "string",
"selected": false
}
],
"valueType": "EXPRESSION",
"valueTypeConstraint": "string",
"isType": false,
"placeholder": "/",
"optional": false,
"advanced": false,
"codedata": {
"argType": "LISTENER_PARAM_INCLUDED_DEFAULTABLE_FIELD"
}
},
"authentication": {
"metadata": {
"label": "Authentication",
Expand Down Expand Up @@ -686,7 +596,7 @@
"typeMembers": [
{
"type": "SecureSocket",
"packageInfo": "ballerina:ftp:2.16.0",
"packageInfo": "ballerina:ftp:2.17.0",
"packageName": "ftp",
"kind": "RECORD_TYPE",
"selected": true
Expand All @@ -712,6 +622,38 @@
}
]
},
"path": {
"metadata": {
"label": "Monitoring Path",
"description": "The folder on the remote server to monitor for file actions (e.g., /uploads or /incoming)"
},
"enabled": true,
"editable": true,
"value": "\"/\"",
"types": [
{
"fieldType": "TEXT",
"ballerinaType": "string",
"selected": true
},
{
"fieldType": "EXPRESSION",
"ballerinaType": "string",
"selected": false
}
],
"valueType": "EXPRESSION",
"valueTypeConstraint": "string",
"isType": false,
"placeholder": "/",
"optional": false,
"advanced": false,
"codedata": {
"type": "SERVICE_ANNOTATION",
"originalName": "ServiceConfig",
"moduleName": "ftp"
}
},
"listenerVarName": {
"metadata": {
"label": "Listener Name",
Expand Down
Loading
Loading