<commit_before>/*
 * Odoo, Open Source Management Solution
 * Copyright (C) 2012-today Odoo SA (<http:www.odoo.com>)
 * 
 * This program is free software: you can redistribute it and/or modify
 * it under the terms of the GNU Affero General Public License as
 * published by the Free Software Foundation, either version 3 of the
 * License, or (at your option) any later version
 * 
 * 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.odoo.support;

import android.accounts.Account;
import android.accounts.AccountManager;
import android.content.Context;
import android.os.Bundle;

import com.odoo.auth.OdooAccountManager;

/**
 * The Class UserObject.
 */
public class OUser {

	/** The username. */
	private String username;

	/** The name. */
	private String name;

	/** The user_id. */
	private int user_id;

	/** The partner_id. */
	private int partner_id;

	/** The timezone. */
	private String timezone;

	/** The isactive. */
	private boolean isactive;

	/** The avatar. */
	private String avatar;

	/** The database. */
	private String database;

	/** The host. */
	private String host;

	/** The android_name. */
	private String android_name;

	/** The password. */
	private String password;

	/** The company_id. */
	private String company_id;

	/** The allow_self_signed_ssl. */
	private boolean allow_self_signed_ssl = false;

	/** The oauth_login. */
	private boolean oauth_login = false;

	/** The version_number. */
	private Integer version_number = 0;

	/** The version_serie. */
	private String version_serie = null;

	// If oauth login
	/** The instance_url. */
	private String instance_url = null;

	/** The instance_database. */
	private String instance_database = null;

	/** The client_id. */
	private String client_id = null;

	/**
	 * Gets the name.
	 * 
	 * @return the name
	 */
	public String getName() {
		return name;
	}

	/**
	 * Sets the name.
	 * 
	 * @param name
	 *            the new name
	 */
	public void setName(String name) {
		this.name = name;
	}

	/**
	 * Gets the company_id.
	 * 
	 * @return the company_id
	 */
	public String getCompany_id() {
		return company_id;
	}

	/**
	 * Sets the company_id.
	 * 
	 * @param company_id
	 *            the new company_id
	 */
	public void setCompany_id(String company_id) {
		this.company_id = company_id;
	}

	/**
	 * Gets the data as bundle.
	 * 
	 * @return the as bundle
	 */
	public Bundle getAsBundle() {
		Bundle bundle = new Bundle();
		bundle.putString("name", this.getName());
		bundle.putString("username", this.getUsername());
		bundle.putString("user_id", this.getUser_id() + "");
		bundle.putString("partner_id", this.getPartner_id() + "");
		bundle.putString("timezone", this.getTimezone());
		bundle.putString("isactive", String.valueOf(this.isIsactive()));
		bundle.putString("avatar", this.getAvatar());
		bundle.putString("database", this.getDatabase());
		bundle.putString("host", this.getHost());
		bundle.putString("android_name", this.getAndroidName());
		bundle.putString("password", <PASSWORD>());
		bundle.putString("company_id", this.getCompany_id());
		bundle.putString("allow_self_signed_ssl",
				String.valueOf(this.isAllowSelfSignedSSL()));
		bundle.putString("instance_database", this.getInstanceDatabase());
		bundle.putString("instance_url", this.getInstanceUrl());
		bundle.putString("oauth_login", this.isOAauthLogin() + "");
		bundle.putString("client_id", this.getClientId());
		bundle.putString("odoo_version_number", getVersion_number() + "");
		bundle.putString("odoo_version_serie", getVersion_serie());
		return bundle;
	}

	/**
	 * Sets the data from bundle.
	 * 
	 * @param data
	 *            the new from bundle
	 */
	public void setFromBundle(Bundle data) {
		setName(data.getString("name"));
		setUsername(data.getString("username"));
		setUser_id(Integer.parseInt(data.getString("user_id")));
		setPartner_id(Integer.parseInt(data.getString("partner_id")));
		setTimezone(data.getString("timezone"));
		setIsactive(Boolean.parseBoolean(data.getString("isactive")));
		setAvatar(data.getString("avatar"));
		setDatabase(data.getString("database"));
		setHost(data.getString("host"));
		setAndroidName(data.getString("android_name"));
		setPassword(data.getString("password"));
		setCompany_id(data.getString("company_id"));
		setAllowSelfSignedSSL(Boolean.parseBoolean(data
				.getString("allow_self_signed_ssl")));
		setVersion_number(Integer.parseInt(data
				.getString("odoo_version_number")));
		setVersion_serie(data.getString("odoo_version_serie"));
		// If oAuth Login
		setInstanceDatabase(data.getString("instance_database"));
		setInstanceUrl(data.getString("instance_url"));
		setOAuthLogin(Boolean.parseBoolean(data.getString("oauth_login")));
		setClientId(data.getString("client_id"));
	}

