-
Notifications
You must be signed in to change notification settings - Fork 45
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
77d2d5d
commit 1470a61
Showing
4 changed files
with
141 additions
and
0 deletions.
There are no files selected for viewing
46 changes: 46 additions & 0 deletions
46
...generator-core/src/main/java/io/ballerina/flowmodelgenerator/core/BasicNodeGenerator.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,46 @@ | ||
/* | ||
* Copyright (c) 2024, 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.flowmodelgenerator.core; | ||
|
||
import com.google.gson.Gson; | ||
import com.google.gson.JsonElement; | ||
import io.ballerina.flowmodelgenerator.core.model.FlowNode; | ||
import io.ballerina.tools.text.LinePosition; | ||
import io.ballerina.tools.text.LineRange; | ||
|
||
/** | ||
* Generates information for a node. | ||
* | ||
* @since 1.4.0 | ||
*/ | ||
public class BasicNodeGenerator { | ||
|
||
private final Gson gson; | ||
private final FlowNode nodeToCheckUsages; | ||
|
||
public BasicNodeGenerator(JsonElement nodeToCheckUsages) { | ||
this.gson = new Gson(); | ||
this.nodeToCheckUsages = new Gson().fromJson(nodeToCheckUsages, FlowNode.class); | ||
} | ||
|
||
public LinePosition getNodeStartLocation() { | ||
LineRange lineRange = nodeToCheckUsages.codedata().lineRange(); | ||
return lineRange.startLine(); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
32 changes: 32 additions & 0 deletions
32
...on/src/main/java/io/ballerina/flowmodelgenerator/extension/request/IsNodeUsedRequest.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,32 @@ | ||
/* | ||
* Copyright (c) 2024, 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.flowmodelgenerator.extension.request; | ||
|
||
import com.google.gson.JsonElement; | ||
|
||
/** | ||
* Represents the request to check whether a particular node is used. | ||
* | ||
* @param filePath file path of the source file | ||
* @param flowNode flow node | ||
* @since 1.4.0 | ||
*/ | ||
public record IsNodeUsedRequest(String filePath, JsonElement flowNode) { | ||
|
||
} |
37 changes: 37 additions & 0 deletions
37
.../src/main/java/io/ballerina/flowmodelgenerator/extension/response/IsNodeUsedResponse.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,37 @@ | ||
/* | ||
* Copyright (c) 2024, 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.flowmodelgenerator.extension.response; | ||
|
||
/** | ||
* Represents the response after checking a particular node is used. | ||
* | ||
* @since 1.4.0 | ||
*/ | ||
public class IsNodeUsedResponse extends AbstractFlowModelResponse { | ||
|
||
boolean isUsed; | ||
|
||
public boolean isUsed() { | ||
return isUsed; | ||
} | ||
|
||
public void setUsed(boolean used) { | ||
isUsed = used; | ||
} | ||
} |