001/* 002 * (C) Copyright 2006-2008 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.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 * <a href="mailto:at@nuxeo.com">Anahide Tchertchian</a> 016 * 017 * $Id: $ 018 */ 019 020package org.nuxeo.ecm.directory.api.ui; 021 022import java.io.Serializable; 023import java.util.HashMap; 024import java.util.Map; 025 026import org.nuxeo.common.xmap.annotation.XNode; 027import org.nuxeo.common.xmap.annotation.XNodeMap; 028import org.nuxeo.common.xmap.annotation.XObject; 029import org.nuxeo.ecm.directory.DirectoryException; 030 031/** 032 * Directory ui descriptor 033 * 034 * @author Anahide Tchertchian 035 */ 036@XObject("deleteConstraint") 037public class DirectoryUIDeleteConstraintDescriptor implements Serializable { 038 039 private static final long serialVersionUID = 1L; 040 041 @XNode("@class") 042 protected Class<? extends DirectoryUIDeleteConstraint> klass; 043 044 @XNodeMap(value = "property", key = "@name", type = HashMap.class, componentType = String.class) 045 protected Map<String, String> properties = new HashMap<String, String>(); 046 047 public Class<? extends DirectoryUIDeleteConstraint> getKlass() { 048 return klass; 049 } 050 051 public Map<String, String> getProperties() { 052 return properties; 053 } 054 055 public DirectoryUIDeleteConstraint getDeleteConstraint() throws DirectoryException { 056 try { 057 DirectoryUIDeleteConstraint instance = klass.newInstance(); 058 if (properties != null) { 059 instance.setProperties(properties); 060 } 061 return instance; 062 } catch (InstantiationException e) { 063 throw new DirectoryException(e); 064 } catch (IllegalAccessException e) { 065 throw new DirectoryException(e); 066 } 067 } 068 069}