	/**
	 * Fill from account.
	 * 
	 * @param accMgr
	 *            the acc mgr
	 * @param account
	 *            the account
	 */
	public void fillFromAccount(AccountManager accMgr, Account account) {
		setName(accMgr.getUserData(account, "name"));
		setUsername(accMgr.getUserData(account, "username"));
		setUser_id(Integer.parseInt(accMgr.getUserData(account, "user_id")));
		setPartner_id(Integer.parseInt(accMgr
				.getUserData(account, "partner_id")));
		setTimezone(accMgr.getUserData(account, "timezone"));
		setIsactive(Boolean.parseBoolean(accMgr
				.getUserData(account, "isactive")));
		setAvatar(accMgr.getUserData(account, "avatar"));
		setDatabase(accMgr.getUserData(account, "database"));
		setHost(accMgr.getUserData(account, "host"));
		setAndroidName(accMgr.getUserData(account, "android_name"));
		setPassword(accMgr.getUserData(account, "password"));
		setCompany_id(accMgr.getUserData(account, "company_id"));
		setAllowSelfSignedSSL(Boolean.parseBoolean(accMgr.getUserData(account,
				"allow_self_signed_ssl")));
		setVersion_number(Integer.parseInt(accMgr.getUserData(account,
				"odoo_version_number")));
		setVersion_serie(accMgr.getUserData(account, "odoo_version_serie"));
		// If oAuth login
		setOAuthLogin(Boolean.parseBoolean(accMgr.getUserData(account,
				"oauth_login")));
		setInstanceDatabase(accMgr.getUserData(account, "instance_database"));
		setInstanceUrl(accMgr.getUserData(account, "instance_url"));
		setClientId(accMgr.getUserData(account, "client_id"));
	}
<commit_msg>[FIX] User image too Large (Add exception)<commit_after>/*
 * Odoo, Open Source Management Solution
 * Copyright (C) 2012-today Odoo SA (<http:www.odoo.com>)
 * 
 * This program is free software: you can redistribute it and/or modify
 * it under the terms of the GNU Affero General Public License as
 * published by the Free Software Foundation, either version 3 of the
 * License, or (at your option) any later version
 * 
 * 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.odoo.support;

import android.accounts.Account;
import android.accounts.AccountManager;
import android.content.Context;
import android.os.Bundle;

import com.odoo.auth.OdooAccountManager;

/**
 * The Class UserObject.
 */
public class OUser {

	/** The username. */
	private String username;

	/** The name. */
	private String name;

	/** The user_id. */
	private int user_id;

	/** The partner_id. */
	private int partner_id;

	/** The timezone. */
	private String timezone;

	/** The isactive. */
	private boolean isactive;

	/** The avatar. */
	private String avatar;

	/** The database. */
	private String database;

	/** The host. */
	private String host;

	/** The android_name. */
	private String android_name;

	/** The password. */
	private String password;

	/** The company_id. */
	private String company_id;

	/** The allow_self_signed_ssl. */
	private boolean allow_self_signed_ssl = false;

	/** The oauth_login. */
	private boolean oauth_login = false;

	/** The version_number. */
	private Integer version_number = 0;

	/** The version_serie. */
	private String version_serie = null;

	// If oauth login
	/** The instance_url. */
	private String instance_url = null;

	/** The instance_database. */
	private String instance_database = null;

	/** The client_id. */
	private String client_id = null;

	/**
	 * Gets the name.
	 * 
	 * @return the name
	 */
	public String getName() {
		return name;
	}

	/**
	 * Sets the name.
	 * 
	 * @param name
	 *            the new name
	 */
	public void setName(String name) {
		this.name = name;
	}

	/**
	 * Gets the company_id.
	 * 
	 * @return the company_id
	 */
	public String getCompany_id() {
		return company_id;
	}

	/**
	 * Sets the company_id.
	 * 
	 * @param company_id
	 *            the new company_id
	 */
	public void setCompany_id(String company_id) {
		this.company_id = company_id;
	}

