001/* 002 * Copyright (c) 2006-2011 Nuxeo SA (http://nuxeo.com/) and others. 003 * 004 * All rights reserved. This program and the accompanying materials 005 * are made available under the terms of the Eclipse Public License v1.0 006 * which accompanies this distribution, and is available at 007 * http://www.eclipse.org/legal/epl-v10.html 008 * 009 * Contributors: 010 * Florent Guillaume 011 */ 012package org.nuxeo.ecm.core.schema; 013 014import org.nuxeo.common.xmap.annotation.XNode; 015import org.nuxeo.common.xmap.annotation.XNodeList; 016import org.nuxeo.common.xmap.annotation.XObject; 017 018/** 019 * Facet Descriptor. 020 */ 021@XObject("facet") 022public class FacetDescriptor { 023 024 @XNode("@name") 025 public String name; 026 027 @XNode("@perDocumentQuery") 028 public Boolean perDocumentQuery; 029 030 @XNodeList(value = "schema", type = SchemaDescriptor[].class, componentType = SchemaDescriptor.class) 031 public SchemaDescriptor[] schemas; 032 033 /* empty constructor needed by XMap */ 034 public FacetDescriptor() { 035 } 036 037 public FacetDescriptor(String name, SchemaDescriptor[] schemas) { 038 this.name = name; 039 this.schemas = schemas == null ? new SchemaDescriptor[0] : schemas; 040 } 041 042 @Override 043 public String toString() { 044 return "Facet(" + name + ',' + SchemaDescriptor.getSchemaNames(schemas) + ')'; 045 } 046 047}