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