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.util.ArrayList; 023import java.util.List; 024 025import org.nuxeo.common.xmap.annotation.XNode; 026import org.nuxeo.common.xmap.annotation.XNodeList; 027import org.nuxeo.common.xmap.annotation.XObject; 028import org.nuxeo.ecm.directory.DirectoryException; 029 030/** 031 * Directory ui descriptor 032 * 033 * @author Anahide Tchertchian 034 */ 035@XObject("directory") 036public class DirectoryUIDescriptor implements DirectoryUI { 037 038 private static final long serialVersionUID = 1L; 039 040 @XNode("@name") 041 String name; 042 043 @XNode("@view") 044 String view; 045 046 @XNode("@layout") 047 String layout; 048 049 @XNode("@sortField") 050 String sortField; 051 052 @XNode("@enabled") 053 Boolean enabled; 054 055 @XNode("@readOnly") 056 Boolean readOnly; 057 058 @XNodeList(value = "deleteConstraint", type = ArrayList.class, componentType = DirectoryUIDeleteConstraintDescriptor.class) 059 List<DirectoryUIDeleteConstraintDescriptor> deleteConstraints; 060 061 public String getName() { 062 return name; 063 } 064 065 public String getLayout() { 066 return layout; 067 } 068 069 public String getView() { 070 return view; 071 } 072 073 public String getSortField() { 074 return sortField; 075 } 076 077 public Boolean isEnabled() { 078 return enabled; 079 } 080 081 public Boolean isReadOnly() { 082 return readOnly; 083 } 084 085 public List<DirectoryUIDeleteConstraint> getDeleteConstraints() throws DirectoryException { 086 List<DirectoryUIDeleteConstraint> res = new ArrayList<DirectoryUIDeleteConstraint>(); 087 if (deleteConstraints != null) { 088 for (DirectoryUIDeleteConstraintDescriptor deleteConstraintDescriptor : deleteConstraints) { 089 res.add(deleteConstraintDescriptor.getDeleteConstraint()); 090 } 091 } 092 return res; 093 } 094 095}