-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathbean_without_links.vm
103 lines (91 loc) · 3.66 KB
/
bean_without_links.vm
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
/*
* Created on $today.date ( Time $today.time )
* Generated by $generator.name ( version $generator.version )
*/
package ${target.javaPackageFromFolder($SRC)};
import java.io.Serializable;
#foreach( $import in $entity.imports )
import $import;
#end
import javax.xml.bind.annotation.XmlAccessType;
import javax.xml.bind.annotation.XmlAccessorType;
import javax.xml.bind.annotation.XmlRootElement;
##--------------------------------------------------------------------------------------------------------
## Data fields list ( list of fields used as bean property with getter/setter )
## Data fields = fields not in Primary Key
## #set( $dataFields = $entity.nonKeyAttributes )
#set( $dataFields = $entity.getAttributesByCriteria( $const.NOT_KEY ) )
##--------------------------------------------------------------------------------------------------------
/**
* POJO class for "${entity.databaseTable}" document.
*
* @author Telosys Tools Generator
*
*/
@XmlRootElement // JAXB annotation for REST Web Services
@XmlAccessorType(XmlAccessType.PROPERTY) // JAXB accessor = getter/setter pair
public class $entity.name implements Serializable
{
private static final long serialVersionUID = 1L;
//----------------------------------------------------------------------
// DOCUMENT PRIMARY KEY
//----------------------------------------------------------------------
#foreach( $field in $entity.keyAttributes )
private $field.formattedType(10) $field.formattedName(12) #if($field.hasInitialValue())= ${field.initialValue} #end;
#end
//----------------------------------------------------------------------
// DOCUMENT DATA FIELDS
//----------------------------------------------------------------------
#foreach( $field in $dataFields )
private $field.formattedType(10) $field.formattedName(12) #if($field.hasInitialValue())= ${field.initialValue} #end;
#end
//----------------------------------------------------------------------
// CONSTRUCTOR(S)
//----------------------------------------------------------------------
public ${entity.name}() {
}
//----------------------------------------------------------------------
// GETTER & SETTER FOR THE KEY FIELD
//----------------------------------------------------------------------
#foreach( $field in $entity.keyAttributes )
#if ( $field.setter ) public void ${field.setter}( $field.type $field.name )
{
this.$field.name = $field.name ;
}
#end
#if ( $field.getter ) public $field.type ${field.getter}()
{
return this.$field.name;
}
#end
#end
//----------------------------------------------------------------------
// GETTERS & SETTERS FOR FIELDS
//----------------------------------------------------------------------
#foreach( $field in $dataFields )
#if ( $field.databaseName ) //--- DOCUMENT MAPPING : $field.databaseName ( $field.databaseType )
#end
#if ( $field.setter ) public void ${field.setter}( $field.type $field.name )
{
this.$field.name = $field.name;
}
#end
#if ( $field.getter ) public $field.type ${field.getter}()
{
return this.$field.name;
}
#end
#end
//----------------------------------------------------------------------
// toString METHOD
//----------------------------------------------------------------------
public String toString()
{
#set( $attributes = $entity.getAttributesByCriteria( $const.NOT_KEY, $const.NOT_TEXT ) )
## The "key" is used only if composite key
$entity.toStringMethodCodeLines(8)
#foreach( $field in $entity.getAttributesByCriteria( $const.TEXT ) )
// $field.name is not in toString because it's a "long text" field
#end
}
}