001/*
002 * (C) Copyright 2006 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 *     Nuxeo - initial API and implementation
018 *
019 *
020 * $Id: PluginExtension.java 3036 2006-09-18 17:32:20Z janguenot $
021 */
022
023package org.nuxeo.ecm.platform.filemanager.service.extension;
024
025import java.io.Serializable;
026import java.util.ArrayList;
027import java.util.List;
028
029import org.nuxeo.common.xmap.annotation.XNode;
030import org.nuxeo.common.xmap.annotation.XNodeList;
031import org.nuxeo.common.xmap.annotation.XObject;
032
033/**
034 * @author akalogeropoulos
035 */
036@XObject("plugin")
037public class FileImporterDescriptor implements Serializable {
038
039    public static final List<String> DEFAULT_FILTER = new ArrayList<String>();
040
041    private static final long serialVersionUID = 1L;
042
043    @XNode("@enabled")
044    boolean enabled = true;
045
046    @XNode("@name")
047    protected String name;
048
049    @XNode("@class")
050    protected String className;
051
052    @XNode("@docType")
053    protected String docType;
054
055    @XNodeList(value = "filter", type = ArrayList.class, componentType = String.class)
056    protected List<String> filters = DEFAULT_FILTER;
057
058    @XNode("@filter")
059    protected String filter;
060
061    @XNode("@order")
062    private Integer order;
063
064    @XNode("@merge")
065    private boolean merge = false;
066
067    public String getName() {
068        return name;
069    }
070
071    public void setName(String name) {
072        this.name = name;
073    }
074
075    public String getClassName() {
076        return className;
077    }
078
079    public void setClassName(String className) {
080        this.className = className;
081    }
082
083    /**
084     * Returns the configured document type to be created when using the importer
085     *
086     * @since 5.5
087     */
088    public String getDocType() {
089        return docType;
090    }
091
092    public String getFilter() {
093        return filter;
094    }
095
096    public void setFilter(String filter) {
097        this.filter = filter;
098    }
099
100    public List<String> getFilters() {
101        return filters;
102    }
103
104    public void setFilters(List<String> filters) {
105        this.filters = filters;
106    }
107
108    public boolean isEnabled() {
109        return enabled;
110    }
111
112    public Integer getOrder() {
113        return order;
114    }
115
116    /**
117     * Returns {@code true} if this {@code FileImporterDescriptor} should be merged with an existing one, {@code false}
118     * otherwise.
119     *
120     * @since 5.5
121     */
122    public boolean isMerge() {
123        return merge;
124    }
125}