Project

General

Profile

Download (2.08 KB) Statistics
| Branch: | Tag: | Revision:
1
/**
2
* Copyright (C) 2009 EDIT
3
* European Distributed Institute of Taxonomy
4
* http://www.e-taxonomy.eu
5
*
6
* The contents of this file are subject to the Mozilla Public License Version 1.1
7
* See LICENSE.TXT at the top of this package for the full license terms.
8
*/
9

    
10
package eu.etaxonomy.cdm.model.common;
11

    
12
import java.util.UUID;
13

    
14
import javax.validation.GroupSequence;
15
import javax.validation.groups.Default;
16

    
17
import org.joda.time.DateTime;
18

    
19
import eu.etaxonomy.cdm.validation.Level2;
20
import eu.etaxonomy.cdm.validation.Level3;
21

    
22
@GroupSequence({Default.class, Level2.class, Level3.class})
23
public interface ICdmBase {
24

    
25
	/**
26
	 * Returns local unique identifier for the concrete subclass
27
	 * @return
28
	 */
29
	public int getId();
30

    
31
	/**
32
	 * Assigns a unique local ID to this object.
33
	 * Because of the EJB3 @Id and @GeneratedValue annotation this id will be
34
	 * set automatically by the persistence framework when object is saved.
35
	 * @param id
36
	 */
37
	public void setId(int id);
38

    
39
	public UUID getUuid();
40

    
41
	public void setUuid(UUID uuid);
42

    
43
	public DateTime getCreated();
44

    
45
	/**
46
	 * Sets the timestamp this object was created.
47
	 * Most databases cannot store milliseconds, so they are removed by this method.
48
	 * Caution: We are planning to replace the Calendar class with a different datetime representation which is more suitable for hibernate
49
	 * see {@link http://dev.e-taxonomy.eu/trac/ticket/247 TRAC ticket}
50
	 *
51
	 * @param created
52
	 */
53
	public void setCreated(DateTime created);
54

    
55
	/**
56
	 * @return The {@link User} who was authenticated when the entity was created.
57
	 * Can be <code>null</code> if the entity has been created without any user authentication present.
58
	 */
59
	public User getCreatedBy();
60

    
61
	public void setCreatedBy(User createdBy);
62

    
63
    /**
64
     * @param class1
65
     * @return
66
     */
67
    public boolean isInstanceOf(Class<? extends CdmBase> clazz);
68

    
69
    /**
70
     * @return if and only if the instance has been saved to the persistent storage.
71
     * For new and un-persisted entities this method returns false.
72
     */
73
    public boolean isPersited();
74

    
75
}
(17-17/79)