KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > org > mmbase > datatypes > processors > Creator


1 /*
2
3 This software is OSI Certified Open Source Software.
4 OSI Certified is a certification mark of the Open Source Initiative.
5
6 The license (Mozilla version 1.0) can be read at the MMBase site.
7 See http://www.MMBase.org/license
8
9 */

10 package org.mmbase.datatypes.processors;
11
12 import org.mmbase.bridge.*;
13
14 /**
15  * This processor can be used as a 'set' processor on a (datetime) field. The field will then be set
16  * to the current user id when this field is not yet set.
17  *
18  * @author Michiel Meeuwissen
19  * @version $Id: Creator.java,v 1.1 2006/02/14 22:46:41 michiel Exp $
20  * @since MMBase-1.8
21  * @see LastModifier
22  */

23
24
25 public class Creator implements CommitProcessor {
26
27     private static final long serialVersionUID = 1L;
28
29     public void commit(Node node, Field field) {
30         if (node.isNull(field.getName())) {
31             node.setValueWithoutProcess(field.getName(), node.getCloud().getUser().getIdentifier());
32         }
33     }
34
35     public String JavaDoc toString() {
36         return "creator";
37     }
38 }
39
Popular Tags