// Path: src/main/java/com/epam/reportportal/auth/oauth/UserSynchronizationException.java
// public class UserSynchronizationException extends AuthenticationException {
// 
// 	public UserSynchronizationException(String msg) {
// 		super(msg);
// 	}
// 
// 	public UserSynchronizationException(String msg, Throwable e) {
// 		super(msg, e);
// 	}
// }


import java.time.ZoneOffset;
import java.util.HashMap;
import java.util.Map;
import static java.util.Optional.ofNullable;
import com.epam.reportportal.auth.oauth.UserSynchronizationException;
import com.epam.reportportal.commons.ContentTypeResolver;
import com.epam.ta.reportportal.binary.UserBinaryDataService;
import com.epam.ta.reportportal.dao.ProjectRepository;
import com.epam.ta.reportportal.dao.UserRepository;
import com.epam.ta.reportportal.entity.attachment.BinaryData;
import com.epam.ta.reportportal.entity.project.Project;
import com.epam.ta.reportportal.entity.user.User;
import com.epam.ta.reportportal.util.PersonalProjectService;
import com.google.common.collect.Maps;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import java.io.ByteArrayInputStream;
import java.time.LocalDateTime;
	 *
	 * @return Default meta info
	 */
	protected com.epam.ta.reportportal.entity.Metadata defaultMetaData() {
		Map<String, Object> metaDataMap = new HashMap<>();
		long nowInMillis = LocalDateTime.now().toInstant(ZoneOffset.UTC).toEpochMilli();
		metaDataMap.put("last_login", nowInMillis);
		metaDataMap.put("synchronizationDate", nowInMillis);
		return new com.epam.ta.reportportal.entity.Metadata(metaDataMap);
	}

	/**
	 * Updates last syncronization data for specified user
	 *
	 * @param user User to be synchronized
	 */
	protected void updateSynchronizationDate(User user) {
		com.epam.ta.reportportal.entity.Metadata metadata = ofNullable(user.getMetadata()).orElse(new com.epam.ta.reportportal.entity.Metadata(
				Maps.newHashMap()));
		metadata.getMetadata().put("synchronizationDate", LocalDateTime.now().toInstant(ZoneOffset.UTC).toEpochMilli());
		user.setMetadata(metadata);
	}

	/**
	 * Checks email is available
	 *
	 * @param email email to check
	 */
	protected void checkEmail(String email) {
		if (userRepository.findByEmail(email).isPresent()) {
// Path: src/main/java/com/epam/reportportal/auth/oauth/UserSynchronizationException.java
// public class UserSynchronizationException extends AuthenticationException {
// 
// 	public UserSynchronizationException(String msg) {
// 		super(msg);
// 	}
// 
// 	public UserSynchronizationException(String msg, Throwable e) {
// 		super(msg, e);
// 	}
// }


// Path: src/main/java/com/epam/reportportal/auth/integration/AbstractUserReplicator.java
import java.time.ZoneOffset;
import java.util.HashMap;
import java.util.Map;
import static java.util.Optional.ofNullable;
import com.epam.reportportal.auth.oauth.UserSynchronizationException;
import com.epam.reportportal.commons.ContentTypeResolver;
import com.epam.ta.reportportal.binary.UserBinaryDataService;
import com.epam.ta.reportportal.dao.ProjectRepository;
import com.epam.ta.reportportal.dao.UserRepository;
import com.epam.ta.reportportal.entity.attachment.BinaryData;
import com.epam.ta.reportportal.entity.project.Project;
import com.epam.ta.reportportal.entity.user.User;
import com.epam.ta.reportportal.util.PersonalProjectService;
import com.google.common.collect.Maps;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import java.io.ByteArrayInputStream;
import java.time.LocalDateTime;

	 *
	 * @return Default meta info
	 */
	protected com.epam.ta.reportportal.entity.Metadata defaultMetaData() {
		Map<String, Object> metaDataMap = new HashMap<>();
		long nowInMillis = LocalDateTime.now().toInstant(ZoneOffset.UTC).toEpochMilli();
		metaDataMap.put("last_login", nowInMillis);
		metaDataMap.put("synchronizationDate", nowInMillis);
		return new com.epam.ta.reportportal.entity.Metadata(metaDataMap);
	}

	/**
	 * Updates last syncronization data for specified user
	 *
	 * @param user User to be synchronized
	 */
	protected void updateSynchronizationDate(User user) {
		com.epam.ta.reportportal.entity.Metadata metadata = ofNullable(user.getMetadata()).orElse(new com.epam.ta.reportportal.entity.Metadata(
				Maps.newHashMap()));
		metadata.getMetadata().put("synchronizationDate", LocalDateTime.now().toInstant(ZoneOffset.UTC).toEpochMilli());
		user.setMetadata(metadata);
	}

	/**
	 * Checks email is available
	 *
	 * @param email email to check
	 */
	protected void checkEmail(String email) {
		if (userRepository.findByEmail(email).isPresent()) {
			throw new UserSynchronizationException("User with email '" + email + "' already exists");