1 /***
2 Copyright (C) 2005 The Java Community
3
4 This program is free software; you can redistribute it and/or modify it under
5 the terms of the GNU General Public License as published by the Free Software
6 Foundation; either version 2 of the License, or (at your option) any later
7 version.
8
9 This program is distributed in the hope that it will be useful, but WITHOUT
10 ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
11 FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details.
12
13 You should have received a copy of the GNU General Public License along with
14 this program; if not, write to the Free Software Foundation, Inc., 59 Temple
15 Place, Suite 330, Boston, MA 02111-1307 USA.
16
17 */
18 package org.bejug.javacareers.jobs.dao.common;
19
20 import java.lang.reflect.Method;
21 import java.sql.Timestamp;
22
23 import org.bejug.javacareers.jobs.model.AbstractPersistableObject;
24 import org.springframework.aop.MethodBeforeAdvice;
25
26 /***
27 * An AOP Advice to add the creation when a new object is saved and update
28 * the modification date when an existing object is updated.
29 *
30 * @author Stephan Janssen (Last modified by $Author: bme_jcs $)
31 * @version $Revision: 1.2 $ - $Date: 2005/08/31 12:16:11 $
32 */
33 public class ModificationDateAdvice implements MethodBeforeAdvice {
34
35 /***
36 * the method to run when a method is called.
37 * {@inheritDoc}
38 */
39 public void before(Method method, Object[] args, Object o)
40 throws Throwable {
41
42
43 if (args[0] instanceof AbstractPersistableObject) {
44 ((AbstractPersistableObject) args[0]).setModificationDate(
45 new Timestamp(System.currentTimeMillis()));
46 }
47 }
48 }
49 /***
50 * $Log: ModificationDateAdvice.java,v $
51 * Revision 1.2 2005/08/31 12:16:11 bme_jcs
52 * refactoring of the abstract base-classes
53 *
54 * Revision 1.1 2005/08/26 07:58:30 ge0ffrey
55 * split up the sources in service, serviceimpl and webclient
56 *
57 * Revision 1.4 2005/08/10 09:04:48 bavo_jcs
58 * Optimized imports according to checkstyle
59 *
60 * Revision 1.3 2005/08/09 12:59:55 bavo_jcs
61 * Optimized imports
62 *
63 * Revision 1.2 2005/06/09 08:18:43 bejug_cc
64 * Fix initial import
65 *
66 * Revision 1.4 2005/05/11 10:14:52 ssc
67 * Checstyle errors
68 *
69 * Revision 1.3 2005/05/09 13:24:19 bme
70 * cleaned up
71 *
72 * Revision 1.2 2005/05/04 09:56:29 sja
73 * Removed LOG instance.
74 *
75 * Revision 1.1 2005/05/04 09:47:15 bme
76 * modified for introduction AOP
77 *
78 *
79 */