001/*
002 * (C) Copyright 2006-2014 Nuxeo SA (http://nuxeo.com/) and others.
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 */
016
017package org.nuxeo.ecm.user.center.profile;
018
019import org.apache.commons.lang.builder.EqualsBuilder;
020import org.apache.commons.lang.builder.HashCodeBuilder;
021import org.apache.commons.lang.builder.ToStringBuilder;
022import org.apache.commons.logging.Log;
023import org.apache.commons.logging.LogFactory;
024import org.nuxeo.common.annotation.Experimental;
025import org.nuxeo.common.xmap.annotation.XNode;
026import org.nuxeo.common.xmap.annotation.XObject;
027
028/**
029 * @since 7.2
030 */
031@Experimental(comment="https://jira.nuxeo.com/browse/NXP-12200")
032@XObject("importerConfig")
033public class ImporterConfig {
034
035    private static final Log log = LogFactory.getLog(ImporterConfig.class);
036
037    public static final String DEFAULT_DATE_FORMAT = "MM/dd/yyyy";
038
039    public static final String DEFAULT_LIST_SEPARATOR_REGEX = "\\|";
040
041    public static final int DEFAULT_BATCH_SIZE = 50;
042
043    @XNode("dataFile")
044    protected String dataFileName;
045
046    @XNode("dateFormat")
047    protected String dateFormat = DEFAULT_DATE_FORMAT;
048
049    @XNode("listSeparatorRegex")
050    protected String listSeparatorRegex = DEFAULT_LIST_SEPARATOR_REGEX;
051
052    @XNode("updateExisting")
053    protected boolean updateExisting = true;
054
055    @XNode("batchSize")
056    protected int batchSize = DEFAULT_BATCH_SIZE;
057
058    public String getDataFileName() {
059        return dataFileName;
060    }
061
062    public String getDateFormat() {
063        return dateFormat;
064    }
065
066    public String getListSeparatorRegex() {
067        return listSeparatorRegex;
068    }
069
070    public boolean isUpdateExisting() {
071        return updateExisting;
072    }
073
074    public int getBatchSize() {
075        return batchSize;
076    }
077
078    @Override
079    public int hashCode() {
080        return HashCodeBuilder.reflectionHashCode(this);
081    }
082
083    @Override
084    public boolean equals(Object obj) {
085        return EqualsBuilder.reflectionEquals(this, obj);
086    }
087
088    @Override
089    public String toString() {
090        return ToStringBuilder.reflectionToString(this);
091    }
092
093}