forked from Coded/SIPRP
				
			
			You can not select more than 25 topics
			Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
		
		
		
		
		
			
		
			
				
					
					
						
							63 lines
						
					
					
						
							1.3 KiB
						
					
					
				
			
		
		
	
	
							63 lines
						
					
					
						
							1.3 KiB
						
					
					
				| package siprp.database.cayenne.objects;
 | |
| 
 | |
| import siprp.database.cayenne.objects.auto._Legislacao;
 | |
| 
 | |
| import com.evolute.utils.strings.UnicodeChecker;
 | |
| 
 | |
| public class Legislacao extends _Legislacao {
 | |
| 
 | |
| 	private static final long serialVersionUID = 1L;
 | |
| 
 | |
| 	private String description = null;
 | |
| 	
 | |
| 	private String convertedDescription = null;
 | |
| 	
 | |
| 	@Override
 | |
| 	public String toString()
 | |
| 	{
 | |
| 		String result = getDescription() == null ? "" : getDescription();
 | |
| 		if( result.contains( "\n" ) )
 | |
| 		{
 | |
| 			result = result.substring( 0, result.indexOf( "\n"  ) ) + "...";
 | |
| 		}
 | |
| 		else if( result.contains( "\n\r" ) )
 | |
| 		{
 | |
| 			result = result.substring( 0, result.indexOf( "\n\r"  ) ) + "...";
 | |
| 		}
 | |
| 		return result;
 | |
| 	}
 | |
| 	
 | |
| 	@Override
 | |
| 	public String getDescription()
 | |
| 	{
 | |
| 		String currentName = super.getDescription();
 | |
| 		if( description == null || !description.equals( currentName ))
 | |
| 		{
 | |
| 			description = currentName;
 | |
| 			convertedDescription = null;
 | |
| 		}
 | |
| 		return convertName();
 | |
| 	}
 | |
| 	
 | |
| 	@Override
 | |
| 	public void setDescription( String nome )
 | |
| 	{
 | |
| 		super.setDescription( nome != null ? UnicodeChecker.parseToUnicode( nome ).replaceAll( "\\\\\\\\", "\\\\" ) : null );
 | |
| 		getDescription();
 | |
| 	}
 | |
| 
 | |
| 	private String convertName()
 | |
| 	{
 | |
| 		if( description == null )
 | |
| 		{
 | |
| 			convertedDescription = null;
 | |
| 		}
 | |
| 		else
 | |
| 		{
 | |
| 			convertedDescription = UnicodeChecker.parseFromUnicode( description );
 | |
| 		}
 | |
| 		return convertedDescription;
 | |
| 	}
 | |
| 	
 | |
| }
 |