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