DeviceManagerImpl.java 3.17 KB
/*
 * Decompiled with CFR 0_118.
 * 
 * Could not load the following classes:
 *  javax.annotation.Nonnull
 *  javax.jcr.RepositoryException
 *  org.apache.commons.collections.Predicate
 *  org.apache.sling.api.resource.ResourceResolver
 *  org.apache.sling.commons.json.JSONException
 *  org.apache.sling.commons.json.JSONObject
 */
package com.adobe.cq.screens.device.impl;

import com.adobe.cq.screens.device.Device;
import com.adobe.cq.screens.device.DeviceConfig;
import com.adobe.cq.screens.device.DeviceManager;
import com.adobe.cq.screens.device.DeviceStatus;
import com.adobe.cq.screens.device.impl.DeviceService;
import java.util.Iterator;
import javax.annotation.Nonnull;
import javax.jcr.RepositoryException;
import org.apache.commons.collections.Predicate;
import org.apache.sling.api.resource.ResourceResolver;
import org.apache.sling.commons.json.JSONException;
import org.apache.sling.commons.json.JSONObject;

public class DeviceManagerImpl
implements DeviceManager {
    private final DeviceService service;
    private final ResourceResolver resolver;

    public DeviceManagerImpl(DeviceService service, ResourceResolver resolver) {
        this.service = service;
        this.resolver = resolver;
    }

    @Override
    public DeviceStatus getDeviceStatus(String deviceId) {
        return this.service.getDeviceStatus(this.resolver, deviceId);
    }

    @Override
    public Device createDevice(String tenant) throws RepositoryException {
        return this.service.createDevice(this.resolver, tenant);
    }

    @Override
    public void deleteDevice(String deviceId) throws RepositoryException {
        this.service.deleteDevice(this.resolver, deviceId);
    }

    @Nonnull
    @Override
    public String updatePassword(@Nonnull Device device) throws RepositoryException {
        return this.service.setPassword(this.resolver, device);
    }

    @Nonnull
    @Override
    public Device setMetadata(@Nonnull Device device, @Nonnull JSONObject metadata) throws JSONException, RepositoryException {
        return this.service.setMetadata(this.resolver, device, metadata);
    }

    @Nonnull
    @Override
    public Device getDevice(@Nonnull String deviceId) {
        return this.service.getDevice(this.resolver, deviceId);
    }

    @Nonnull
    @Override
    public Iterator<Device> getDevices(Predicate predicate) {
        return this.service.getDevices(this.resolver, predicate);
    }

    @Nonnull
    @Override
    public Iterator<Device> getDevices() {
        return this.service.getDevices(this.resolver, null);
    }

    @Nonnull
    @Override
    public Device assignDeviceConfig(@Nonnull Device device, @Nonnull DeviceConfig config) throws RepositoryException {
        return this.service.assignDeviceConfig(this.resolver, device, config);
    }

    @Nonnull
    @Override
    public Device assignDisplay(@Nonnull Device device, @Nonnull String displayPath) throws RepositoryException {
        return this.service.assignDisplay(this.resolver, device, displayPath);
    }

    @Nonnull
    @Override
    public Device removeDisplay(@Nonnull Device device, boolean removeConfig) throws RepositoryException {
        return this.service.removeDisplay(this.resolver, device, removeConfig);
    }
}