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.
53 lines
1021 B
53 lines
1021 B
/*
|
|
* StampSaveHandler.java
|
|
*
|
|
* Created on 15 de Marco de 2005, 15:00
|
|
*/
|
|
|
|
package siprp.data;
|
|
|
|
import java.util.Date;
|
|
|
|
import com.evolute.utils.jdo.JDOObject;
|
|
import com.evolute.utils.jdo.JDOOperationHandlerInterface;
|
|
/**
|
|
*
|
|
* @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;
|
|
}
|
|
}
|