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 java.io.Serializable; 020import java.util.HashMap; 021import java.util.Map; 022 023import org.nuxeo.common.xmap.annotation.XNode; 024import org.nuxeo.common.xmap.annotation.XNodeList; 025import org.nuxeo.common.xmap.annotation.XNodeMap; 026import org.nuxeo.common.xmap.annotation.XObject; 027 028/** 029 * @author Anahide Tchertchian 030 * @since 5.4 031 */ 032@XObject("coreQueryPageProvider") 033public class ReferencePageProviderDescriptor implements Serializable { 034 035 private static final long serialVersionUID = 1L; 036 037 @XNode("@name") 038 String name; 039 040 @XNode("@enabled") 041 boolean enabled = true; 042 043 @XNodeMap(value = "property", key = "@name", type = HashMap.class, componentType = String.class) 044 Map<String, String> properties = new HashMap<String, String>(); 045 046 @XNodeList(value = "parameter", type = String[].class, componentType = String.class) 047 String[] queryParameters; 048 049 public String getName() { 050 return name; 051 } 052 053 public boolean isEnabled() { 054 return enabled; 055 } 056 057 public Map<String, String> getProperties() { 058 return properties; 059 } 060 061 public String[] getQueryParameters() { 062 return queryParameters; 063 } 064 065 /** 066 * @since 5.6 067 */ 068 @Override 069 public ReferencePageProviderDescriptor clone() { 070 ReferencePageProviderDescriptor clone = new ReferencePageProviderDescriptor(); 071 clone.name = getName(); 072 clone.enabled = isEnabled(); 073 Map<String, String> props = getProperties(); 074 if (props != null) { 075 clone.properties = new HashMap<String, String>(); 076 clone.properties.putAll(props); 077 } 078 String[] params = getQueryParameters(); 079 if (params != null) { 080 clone.queryParameters = params.clone(); 081 } 082 return clone; 083 } 084 085}