~ubuntu-branches/ubuntu/wily/libhibernate3-java/wily-proposed

« back to all changes in this revision

Viewing changes to test/org/hibernate/test/ops/Node.java

  • Committer: Bazaar Package Importer
  • Author(s): Torsten Werner
  • Date: 2007-10-14 14:43:34 UTC
  • Revision ID: james.westby@ubuntu.com-20071014144334-eamc8i0q10gs1aro
Tags: upstream-3.2.5
ImportĀ upstreamĀ versionĀ 3.2.5

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
//$Id: Node.java 10760 2006-11-08 00:01:34Z steve.ebersole@jboss.com $
 
2
package org.hibernate.test.ops;
 
3
 
 
4
import java.sql.Date;
 
5
import java.util.HashSet;
 
6
import java.util.Set;
 
7
 
 
8
/**
 
9
 * @author Gavin King
 
10
 */
 
11
public class Node {
 
12
 
 
13
        private String name;
 
14
        private String description;
 
15
        private Date created;
 
16
        private Node parent;
 
17
        private Set children = new HashSet();
 
18
        private Set cascadingChildren = new HashSet();
 
19
 
 
20
        public Node() {
 
21
        }
 
22
 
 
23
        public Node(String name) {
 
24
                this.name = name;
 
25
                created = generateCurrentDate();
 
26
        }
 
27
 
 
28
        public String getName() {
 
29
                return name;
 
30
        }
 
31
 
 
32
        public void setName(String name) {
 
33
                this.name = name;
 
34
        }
 
35
 
 
36
        public String getDescription() {
 
37
                return description;
 
38
        }
 
39
 
 
40
        public void setDescription(String description) {
 
41
                this.description = description;
 
42
        }
 
43
 
 
44
        public Date getCreated() {
 
45
                return created;
 
46
        }
 
47
 
 
48
        public void setCreated(Date created) {
 
49
                this.created = created;
 
50
        }
 
51
 
 
52
        public Node getParent() {
 
53
                return parent;
 
54
        }
 
55
 
 
56
        public void setParent(Node parent) {
 
57
                this.parent = parent;
 
58
        }
 
59
 
 
60
        public Set getChildren() {
 
61
                return children;
 
62
        }
 
63
 
 
64
        public void setChildren(Set children) {
 
65
                this.children = children;
 
66
        }
 
67
 
 
68
        public Node addChild(Node child) {
 
69
                children.add( child );
 
70
                child.setParent( this );
 
71
                return this;
 
72
        }
 
73
 
 
74
        public Set getCascadingChildren() {
 
75
                return cascadingChildren;
 
76
        }
 
77
 
 
78
        public void setCascadingChildren(Set cascadingChildren) {
 
79
                this.cascadingChildren = cascadingChildren;
 
80
        }
 
81
 
 
82
        private Date generateCurrentDate() {
 
83
                // Note : done as java.sql.Date mainly to work around issue with
 
84
                // MySQL and its lack of milli-second precision on its DATETIME
 
85
                // and TIMESTAMP datatypes.
 
86
                return new Date( new java.util.Date().getTime() );
 
87
        }
 
88
}