001/* 002 * (C) Copyright 2006-2007 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 * Florent Guillaume 016 * 017 * $Id: SourceDescriptor.java 24597 2007-09-05 16:04:04Z fguillaume $ 018 */ 019 020package org.nuxeo.ecm.directory.multi; 021 022import java.util.Arrays; 023 024import org.nuxeo.common.xmap.annotation.XNode; 025import org.nuxeo.common.xmap.annotation.XNodeList; 026import org.nuxeo.common.xmap.annotation.XObject; 027 028/** 029 * @author Florent Guillaume 030 */ 031@XObject("source") 032public class SourceDescriptor { 033 034 @XNode("@name") 035 public String name; 036 037 @XNode("@creation") 038 public boolean creation; 039 040 @XNodeList(value = "subDirectory", type = SubDirectoryDescriptor[].class, componentType = SubDirectoryDescriptor.class) 041 public SubDirectoryDescriptor[] subDirectories; 042 043 @Override 044 public String toString() { 045 return String.format("{source name=%s subDirectories=%s", name, Arrays.toString(subDirectories)); 046 } 047 048 /** 049 * @since 5.6 050 */ 051 public SourceDescriptor clone() { 052 SourceDescriptor clone = new SourceDescriptor(); 053 clone.name = name; 054 clone.creation = creation; 055 if (subDirectories != null) { 056 clone.subDirectories = new SubDirectoryDescriptor[subDirectories.length]; 057 for (int i = 0; i < subDirectories.length; i++) { 058 clone.subDirectories[i] = subDirectories[i].clone(); 059 } 060 } 061 return clone; 062 } 063 064}