package siprp.database.cayenne.objects;

import com.evolute.utils.strings.UnicodeChecker;

import siprp.database.cayenne.objects.auto._PrtGruposProtocolo;

public class PrtGruposProtocolo extends _PrtGruposProtocolo {

	private static final long serialVersionUID = 1L;

	private String name = null;
	
	private String convertedName = null;

	@Override
	public String getDescricao()
	{
		String currentName = super.getDescricao();
		if( name == null || !name.equals( currentName ))
		{
			name = currentName;
			convertedName = null;
		}
		return convertName();
	}
	
	@Override
	public void setDescricao( String nome )
	{
		super.setDescricao( parseToUnicode( name ) );
		getDescricao();
	}

	private String convertName()
	{
		if( name == null )
		{
			convertedName = null;
		}
		else
		{
			convertedName = parseFromUnicode( name );
		}
		return convertedName;
	}
	
	@Override
	public String toString()
	{
		return getDescricao() == null ? "" : getDescricao();
	}
}



