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.
		
		
		
		
		
			
		
			
				
					
					
						
							52 lines
						
					
					
						
							951 B
						
					
					
				
			
		
		
	
	
							52 lines
						
					
					
						
							951 B
						
					
					
				/*
 | 
						|
 * StampSaveHandler.java
 | 
						|
 *
 | 
						|
 * Created on 15 de Março de 2005, 15:00
 | 
						|
 */
 | 
						|
 | 
						|
package siprp.data;
 | 
						|
 | 
						|
import java.util.*;
 | 
						|
 | 
						|
import com.evolute.utils.jdo.*;
 | 
						|
/**
 | 
						|
 *
 | 
						|
 * @author  fpalma
 | 
						|
 */
 | 
						|
public class ActualizacaoSaveHandler implements JDOOperationHandlerInterface
 | 
						|
{
 | 
						|
	public static final ActualizacaoSaveHandler INSTANCE = new ActualizacaoSaveHandler();
 | 
						|
	
 | 
						|
	/** Creates a new instance of StampSaveHandler */
 | 
						|
	public ActualizacaoSaveHandler()
 | 
						|
	{
 | 
						|
	}
 | 
						|
	
 | 
						|
	public boolean handle(JDOObject object, int operation, int moment) throws Exception
 | 
						|
	{
 | 
						|
		if( !( object instanceof ActualizacaoSaveable ) )
 | 
						|
		{
 | 
						|
			return false;
 | 
						|
		}
 | 
						|
		switch( operation )
 | 
						|
		{
 | 
						|
			case OP_SAVE:
 | 
						|
				return save( object, moment );
 | 
						|
				
 | 
						|
			case OP_DELETE:
 | 
						|
				return false;
 | 
						|
		}
 | 
						|
		return false;
 | 
						|
	}
 | 
						|
	
 | 
						|
	protected boolean save( JDOObject object, int moment )
 | 
						|
	{
 | 
						|
		if( moment != MOMENT_BEFORE )
 | 
						|
		{
 | 
						|
			return false;
 | 
						|
		}
 | 
						|
		object.set( ActualizacaoSaveable.ACTUALIZACAO, new Date() );
 | 
						|
		return true;
 | 
						|
	}
 | 
						|
}
 |