001/*
002 * (C) Copyright 2013 Nuxeo SA (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-2.1.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 *     Antoine Taillefer <ataillefer@nuxeo.com>
016 */
017package org.nuxeo.drive.service.impl;
018
019import java.io.Serializable;
020import java.util.ArrayList;
021import java.util.List;
022
023import org.nuxeo.common.xmap.annotation.XNode;
024import org.nuxeo.common.xmap.annotation.XNodeList;
025import org.nuxeo.common.xmap.annotation.XObject;
026import org.nuxeo.drive.service.FileSystemItemAdapterService;
027
028/**
029 * XMap descriptor for the {@code activeFileSystemItemFactories} contributions to the
030 * {@code activeFileSystemItemFactories} extension point of the {@link FileSystemItemAdapterService}.
031 *
032 * @author Antoine Taillefer
033 */
034@XObject("activeFileSystemItemFactories")
035public class ActiveFileSystemItemFactoriesDescriptor implements Serializable {
036
037    private static final long serialVersionUID = -6359900042974173427L;
038
039    @XNode("@merge")
040    protected boolean merge = false;
041
042    @XNodeList(value = "factories/factory", type = ArrayList.class, componentType = ActiveFileSystemItemFactoryDescriptor.class)
043    protected List<ActiveFileSystemItemFactoryDescriptor> factories;
044
045    public boolean isMerge() {
046        return merge;
047    }
048
049    public void setMerge(boolean merge) {
050        this.merge = merge;
051    }
052
053    public List<ActiveFileSystemItemFactoryDescriptor> getFactories() {
054        return factories;
055    }
056
057    public void setFactories(List<ActiveFileSystemItemFactoryDescriptor> factories) {
058        this.factories = factories;
059    }
060
061    @Override
062    public String toString() {
063        StringBuilder sb = new StringBuilder("<merge = ");
064        sb.append(merge);
065        sb.append(", [");
066        for (ActiveFileSystemItemFactoryDescriptor factory : factories) {
067            sb.append(factory);
068            sb.append(", ");
069        }
070        sb.append("]>");
071        return sb.toString();
072    }
073
074}