001/* 002 * (C) Copyright 2010 Nuxeo SA (http://nuxeo.com/) and others. 003 * 004 * Licensed under the Apache License, Version 2.0 (the "License"); 005 * you may not use this file except in compliance with the License. 006 * You may obtain a copy of the License at 007 * 008 * http://www.apache.org/licenses/LICENSE-2.0 009 * 010 * Unless required by applicable law or agreed to in writing, software 011 * distributed under the License is distributed on an "AS IS" BASIS, 012 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 013 * See the License for the specific language governing permissions and 014 * limitations under the License. 015 * 016 * Contributors: 017 * Anahide Tchertchian 018 */ 019package org.nuxeo.ecm.platform.query.core; 020 021import java.util.HashMap; 022import java.util.Map; 023 024import org.nuxeo.common.xmap.annotation.XNode; 025import org.nuxeo.common.xmap.annotation.XNodeList; 026import org.nuxeo.common.xmap.annotation.XNodeMap; 027import org.nuxeo.common.xmap.annotation.XObject; 028 029/** 030 * @author Anahide Tchertchian 031 * @since 5.4 032 */ 033@XObject("coreQueryPageProvider") 034public class ReferencePageProviderDescriptor { 035 036 @XNode("@name") 037 String name; 038 039 @XNode("@enabled") 040 boolean enabled = true; 041 042 @XNodeMap(value = "property", key = "@name", type = HashMap.class, componentType = String.class) 043 Map<String, String> properties = new HashMap<>(); 044 045 @XNodeList(value = "parameter", type = String[].class, componentType = String.class) 046 String[] queryParameters; 047 048 public String getName() { 049 return name; 050 } 051 052 public boolean isEnabled() { 053 return enabled; 054 } 055 056 public Map<String, String> getProperties() { 057 return properties; 058 } 059 060 public String[] getQueryParameters() { 061 return queryParameters; 062 } 063 064 /** 065 * @since 5.6 066 */ 067 @Override 068 public ReferencePageProviderDescriptor clone() { 069 ReferencePageProviderDescriptor clone = new ReferencePageProviderDescriptor(); 070 clone.name = getName(); 071 clone.enabled = isEnabled(); 072 Map<String, String> props = getProperties(); 073 if (props != null) { 074 clone.properties = new HashMap<>(); 075 clone.properties.putAll(props); 076 } 077 String[] params = getQueryParameters(); 078 if (params != null) { 079 clone.queryParameters = params.clone(); 080 } 081 return clone; 082 } 083 084}