DevicesResourceConverter.java 1.63 KB
/*
 * Decompiled with CFR 0_118.
 * 
 * Could not load the following classes:
 *  com.adobe.granite.rest.converter.ResourceConverter
 *  com.adobe.granite.rest.converter.ResourceConverterContext
 *  com.adobe.granite.rest.converter.ResourceConverterException
 *  com.adobe.granite.rest.converter.siren.AbstractPageableSirenConverter
 *  com.adobe.reef.siren.Entity
 *  org.apache.sling.api.resource.Resource
 *  org.slf4j.Logger
 */
package com.adobe.cq.screens.impl.rest;

import com.adobe.cq.screens.impl.rest.DeviceResource;
import com.adobe.granite.rest.converter.ResourceConverter;
import com.adobe.granite.rest.converter.ResourceConverterContext;
import com.adobe.granite.rest.converter.ResourceConverterException;
import com.adobe.granite.rest.converter.siren.AbstractPageableSirenConverter;
import com.adobe.reef.siren.Entity;
import org.apache.sling.api.resource.Resource;
import org.slf4j.Logger;

public class DevicesResourceConverter
extends AbstractPageableSirenConverter {
    public DevicesResourceConverter(Resource resource) {
        super(resource);
    }

    protected String[] getClazz() {
        return new String[]{"screens/devices"};
    }

    protected Entity getEntity(ResourceConverterContext context, Resource child) throws ResourceConverterException {
        if (child instanceof DeviceResource) {
            ResourceConverter renderer = (ResourceConverter)child.adaptTo(ResourceConverter.class);
            if (renderer != null) {
                return (Entity)renderer.toSubEntity(context);
            }
            this.log.error("Could not adapt DeviceResource to ResourceConverter");
        }
        return null;
    }
}