Search in sources :

Example 1 with Node

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;
}
Also used : Extension(org.eclipse.smarthome.core.extension.Extension) MarketplaceExtension(org.eclipse.smarthome.extensionservice.marketplace.MarketplaceExtension) MarketplaceExtension(org.eclipse.smarthome.extensionservice.marketplace.MarketplaceExtension) Node(org.eclipse.smarthome.extensionservice.marketplace.internal.model.Node) ArrayList(java.util.ArrayList)

Example 2 with Node

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;
}
Also used : Node(org.eclipse.smarthome.extensionservice.marketplace.internal.model.Node)

Example 3 with 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;
}
Also used : Node(org.eclipse.smarthome.extensionservice.marketplace.internal.model.Node)

Example 4 with 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;
}
Also used : Matcher(java.util.regex.Matcher) Node(org.eclipse.smarthome.extensionservice.marketplace.internal.model.Node)

Aggregations

Node (org.eclipse.smarthome.extensionservice.marketplace.internal.model.Node)4 ArrayList (java.util.ArrayList)1 Matcher (java.util.regex.Matcher)1 Extension (org.eclipse.smarthome.core.extension.Extension)1 MarketplaceExtension (org.eclipse.smarthome.extensionservice.marketplace.MarketplaceExtension)1