use of org.eclipse.smarthome.extensionservice.marketplace.internal.model.Node in project smarthome by eclipse.
the class MarketplaceExtensionService method getExtensions.
@Override
public List<Extension> getExtensions(Locale locale) {
List<Node> nodes = proxy.getNodes();
List<Extension> exts = new ArrayList<>(nodes.size());
for (Node node : nodes) {
if (node.id == null) {
// workaround for bug https://bugs.eclipse.org/bugs/show_bug.cgi?id=512493
continue;
}
if (toMaturityLevel(node.status) < this.maturityLevel) {
continue;
}
if (!includeBindings && node.packagetypes.equals(MP_PACKAGETYPE_BINDING)) {
continue;
}
if (!includeRuleTemplates && node.packagetypes.equals(MP_PACKAGETYPE_RULE_TEMPLATE)) {
continue;
}
MarketplaceExtension ext = convertToExtension(node);
if (ext != null) {
if (setInstalledFlag(ext)) {
exts.add(ext);
}
}
}
return exts;
}
use of org.eclipse.smarthome.extensionservice.marketplace.internal.model.Node in project smarthome by eclipse.
the class MarketplaceExtensionServiceTest method createBindingNode.
private Node createBindingNode() {
Node node = new Node();
node.id = "3305842";
node.packagetypes = "binding";
return node;
}
use of org.eclipse.smarthome.extensionservice.marketplace.internal.model.Node in project smarthome by eclipse.
the class MarketplaceExtensionServiceTest method createRuleNode.
private Node createRuleNode() {
Node node = new Node();
node.id = "3459873";
node.packagetypes = "rule_template";
node.packageformat = "json";
return node;
}
use of org.eclipse.smarthome.extensionservice.marketplace.internal.model.Node in project smarthome by eclipse.
the class MarketplaceExtensionService method extractExensionId.
private String extractExensionId(URI uri) {
Matcher idMatcher = EXTENSION_ID_PATTERN.matcher(uri.getQuery());
String id = null;
if (idMatcher.matches() && idMatcher.groupCount() > 1) {
id = idMatcher.group(1);
}
Optional<Node> extensionNode = getExtensionNode(id);
return extensionNode.isPresent() ? getExtensionId(extensionNode.get()) : null;
}
Aggregations