Skip to content

Commit

Permalink
refactor(#3139): Remove deprecated IParameterExtractor.selectedTreeNo…
Browse files Browse the repository at this point in the history
…desInternalNames
  • Loading branch information
tenthe committed Feb 3, 2025
1 parent 0341370 commit 13f6fc2
Show file tree
Hide file tree
Showing 2 changed files with 0 additions and 63 deletions.
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

0 comments on commit 13f6fc2

Please sign in to comment.