import org.apache.sling.api.SlingHttpServletRequest; import org.apache.sling.api.SlingHttpServletResponse; import org.apache.sling.api.resource.Resource; import org.apache.sling.api.resource.ResourceResolver; import org.apache.sling.api.resource.ResourceNotFoundException; import org.apache.sling.api.resource.ResourceResolverFactory; import org.osgi.framework.Constants; import org.osgi.service.component.annotations.Component; import org.osgi.service.component.annotations.Reference; import org.slf4j.Logger; import org.slf4j.LoggerFactory; import com.adobe.cq.commerce.api.Product; import com.adobe.cq.commerce.api.ProductData; import com.adobe.cq.commerce.api.ProductFilter; import com.adobe.cq.commerce.common.AbstractJcrProduct; import com.adobe.cq.commerce.common.AbstractJcrProductData; import com.adobe.cq.commerce.common.AbstractProductData; import com.adobe.cq.commerce.common.PriceImpl; import javax.jcr.Node; import javax.jcr.PropertyIterator; import javax.jcr.RepositoryException; import javax.jcr.Value; import java.math.BigDecimal; import java.util.ArrayList; import java.util.Collection; import java.util.Iterator; import java.util.List; import java.util.Map;
@Component(immediate = true, service = ProductModelProvider.class, property = {
Constants.SERVICE_DESCRIPTION + "= Product Model Provider for AEM Venia Store",
Constants.SERVICE_VENDOR + "= Adobe",
"repository.path=/content/dam/VeniaStore",
"query.stockThreshold=2",
"query.stockFilterValue=In stock"
})
public class AEMProductModelProvider implements ProductModelProvider {
private static final Logger LOGGER = LoggerFactory.getLogger(AEMProductModelProvider.class);
private static final int BATCH_SIZE = 20;
@Reference
private ResourceResolverFactory resourceResolverFactory;
@Override
public Collection