package jondo;

import anon.infoservice.ServiceOperator;
import anon.util.CountryMapper;
import anon.util.JAPMessages;

public class MixOperator 
{
	private ServiceOperator m_operator;
	private String m_strOrganizationShortName;
	
	protected MixOperator(ServiceOperator a_operator)
	{
		if (a_operator == null)
		{
			throw new NullPointerException();
		}
		m_operator = a_operator;
		
		if (m_operator.getCommonName() != null && 
				!m_operator.getCommonName().equals(
						"AN.ON Operator Certificate") && 
						m_operator.getCommonName().length() > 0)
		{
			m_strOrganizationShortName = m_operator.getCommonName();
		}
	}
	
	public String getCountryCode()
	{
		return m_operator.getCountryCode();
	}
	
	public String getCountry()
	{
		try
		{
			return new CountryMapper(
					m_operator.getCountryCode(), JAPMessages.getLocale()).toString();
		}
		catch (IllegalArgumentException a_e)
		{
			return m_operator.getCountryCode();
		}
	}
	
	public String getOrganizationShortName()
	{
		return m_strOrganizationShortName;
	}
	
	public String getOrganization()
	{
		return m_operator.getOrganization();
	}
	
	public String getOrganizationalUnit()
	{
		return m_operator.getOrganizationUnit();
	}
	
	public String getEMailContact()
	{
		return m_operator.getEMail();
	}
	
	public String getHomepage()
	{
		return m_operator.getUrl();
	}
}
