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