001/*
002 * (C) Copyright 2002-2013 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 *     Nuxeo - initial API and implementation
016 *
017 */
018
019package org.nuxeo.ecm.platform.importer.xml.parser;
020
021import org.nuxeo.common.xmap.annotation.XNode;
022import org.nuxeo.common.xmap.annotation.XObject;
023
024/**
025 * Descriptor that is used to define how DocumenModel should be created from XML input
026 *
027 * @author <a href="mailto:tdelprat@nuxeo.com">Tiry</a>
028 */
029@XObject("docConfig")
030public class DocConfigDescriptor {
031
032    @XNode("@tagName")
033    protected String tagName;
034
035    @XNode("docType")
036    protected String docType;
037
038    @XNode("parent")
039    protected String parent;
040
041    @XNode("name")
042    protected String name;
043
044    @XNode("postCreationAutomationChain")
045    protected String automationChain;
046
047    @XNode("@updateExistingDocuments")
048    protected boolean update = false;
049
050    
051    public DocConfigDescriptor() {
052    }
053
054    public DocConfigDescriptor(String tagName, String docType, String parent, String name) {
055        this.tagName = tagName;
056        this.docType = docType;
057        this.parent = parent;
058        this.name = name;
059    }
060
061    public String getTagName() {
062        return tagName;
063    }
064
065    public String getDocType() {
066        return docType;
067    }
068
069    public String getParent() {
070        return parent;
071    }
072
073    public String getName() {
074        return name;
075    }
076
077    public boolean getUpdate() {
078        return update;
079    }
080
081    public String getAutomationChain() {
082        return automationChain;
083    }
084
085    @Override
086    public String toString() {
087        String msg = "\nDocConfig:\n\tTag Name: %s\n\tDocType %s\n\tParent: %s\n\tName: %s\n\tOverwrite: %s\n";
088        return String.format(msg, tagName, docType, parent, name, update);
089    }
090
091}