001/*
002 * (C) Copyright 2014 Nuxeo SAS (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-2.1.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 *     Benoit Delbosc
016 *
017 */
018
019package org.nuxeo.ecm.platform.query.core;
020
021import java.util.Arrays;
022import java.util.List;
023
024import org.nuxeo.common.xmap.annotation.XNode;
025import org.nuxeo.common.xmap.annotation.XNodeList;
026import org.nuxeo.common.xmap.annotation.XObject;
027import org.nuxeo.ecm.platform.query.api.PageProviderClassReplacerDefinition;
028
029/**
030 * @since 6.0
031 */
032@XObject(value = "replacer")
033public class PageProviderClassReplacerDescriptor implements PageProviderClassReplacerDefinition {
034    private static final long serialVersionUID = 1L;
035
036    @XNode("@withClass")
037    public String className;
038
039    @XNode("@enabled")
040    protected boolean enabled = true;
041
042    @Override
043    public boolean isEnabled() {
044        return enabled;
045    }
046
047    public void setEnabled(boolean enabled) {
048        this.enabled = enabled;
049    }
050
051    @XNodeList(value = "provider", type = String[].class, componentType = String.class)
052    String[] names = new String[0];
053
054    @Override
055    public List<String> getPageProviderNames() {
056        return Arrays.asList(names);
057    }
058
059    @Override
060    public String getPageProviderClassName() {
061        return className;
062    }
063}