001/* 002 * (C) Copyright 2010 Nuxeo SA (http://nuxeo.com/) and contributors. 003 * 004 * All rights reserved. This program and the accompanying materials 005 * are made available under the terms of the GNU Lesser General Public License 006 * (LGPL) version 2.1 which accompanies this distribution, and is available at 007 * http://www.gnu.org/licenses/lgpl.html 008 * 009 * This library is distributed in the hope that it will be useful, 010 * but WITHOUT ANY WARRANTY; without even the implied warranty of 011 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 012 * Lesser General Public License for more details. 013 * 014 * Contributors: 015 * Anahide Tchertchian 016 */ 017package org.nuxeo.ecm.platform.query.core; 018 019import org.nuxeo.common.xmap.annotation.XNode; 020import org.nuxeo.common.xmap.annotation.XObject; 021import org.nuxeo.ecm.platform.query.api.PageProvider; 022import org.nuxeo.ecm.platform.query.api.PageProviderDefinition; 023 024/** 025 * Page provider descriptor accepting a custom class name. The expected interface is {@link ContentViewPageProvider}, 026 * all other attributes are common to other page provider descriptors. 027 * 028 * @author Anahide Tchertchian 029 * @since 5.4 030 */ 031@XObject("genericPageProvider") 032public class GenericPageProviderDescriptor extends BasePageProviderDescriptor implements PageProviderDefinition { 033 034 private static final long serialVersionUID = 1L; 035 036 @XNode("@class") 037 protected Class<PageProvider<?>> klass; 038 039 public Class<PageProvider<?>> getPageProviderClass() { 040 return klass; 041 } 042 043 @Override 044 protected BasePageProviderDescriptor newInstance() { 045 return new GenericPageProviderDescriptor(); 046 } 047 048 @Override 049 public GenericPageProviderDescriptor clone() { 050 GenericPageProviderDescriptor clone = (GenericPageProviderDescriptor) super.cloneDescriptor(); 051 clone.klass = getPageProviderClass(); 052 return clone; 053 } 054 055}