Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

refactor(#3139): Remove deprecated IParameterExtractor.selectedTreeNodesInternalNames #3459

Merged
merged 1 commit into from
Feb 7, 2025
Merged
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
Original file line number Diff line number Diff line change
Expand Up @@ -65,14 +65,6 @@ public interface IParameterExtractor {
<V> List<V> selectedTreeNodesInternalNames(String internalName,
Class<V> targetClass);

/**
* @deprecated use {@link #selectedTreeNodesInternalNames(String, Class)} instead
*/
@Deprecated(since = "0.97.0", forRemoval = true)
<V> List<V> selectedTreeNodesInternalNames(String internalName,
Class<V> targetClass,
boolean onlyDataNodes);

<W extends StaticProperty> W getStaticPropertyByName(String internalName, Class<W>
spType);

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,6 @@
import org.apache.streampipes.model.staticproperty.StaticPropertyAlternatives;
import org.apache.streampipes.model.staticproperty.StaticPropertyGroup;
import org.apache.streampipes.model.staticproperty.StaticPropertyType;
import org.apache.streampipes.model.staticproperty.TreeInputNode;
import org.apache.streampipes.sdk.utils.Datatypes;

import com.github.drapostolos.typeparser.TypeParser;
Expand Down Expand Up @@ -279,60 +278,6 @@ public <V> List<V> selectedTreeNodesInternalNames(
.toList();
}

@Override
@Deprecated(since = "0.97.0", forRemoval = true)
/**
* This method returns a list of all nodes.
* Therefore, it requires both the property selectedNodesInternalNames and the nodes property to be set.
* The nodes are used to check for the data type. The problem with this implementation is, is that the client (e.g.
* UI) must get the nodes from the OPC UA server.
*
* @deprecated use {@link #selectedTreeNodesInternalNames(String, Class)} instead
*/
public <V> List<V> selectedTreeNodesInternalNames(
String internalName,
Class<V> targetClass,
boolean onlyDataNodes
) {
List<TreeInputNode> allNodes = new ArrayList<>();
RuntimeResolvableTreeInputStaticProperty sp =
getStaticPropertyByName(internalName, RuntimeResolvableTreeInputStaticProperty.class);
if (!sp.getNodes()
.isEmpty()) {
sp.getNodes()
.forEach(node -> buildFlatTree(node, allNodes));
}

if (!allNodes.isEmpty()) {
return sp.getSelectedNodesInternalNames()
.stream()
.filter(node -> {
if (!onlyDataNodes) {
return true;
} else {
var existingNode = allNodes.stream()
.filter(n -> n.getInternalNodeName()
.equals(node))
.findFirst();
return existingNode.map(TreeInputNode::isDataNode)
.orElse(false);
}
})
.map(node -> typeParser.parse(node, targetClass))
.collect(Collectors.toList());
} else {
return new ArrayList<>();
}
}

private void buildFlatTree(TreeInputNode parent, List<TreeInputNode> collector) {
collector.add(parent);
if (parent.hasChildren()) {
parent.getChildren()
.forEach(child -> buildFlatTree(child, collector));
}
}

@Override
public <W extends StaticProperty> W getStaticPropertyByName(
String internalName, Class<W>
Expand Down
Loading