<commit_before>/*
 * Axelor Business Solutions
 *
 * Copyright (C) 2005-2017 Axelor (<http://axelor.com>).
 *
 * This program is free software: you can redistribute it and/or  modify
 * it under the terms of the GNU Affero General Public License, version 3,
 * as published by the Free Software Foundation.
 *
 * This program is distributed in the hope that it will be useful,
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 * GNU Affero General Public License for more details.
 *
 * You should have received a copy of the GNU Affero General Public License
 * along with this program.  If not, see <http://www.gnu.org/licenses/>.
 */
package com.axelor.data.csv;

import java.util.List;
import java.util.Map;
import java.util.Set;
import java.util.regex.Matcher;
import java.util.regex.Pattern;

import org.codehaus.groovy.runtime.InvokerHelper;

import com.axelor.data.DataScriptHelper;
import com.axelor.inject.Beans;
import com.google.common.base.Function;
import com.google.common.base.Joiner;
import com.google.common.base.MoreObjects;
import com.google.common.base.Strings;
import com.google.common.collect.Collections2;
import com.google.common.collect.Lists;
import com.thoughtworks.xstream.annotations.XStreamAlias;
import com.thoughtworks.xstream.annotations.XStreamAsAttribute;
import com.thoughtworks.xstream.annotations.XStreamImplicit;

@XStreamAlias("bind")
public class CSVBind {

	public static Pattern pattern = Pattern.compile("^(call|eval):\\s*(.*)");

	@XStreamAsAttribute
	private String column;

	@XStreamAlias("to")
	@XStreamAsAttribute
	private String field;

	@XStreamAsAttribute
	private String type;

	@XStreamAsAttribute
	private String search;

	@XStreamAsAttribute
	private boolean update;

	@XStreamAlias("eval")
	@XStreamAsAttribute
	private String expression;

	@XStreamAlias("if")
	@XStreamAsAttribute
	private String condition;

	@XStreamAlias("if-empty")
	@XStreamAsAttribute
	private Boolean conditionEmpty;

	@XStreamImplicit(itemFieldName = "bind")
	private List<CSVBind> bindings;

	@XStreamAsAttribute
	private String adapter;

	public String getColumn() {
		return column;
	}

	public void setColumn(String column) {
		this.column = column;
	}

	public String getField() {
		return field;
	}

	public void setField(String field) {
		this.field = field;
	}

	public String getType() {
		return type;
	}

	public String getSearch() {
		return search;
	}

	public boolean isUpdate() {
		return update;
	}

	public String getExpression() {
		return expression;
	}

	public void setExpression(String expression) {
		this.expression = expression;
	}

	public String getCondition() {
		return condition;
	}

	public void setCondition(String condition) {
		this.condition = condition;
	}

	public Boolean getConditionEmpty() {
		return conditionEmpty;
	}

	public void setConditionEmpty(Boolean conditionEmpty) {
		this.conditionEmpty = conditionEmpty;
	}

	public List<CSVBind> getBindings() {
		return bindings;
	}

	public String getAdapter() {
		return adapter;
	}

	public static CSVBind getBinding(final String column, final String field, Set<String> cols) {
		CSVBind cb = new CSVBind();
		cb.field = field;
		cb.column = column;

		if (cols == null || cols.isEmpty()) {
			if (cb.column == null)
				cb.column = field;
			return cb;
		}<commit_msg>Add missing setters on CSVBind class<commit_after>/*
 * Axelor Business Solutions
 *
 * Copyright (C) 2005-2017 Axelor (<http://axelor.com>).
 *
 * This program is free software: you can redistribute it and/or  modify
 * it under the terms of the GNU Affero General Public License, version 3,
 * as published by the Free Software Foundation.
 *
 * This program is distributed in the hope that it will be useful,
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 * GNU Affero General Public License for more details.
 *
 * You should have received a copy of the GNU Affero General Public License
 * along with this program.  If not, see <http://www.gnu.org/licenses/>.
 */
package com.axelor.data.csv;

import java.util.List;
import java.util.Map;
import java.util.Set;
import java.util.regex.Matcher;
import java.util.regex.Pattern;

import org.codehaus.groovy.runtime.InvokerHelper;

import com.axelor.data.DataScriptHelper;
import com.axelor.inject.Beans;
import com.google.common.base.Function;
import com.google.common.base.Joiner;
import com.google.common.base.MoreObjects;
import com.google.common.base.Strings;
import com.google.common.collect.Collections2;
import com.google.common.collect.Lists;
import com.thoughtworks.xstream.annotations.XStreamAlias;
import com.thoughtworks.xstream.annotations.XStreamAsAttribute;
import com.thoughtworks.xstream.annotations.XStreamImplicit;

@XStreamAlias("bind")
public class CSVBind {

	public static Pattern pattern = Pattern.compile("^(call|eval):\\s*(.*)");

	@XStreamAsAttribute
	private String column;

	@XStreamAlias("to")
	@XStreamAsAttribute
	private String field;

	@XStreamAsAttribute
	private String type;

	@XStreamAsAttribute
	private String search;

	@XStreamAsAttribute
	private boolean update;

	@XStreamAlias("eval")
	@XStreamAsAttribute
	private String expression;

	@XStreamAlias("if")
	@XStreamAsAttribute
	private String condition;

	@XStreamAlias("if-empty")
	@XStreamAsAttribute
	private Boolean conditionEmpty;

	@XStreamImplicit(itemFieldName = "bind")
	private List<CSVBind> bindings;

	@XStreamAsAttribute
	private String adapter;

	public String getColumn() {
		return column;
	}

	public void setColumn(String column) {
		this.column = column;
	}

	public String getField() {
		return field;
	}

	public void setField(String field) {
		this.field = field;
	}

	public String getType() {
		return type;
	}

	public void setType(String type) {
		this.type = type;
	}

	public String getSearch() {
		return search;
	}

	public void setSearch(String search) {
		this.search = search;
	}

	public boolean isUpdate() {
		return update;
	}

	public void setUpdate(boolean update) {
		this.update = update;
	}

	public String getExpression() {
		return expression;
	}

	public void setExpression(String expression) {
		this.expression = expression;
	}

	public String getCondition() {
		return condition;
	}

	public void setCondition(String condition) {
		this.condition = condition;
	}

	public Boolean getConditionEmpty() {
		return conditionEmpty;
	}

	public void setConditionEmpty(Boolean conditionEmpty) {
		this.conditionEmpty = conditionEmpty;
	}

	public List<CSVBind> getBindings() {
		return bindings;
	}

	public void setBindings(List<CSVBind> bindings) {
		this.bindings = bindings;
	}

	public String getAdapter() {
		return adapter;
	}

	public void setAdapter(String adapter) {
		this.adapter = adapter;
	}

	public static CSVBind getBinding(final String column, final String field, Set<String> cols) {
		CSVBind cb = new CSVBind();
		cb.field = field;
		cb.column = column;

		if (cols == null || cols.isEmpty()) {
			if (cb.column == null)
				cb.column = field;
			return cb;
		}
{'fraction_non_alphanumeric': 0.09807773256629718, 'fraction_numerical': 0.002806229830223095, 'mean_word_length': 4.437070938215103, 'pattern_counts': {'":': 0, '<': 14, '<?xml version=': 0, '>': 14, 'https://': 0, 'lorem ipsum': 0, 'www.': 2, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '6538395', 'n_tokens_mistral': 2300, 'n_tokens_neox': 2125, 'n_words': 635}