01: /*
02:
03: This software is OSI Certified Open Source Software.
04: OSI Certified is a certification mark of the Open Source Initiative.
05:
06: The license (Mozilla version 1.0) can be read at the MMBase site.
07: See http://www.MMBase.org/license
08:
09: */
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: public class Creator implements CommitProcessor {
25:
26: private static final long serialVersionUID = 1L;
27:
28: public void commit(Node node, Field field) {
29: if (node.isNull(field.getName())) {
30: node.setValueWithoutProcess(field.getName(), node
31: .getCloud().getUser().getIdentifier());
32: }
33: }
34:
35: public String toString() {
36: return "creator";
37: }
38: }
|