	/**
	 * Gets the data as bundle.
	 * 
	 * @return the as bundle
	 */
	public Bundle getAsBundle() {
		Bundle bundle = new Bundle();
		bundle.putString("name", this.getName());
		bundle.putString("username", this.getUsername());
		bundle.putString("user_id", this.getUser_id() + "");
		bundle.putString("partner_id", this.getPartner_id() + "");
		bundle.putString("timezone", this.getTimezone());
		bundle.putString("isactive", String.valueOf(this.isIsactive()));
		bundle.putString("avatar", this.getAvatar());
		bundle.putString("database", this.getDatabase());
		bundle.putString("host", this.getHost());
		bundle.putString("android_name", this.getAndroidName());
		bundle.putString("password", <PASSWORD>());
		bundle.putString("company_id", this.getCompany_id());
		bundle.putString("allow_self_signed_ssl",
				String.valueOf(this.isAllowSelfSignedSSL()));
		bundle.putString("instance_database", this.getInstanceDatabase());
		bundle.putString("instance_url", this.getInstanceUrl());
		bundle.putString("oauth_login", this.isOAauthLogin() + "");
		bundle.putString("client_id", this.getClientId());
		bundle.putString("odoo_version_number", getVersion_number() + "");
		bundle.putString("odoo_version_serie", getVersion_serie());
		return bundle;
	}

	/**
	 * Sets the data from bundle.
	 * 
	 * @param data
	 *            the new from bundle
	 */
	public void setFromBundle(Bundle data) {
		setName(data.getString("name"));
		setUsername(data.getString("username"));
		setUser_id(Integer.parseInt(data.getString("user_id")));
		setPartner_id(Integer.parseInt(data.getString("partner_id")));
		setTimezone(data.getString("timezone"));
		setIsactive(Boolean.parseBoolean(data.getString("isactive")));
		try {
			setAvatar(data.getString("avatar"));
		} catch (Exception e) {
			setAvatar("false");
		}
		setDatabase(data.getString("database"));
		setHost(data.getString("host"));
		setAndroidName(data.getString("android_name"));
		setPassword(data.getString("password"));
		setCompany_id(data.getString("company_id"));
		setAllowSelfSignedSSL(Boolean.parseBoolean(data
				.getString("allow_self_signed_ssl")));
		setVersion_number(Integer.parseInt(data
				.getString("odoo_version_number")));
		setVersion_serie(data.getString("odoo_version_serie"));
		// If oAuth Login
		setInstanceDatabase(data.getString("instance_database"));
		setInstanceUrl(data.getString("instance_url"));
		setOAuthLogin(Boolean.parseBoolean(data.getString("oauth_login")));
		setClientId(data.getString("client_id"));
	}

	/**
	 * Fill from account.
	 * 
	 * @param accMgr
	 *            the acc mgr
	 * @param account
	 *            the account
	 */
	public void fillFromAccount(AccountManager accMgr, Account account) {

		setName(accMgr.getUserData(account, "name"));
		setUsername(accMgr.getUserData(account, "username"));
		setUser_id(Integer.parseInt(accMgr.getUserData(account, "user_id")));
		setPartner_id(Integer.parseInt(accMgr
				.getUserData(account, "partner_id")));
		setTimezone(accMgr.getUserData(account, "timezone"));
		setIsactive(Boolean.parseBoolean(accMgr
				.getUserData(account, "isactive")));
		try {
			setAvatar(accMgr.getUserData(account, "avatar"));
		} catch (Exception e) {
			setAvatar("false");
		}
		setDatabase(accMgr.getUserData(account, "database"));
		setHost(accMgr.getUserData(account, "host"));
		setAndroidName(accMgr.getUserData(account, "android_name"));
		setPassword(accMgr.getUserData(account, "password"));
		setCompany_id(accMgr.getUserData(account, "company_id"));
		setAllowSelfSignedSSL(Boolean.parseBoolean(accMgr.getUserData(account,
				"allow_self_signed_ssl")));
		setVersion_number(Integer.parseInt(accMgr.getUserData(account,
				"odoo_version_number")));
		setVersion_serie(accMgr.getUserData(account, "odoo_version_serie"));
		// If oAuth login
		setOAuthLogin(Boolean.parseBoolean(accMgr.getUserData(account,
				"oauth_login")));
		setInstanceDatabase(accMgr.getUserData(account, "instance_database"));
		setInstanceUrl(accMgr.getUserData(account, "instance_url"));
		setClientId(accMgr.getUserData(account, "client_id"));

	}

{'fraction_non_alphanumeric': 0.13760715616846814, 'fraction_numerical': 0.0008945210585165859, 'mean_word_length': 4.550682664460075, 'pattern_counts': {'":': 0, '<': 9, '<?xml version=': 0, '>': 9, 'https://': 0, 'lorem ipsum': 0, 'www.': 4, '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': '4099664', 'n_tokens_mistral': 4439, 'n_tokens_neox': 4178, 'n_words': 902}