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