001/*
002 * (C) Copyright 2006-2018 Nuxeo (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.lang3.builder.EqualsBuilder;
022import org.apache.commons.lang3.builder.HashCodeBuilder;
023import org.apache.commons.lang3.builder.ToStringBuilder;
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    public static final String DEFAULT_DATE_FORMAT = "MM/dd/yyyy";
036
037    public static final String DEFAULT_LIST_SEPARATOR_REGEX = "\\|";
038
039    public static final int DEFAULT_BATCH_SIZE = 50;
040
041    @XNode("dataFile")
042    protected String dataFileName;
043
044    @XNode("dateFormat")
045    protected String dateFormat = DEFAULT_DATE_FORMAT;
046
047    @XNode("listSeparatorRegex")
048    protected String listSeparatorRegex = DEFAULT_LIST_SEPARATOR_REGEX;
049
050    @XNode("updateExisting")
051    protected boolean updateExisting = true;
052
053    @XNode("batchSize")
054    protected int batchSize = DEFAULT_BATCH_SIZE;
055
056    public String getDataFileName() {
057        return dataFileName;
058    }
059
060    public String getDateFormat() {
061        return dateFormat;
062    }
063
064    public String getListSeparatorRegex() {
065        return listSeparatorRegex;
066    }
067
068    public boolean isUpdateExisting() {
069        return updateExisting;
070    }
071
072    public int getBatchSize() {
073        return batchSize;
074    }
075
076    @Override
077    public int hashCode() {
078        return HashCodeBuilder.reflectionHashCode(this);
079    }
080
081    @Override
082    public boolean equals(Object obj) {
083        return EqualsBuilder.reflectionEquals(this, obj);
084    }
085
086    @Override
087    public String toString() {
088        return ToStringBuilder.reflectionToString(this);
089    }
090
091}