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