001/* 002 * (C) Copyright 2006-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 * Florent Guillaume 016 */ 017package org.nuxeo.ecm.platform.htmlsanitizer; 018 019import java.util.ArrayList; 020import java.util.List; 021 022import org.nuxeo.common.xmap.annotation.XNode; 023import org.nuxeo.common.xmap.annotation.XNodeList; 024import org.nuxeo.common.xmap.annotation.XObject; 025 026@XObject("sanitizer") 027public class HtmlSanitizerDescriptor { 028 029 @XNode("@name") 030 public String name = ""; 031 032 @XNode("@enabled") 033 public boolean enabled = true; 034 035 // unused 036 @XNode("@override") 037 public boolean override = false; 038 039 @XNodeList(value = "type", type = ArrayList.class, componentType = String.class) 040 public final List<String> types = new ArrayList<String>(); 041 042 @XNodeList(value = "field", type = ArrayList.class, componentType = FieldDescriptor.class) 043 public final List<FieldDescriptor> fields = new ArrayList<FieldDescriptor>(); 044 045 @Override 046 public String toString() { 047 StringBuilder buf = new StringBuilder(); 048 buf.append(getClass().getSimpleName()); 049 buf.append('('); 050 buf.append(name); 051 if (!types.isEmpty()) { 052 buf.append(",types="); 053 buf.append(types); 054 } 055 if (!fields.isEmpty()) { 056 buf.append(",fields="); 057 buf.append(fields); 058 } 059 buf.append(')'); 060 return buf.toString(); 061 } 062 063}