All Downloads are FREE. Search and download functionalities are using the official Maven repository.

br.com.jhonsapp.email.configuration.Information.ConfigureUserInformation Maven / Gradle / Ivy

Go to download

Email Dispatcher is an open source project created by Jhonys Camacho and Jhonathan Camacho to facilitate the sending of emails.

There is a newer version: 1.0.3
Show newest version
package br.com.jhonsapp.email.configuration.Information;

import java.util.Properties;

import com.outjected.email.impl.SimpleMailConfig;

import br.com.jhonsapp.util.loader.PropertiesLoader;

public class ConfigureUserInformation {

	private PropertiesLoader loader = new PropertiesLoader();
	private SimpleMailConfig simpleMailConfig;
	private Properties userProperties;

	
	public Properties configure(SimpleMailConfig simpleMailConfig) {

		this.simpleMailConfig = simpleMailConfig;
		
		userProperties = loader.getPropertiesFile(PropertiesInformation.USER_PROPERTIES);
		verifyIfAllUserInformationValuesExist();
		addUserInformationInSimpleMailConfig();

		return userProperties;
	}
	
	private void verifyIfAllUserInformationValuesExist(){
		
		loader.verifyIfValueExists(userProperties, PropertiesInformation.typeKey);
		loader.verifyIfValueExists(userProperties, PropertiesInformation.usernameKey);		
		loader.verifyIfValueExists(userProperties, PropertiesInformation.passwordKey);
	}

	private void addUserInformationInSimpleMailConfig(){
		
		simpleMailConfig.setUsername(loader.getProperty(userProperties, PropertiesInformation.usernameKey));
		simpleMailConfig.setPassword(loader.getProperty(userProperties, PropertiesInformation.passwordKey));
	}

	
}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy