kwatable 0.0.1 → 0.1.0
Sign up to get free protection for your applications and to get access to all the features.
- data/ChangeLog.txt +28 -2
- data/README.txt +1 -1
- data/bin/kwatable +2 -2
- data/examples/ex1/Makefile +1 -1
- data/examples/ex1/example1.yaml +18 -7
- data/examples/ex2/Makefile +1 -1
- data/kwatable.gemspec +2 -2
- data/lib/kwatable/error-msg.rb +15 -14
- data/lib/kwatable/kwatable.schema.yaml +34 -81
- data/lib/kwatable/main-program.rb +49 -41
- data/lib/kwatable/manipulator.rb +222 -0
- data/lib/kwatable/templates/ddl-mysql.eruby +15 -12
- data/lib/kwatable/templates/ddl-postgresql.eruby +14 -10
- data/lib/kwatable/templates/defaults.yaml +4 -4
- data/lib/kwatable/templates/dto-java.eruby +49 -59
- data/lib/kwatable/templates/dto-ruby.eruby +47 -54
- data/lib/kwatable.rb +3 -4
- data/test/assert-diff.rb +1 -1
- data/test/test.rb +24 -17
- data/test/test1/test1.ddl-mysql.expected +3 -2
- data/test/test1/test1.ddl-postgresql.expected +2 -1
- data/test/test1/test1.dto-java.Group.expected +12 -9
- data/test/test1/test1.dto-java.User.expected +12 -14
- data/test/test1/test1.dto-ruby.Group.expected +9 -10
- data/test/test1/test1.dto-ruby.User.expected +12 -15
- data/test/test1/test1.yaml +18 -7
- data/test/test2/test2.ddl-mysql.expected +4 -4
- data/test/test2/test2.dto-java.Address.expected +6 -8
- data/test/test2/test2.dto-java.Customer.expected +6 -8
- data/test/test2/test2.dto-java.Item.expected +5 -7
- data/test/test2/test2.dto-java.SalesOrder.expected +6 -8
- data/test/test2/test2.dto-java.SalesOrderLine.expected +6 -8
- data/test/test2/test2.dto-ruby.Address.expected +6 -9
- data/test/test2/test2.dto-ruby.Customer.expected +6 -9
- data/test/test2/test2.dto-ruby.Item.expected +5 -8
- data/test/test2/test2.dto-ruby.SalesOrder.expected +6 -9
- data/test/test2/test2.dto-ruby.SalesOrderLine.expected +6 -9
- data/test/test2/test2.yaml +3 -3
- metadata +65 -64
- data/lib/kwatable/manufactory.rb +0 -213
@@ -1,16 +1,17 @@
|
|
1
1
|
<%
|
2
2
|
|
3
3
|
##
|
4
|
-
## kwatable template file for
|
4
|
+
## kwatable template file for Ruby DTO class
|
5
5
|
##
|
6
6
|
## copyright(c) 2005 kuwata-lab.com all rights reserved.
|
7
|
-
## $Release: 0.0
|
8
|
-
## $Rev:
|
7
|
+
## $Release: 0.1.0 $
|
8
|
+
## $Rev: 15 $
|
9
9
|
##
|
10
10
|
## template properties:
|
11
11
|
## module - module name
|
12
12
|
## parent - parent class
|
13
13
|
## reqpath - require path
|
14
|
+
##
|
14
15
|
|
15
16
|
|
16
17
|
#
|
@@ -18,46 +19,43 @@
|
|
18
19
|
#
|
19
20
|
table = context['table']
|
20
21
|
properties = context['properties']
|
21
|
-
raise "option '-m' is required when using 'dto-
|
22
|
-
|
23
|
-
|
24
|
-
unless defined?(KEYWORDS)
|
25
|
-
#
|
26
|
-
# java keywords
|
27
|
-
#
|
28
|
-
keywords = <<-END
|
29
|
-
BEGIN END alias and begin break case
|
30
|
-
class def defined do else elsif end
|
31
|
-
ensure false for if in module next
|
32
|
-
nil not or redo rescue retry return
|
33
|
-
self super then true undef unless
|
34
|
-
until when while yield
|
35
|
-
END
|
36
|
-
KEYWORDS = {}
|
37
|
-
keywords.split(/\s+/).each { |word| KEYWORDS[word] = true }
|
38
|
-
|
39
|
-
|
40
|
-
#
|
41
|
-
# escape java keywords
|
42
|
-
#
|
43
|
-
def _(word)
|
44
|
-
return KEYWORDS[word] ? "_#{word}" : word
|
45
|
-
end
|
22
|
+
raise "option '-m' is required when using 'dto-ruby.eruby'." unless table
|
46
23
|
|
47
24
|
|
48
|
-
|
49
|
-
|
50
|
-
|
51
|
-
|
52
|
-
|
53
|
-
|
54
|
-
|
55
|
-
|
56
|
-
|
57
|
-
|
58
|
-
|
59
|
-
|
25
|
+
#
|
26
|
+
# ruby keywords
|
27
|
+
#
|
28
|
+
keywords = <<-END
|
29
|
+
BEGIN END alias and begin break case
|
30
|
+
class def defined do else elsif end
|
31
|
+
ensure false for if in module next
|
32
|
+
nil not or redo rescue retry return
|
33
|
+
self super then true undef unless
|
34
|
+
until when while yield
|
35
|
+
END
|
36
|
+
@keywords = {}
|
37
|
+
keywords.split(/\s+/).each { |word| @keywords[word] = true }
|
38
|
+
|
39
|
+
|
40
|
+
#
|
41
|
+
# escape java keywords
|
42
|
+
#
|
43
|
+
def self._(word)
|
44
|
+
return @keywords[word] ? "_#{word}" : word
|
45
|
+
end
|
46
|
+
|
60
47
|
|
48
|
+
#
|
49
|
+
# convert 'aaa_bbb_ccc' into 'AaaBbbCcc'
|
50
|
+
#
|
51
|
+
def self.camel_case(name, flag_all=true)
|
52
|
+
s = ''
|
53
|
+
name.split('_').each_with_index do |word, i|
|
54
|
+
s << (!flag_all && i == 0 ? word.downcase : word.capitalize)
|
55
|
+
end
|
56
|
+
return s
|
57
|
+
#s = name.split('_').collect { |w| w.capitalize }.join()
|
58
|
+
#s[0] = s[0].to_s.upcase.chr unless flag_all
|
61
59
|
end
|
62
60
|
|
63
61
|
|
@@ -103,9 +101,9 @@
|
|
103
101
|
# require other dto file
|
104
102
|
#
|
105
103
|
for column in table['columns']
|
106
|
-
if column['ref
|
107
|
-
refclass = column['ref
|
108
|
-
refclass ||= camel_case(column['ref
|
104
|
+
if column['ref']
|
105
|
+
refclass = column['ref']['table']['class']
|
106
|
+
refclass ||= camel_case(column['ref']['table']['name'])
|
109
107
|
reqpath = properties[:reqpath]
|
110
108
|
%>
|
111
109
|
require '<%= reqpath %><%= reqpath ? '/' : '' %><%= refclass %>'
|
@@ -127,15 +125,12 @@ class <%= mod %><%= klass[:name] %><% extends %>
|
|
127
125
|
|
128
126
|
<%
|
129
127
|
#
|
130
|
-
#
|
128
|
+
# populator with hash
|
131
129
|
#
|
132
|
-
|
133
|
-
|
134
|
-
|
135
|
-
def initialize(<%= argstr %>)
|
130
|
+
%>
|
131
|
+
def populate(values={})
|
136
132
|
<% for var in variables %>
|
137
|
-
|
138
|
-
|
133
|
+
self.<%= "%-14s" % var[:name] %> = values['<%= var[:name] %>']
|
139
134
|
<% end %>
|
140
135
|
end
|
141
136
|
|
@@ -149,15 +144,13 @@ class <%= mod %><%= klass[:name] %><% extends %>
|
|
149
144
|
|
150
145
|
<% end %>
|
151
146
|
|
152
|
-
// -----------
|
153
|
-
|
154
147
|
<%
|
155
148
|
#
|
156
149
|
# foreign keys
|
157
150
|
#
|
158
151
|
table['columns'].each do |column|
|
159
|
-
if column['ref
|
160
|
-
refcol = column['ref
|
152
|
+
if column['ref']
|
153
|
+
refcol = column['ref']['name']
|
161
154
|
refname = column['ref-name']
|
162
155
|
varname = column['name']
|
163
156
|
if refname == varname
|
data/lib/kwatable.rb
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
###
|
2
2
|
### copyright(c) 2005 kuwata-lab.com all rights reserved.
|
3
|
-
### $Release: 0.0
|
4
|
-
### $Rev:
|
3
|
+
### $Release: 0.1.0 $
|
4
|
+
### $Rev: 15 $
|
5
5
|
###
|
6
6
|
|
7
7
|
module Kwatable
|
@@ -27,5 +27,4 @@ module Kwatable
|
|
27
27
|
end
|
28
28
|
|
29
29
|
require 'kwatable/error-msg'
|
30
|
-
|
31
|
-
require 'kwatable/manufactory'
|
30
|
+
require 'kwatable/manipulator'
|
data/test/assert-diff.rb
CHANGED
data/test/test.rb
CHANGED
@@ -1,28 +1,31 @@
|
|
1
1
|
###
|
2
2
|
### copyright(c) 2005 kuwata-lab.com all rights reserved.
|
3
|
-
### $Release: 0.0
|
4
|
-
### $Rev:
|
3
|
+
### $Release: 0.1.0 $
|
4
|
+
### $Rev: 15 $
|
5
5
|
###
|
6
6
|
|
7
|
-
|
8
|
-
|
9
|
-
|
10
|
-
|
11
|
-
|
12
|
-
|
13
|
-
|
14
|
-
|
15
|
-
|
16
|
-
|
17
|
-
|
18
|
-
|
7
|
+
unless defined?(BASE_DIR)
|
8
|
+
TEST_DIR = File.expand_path(File.dirname(__FILE__))
|
9
|
+
BASE_DIR = File.dirname(TEST_DIR)
|
10
|
+
LIB_DIR = BASE_DIR + "/lib"
|
11
|
+
BIN_DIR = BASE_DIR + "/bin"
|
12
|
+
EXAMPLES_DIR = BASE_DIR + "/examples"
|
13
|
+
$LOAD_PATH << LIB_DIR << TEST_DIR
|
14
|
+
|
15
|
+
ENV['RUBYLIB'] = LIB_DIR
|
16
|
+
ENV['PATH'] = "#{BIN_DIR}:#{ENV['PATH']}"
|
17
|
+
#puts ENV['PATH']
|
18
|
+
#puts `kwatable -h`
|
19
|
+
#exit 0
|
20
|
+
end
|
21
|
+
Dir.chdir TEST_DIR
|
19
22
|
|
20
|
-
ENV['RUBYLIB'] = LIB_DIR
|
21
23
|
|
22
24
|
require 'test/unit'
|
23
25
|
require 'test/unit/ui/console/testrunner'
|
24
26
|
|
25
27
|
require 'kwatable.rb'
|
28
|
+
require 'kwatable/main-program'
|
26
29
|
require 'assert-diff'
|
27
30
|
|
28
31
|
|
@@ -37,8 +40,12 @@ class KwatableExampleTest < Test::Unit::TestCase
|
|
37
40
|
cmd = "kwatable -f #{@template} #{optstr} #{@datafile}"
|
38
41
|
#cmd = "kwatable -I #{BASE_DIR}/templates -f #{@template} #{optstr} #{@datafile}"
|
39
42
|
$logger.write("- command: #{cmd}\n thread: #{Thread.current.__id__}\n timestamp: #{Time.new.to_s}\n")
|
40
|
-
|
41
|
-
|
43
|
+
#actual = `#{cmd}`
|
44
|
+
argv = cmd.split(/\s+/)
|
45
|
+
argv.shift
|
46
|
+
main = Kwatable::MainProgram.new(argv)
|
47
|
+
actual = main.execute()
|
48
|
+
|
42
49
|
if @classnames
|
43
50
|
actuals = {}
|
44
51
|
@classnames.each do |classname|
|
@@ -7,7 +7,8 @@
|
|
7
7
|
create table groups (
|
8
8
|
id integer auto_increment primary key,
|
9
9
|
name varchar(63) not null,
|
10
|
-
`desc` varchar(255)
|
10
|
+
`desc` varchar(255) ,
|
11
|
+
class enum('ADMIN', 'SYSTEM', 'USER', 'UNUSED')
|
11
12
|
);
|
12
13
|
|
13
14
|
-- User master table
|
@@ -16,7 +17,7 @@ create table users (
|
|
16
17
|
name varchar(63) not null,
|
17
18
|
`desc` varchar(255) ,
|
18
19
|
email varchar(63) ,
|
19
|
-
group_id integer , -- references groups
|
20
|
+
group_id integer , -- references groups(id)
|
20
21
|
account varchar(31) not null,
|
21
22
|
password varchar(31) not null
|
22
23
|
);
|
@@ -8,14 +8,16 @@
|
|
8
8
|
*/
|
9
9
|
public class Group implements java.io.Serializable {
|
10
10
|
|
11
|
-
private int id; /*
|
12
|
-
private String name; /*
|
13
|
-
private String desc; /*
|
14
|
-
|
15
|
-
|
16
|
-
|
17
|
-
|
18
|
-
|
11
|
+
private int id; /* group id */
|
12
|
+
private String name; /* group name */
|
13
|
+
private String desc; /* group description */
|
14
|
+
private String _class; /* group class */
|
15
|
+
|
16
|
+
public void populate(java.sql.ResultSet resultset) {
|
17
|
+
setId(resultset.getInt("id"));
|
18
|
+
setName(resultset.getString("name"));
|
19
|
+
setDesc(resultset.getString("desc"));
|
20
|
+
setClass(resultset.getString("class"));
|
19
21
|
}
|
20
22
|
|
21
23
|
public int getId() { return id }
|
@@ -27,6 +29,7 @@ public class Group implements java.io.Serializable {
|
|
27
29
|
public String getDesc() { return desc }
|
28
30
|
public void setDesc(String desc) { this.desc = desc; }
|
29
31
|
|
30
|
-
|
32
|
+
public String getClass() { return _class }
|
33
|
+
public void setClass(String _class) { this._class = _class; }
|
31
34
|
|
32
35
|
}
|
@@ -8,22 +8,22 @@
|
|
8
8
|
*/
|
9
9
|
public class User implements java.io.Serializable {
|
10
10
|
|
11
|
-
private int id; /*
|
12
|
-
private String name; /*
|
13
|
-
private String desc; /*
|
11
|
+
private int id; /* user id */
|
12
|
+
private String name; /* user name */
|
13
|
+
private String desc; /* description about user */
|
14
14
|
private String email; /* */
|
15
|
-
private int group_id; /*
|
15
|
+
private int group_id; /* group id to which user belongs */
|
16
16
|
private String account; /* */
|
17
17
|
private String password; /* */
|
18
18
|
|
19
|
-
public
|
20
|
-
|
21
|
-
|
22
|
-
|
23
|
-
|
24
|
-
|
25
|
-
|
26
|
-
|
19
|
+
public void populate(java.sql.ResultSet resultset) {
|
20
|
+
setId(resultset.getInt("id"));
|
21
|
+
setName(resultset.getString("name"));
|
22
|
+
setDesc(resultset.getString("desc"));
|
23
|
+
setEmail(resultset.getString("email"));
|
24
|
+
setGroupId(resultset.getInt("group_id"));
|
25
|
+
setAccount(resultset.getString("account"));
|
26
|
+
setPassword(resultset.getString("password"));
|
27
27
|
}
|
28
28
|
|
29
29
|
public int getId() { return id }
|
@@ -47,8 +47,6 @@ public class User implements java.io.Serializable {
|
|
47
47
|
public String getPassword() { return password }
|
48
48
|
public void setPassword(String password) { this.password = password; }
|
49
49
|
|
50
|
-
// -----------
|
51
|
-
|
52
50
|
private Group group;
|
53
51
|
public Group getGroup() { return group; }
|
54
52
|
public void setGroup(Group group) {
|
@@ -5,17 +5,16 @@
|
|
5
5
|
|
6
6
|
## Group master table
|
7
7
|
class Group
|
8
|
-
|
9
|
-
|
10
|
-
|
11
|
-
|
12
|
-
|
8
|
+
def populate(values={})
|
9
|
+
self.id = values['id']
|
10
|
+
self.name = values['name']
|
11
|
+
self.desc = values['desc']
|
12
|
+
self.class = values['class']
|
13
13
|
end
|
14
14
|
|
15
|
-
attr_accessor :id #
|
16
|
-
attr_accessor :name #
|
17
|
-
attr_accessor :desc #
|
18
|
-
|
19
|
-
// -----------
|
15
|
+
attr_accessor :id # group id
|
16
|
+
attr_accessor :name # group name
|
17
|
+
attr_accessor :desc # group description
|
18
|
+
attr_accessor :class # group class
|
20
19
|
|
21
20
|
end
|
@@ -6,27 +6,24 @@ require 'Group'
|
|
6
6
|
|
7
7
|
## User master table
|
8
8
|
class User
|
9
|
-
|
10
|
-
|
11
|
-
|
12
|
-
|
13
|
-
|
14
|
-
|
15
|
-
|
16
|
-
|
17
|
-
@password = password
|
9
|
+
def populate(values={})
|
10
|
+
self.id = values['id']
|
11
|
+
self.name = values['name']
|
12
|
+
self.desc = values['desc']
|
13
|
+
self.email = values['email']
|
14
|
+
self.group_id = values['group_id']
|
15
|
+
self.account = values['account']
|
16
|
+
self.password = values['password']
|
18
17
|
end
|
19
18
|
|
20
|
-
attr_accessor :id #
|
21
|
-
attr_accessor :name #
|
22
|
-
attr_accessor :desc #
|
19
|
+
attr_accessor :id # user id
|
20
|
+
attr_accessor :name # user name
|
21
|
+
attr_accessor :desc # description about user
|
23
22
|
attr_accessor :email #
|
24
|
-
attr_accessor :group_id #
|
23
|
+
attr_accessor :group_id # group id to which user belongs
|
25
24
|
attr_accessor :account #
|
26
25
|
attr_accessor :password #
|
27
26
|
|
28
|
-
// -----------
|
29
|
-
|
30
27
|
attr_reader :group
|
31
28
|
def group=(group)
|
32
29
|
@group = group
|
data/test/test1/test1.yaml
CHANGED
@@ -2,19 +2,19 @@
|
|
2
2
|
## example data file for kwatable
|
3
3
|
##
|
4
4
|
## copyright(c) 2005 kuwata-lab.com all rights reserved.
|
5
|
-
## $Release: 0.0
|
6
|
-
## $Rev$
|
5
|
+
## $Release: 0.1.0 $
|
6
|
+
## $Rev: 13 $
|
7
7
|
##
|
8
8
|
|
9
9
|
columns:
|
10
10
|
- name: id
|
11
11
|
type: integer
|
12
|
-
|
12
|
+
ident: yes
|
13
13
|
serial: yes
|
14
14
|
|
15
15
|
- name: name
|
16
16
|
type: string
|
17
|
-
|
17
|
+
required: yes
|
18
18
|
width: 63
|
19
19
|
|
20
20
|
- name: desc
|
@@ -53,7 +53,7 @@ columns:
|
|
53
53
|
|
54
54
|
- name: gender
|
55
55
|
type: string
|
56
|
-
|
56
|
+
enum:
|
57
57
|
- M
|
58
58
|
- F
|
59
59
|
|
@@ -63,23 +63,34 @@ tables:
|
|
63
63
|
desc: Group master table
|
64
64
|
columns:
|
65
65
|
- name: id
|
66
|
+
desc: group id
|
66
67
|
- name: name
|
68
|
+
desc: group name
|
67
69
|
- name: desc
|
70
|
+
desc: group description
|
71
|
+
- name: class
|
72
|
+
desc: group class
|
73
|
+
type: string
|
74
|
+
enum: [ ADMIN, SYSTEM, USER, UNUSED ]
|
68
75
|
|
69
76
|
- name: users
|
70
77
|
class: User
|
71
78
|
desc: User master table
|
72
79
|
columns:
|
73
80
|
- name: id
|
81
|
+
desc: user id
|
74
82
|
- name: name
|
83
|
+
desc: user name
|
75
84
|
- name: desc
|
85
|
+
desc: description about user
|
76
86
|
- name: email
|
77
87
|
- name: group_id
|
78
88
|
ref: groups.id
|
89
|
+
desc: group id to which user belongs
|
79
90
|
- name: account
|
80
91
|
type: string
|
81
92
|
width: 31
|
82
|
-
|
93
|
+
required: yes
|
83
94
|
- name: password
|
84
|
-
|
95
|
+
required: yes
|
85
96
|
|
@@ -18,7 +18,7 @@ create table customers (
|
|
18
18
|
name varchar(255) not null,
|
19
19
|
tel varchar(255) ,
|
20
20
|
email varchar(255) ,
|
21
|
-
address_id integer not null -- references addresses
|
21
|
+
address_id integer not null -- references addresses(id)
|
22
22
|
);
|
23
23
|
|
24
24
|
-- Item master table
|
@@ -32,7 +32,7 @@ create table items (
|
|
32
32
|
-- Sales order master table
|
33
33
|
create table sales_orders (
|
34
34
|
id integer auto_increment primary key,
|
35
|
-
customer_id integer not null, -- references customers
|
35
|
+
customer_id integer not null, -- references customers(id)
|
36
36
|
ordered_date date not null,
|
37
37
|
delivery_date date ,
|
38
38
|
amount decimal
|
@@ -41,8 +41,8 @@ create table sales_orders (
|
|
41
41
|
-- Sales Order detail lines
|
42
42
|
create table sales_order_lines (
|
43
43
|
num integer not null,
|
44
|
-
order_id integer not null, -- references sales_orders
|
45
|
-
item_id integer not null, -- references items
|
44
|
+
order_id integer not null, -- references sales_orders(id)
|
45
|
+
item_id integer not null, -- references items(id)
|
46
46
|
price decimal not null,
|
47
47
|
quantity integer not null
|
48
48
|
, primary key (order_id, item_id)
|
@@ -14,12 +14,12 @@ public class Address implements java.io.Serializable {
|
|
14
14
|
private String addr2; /* */
|
15
15
|
private String addr3; /* */
|
16
16
|
|
17
|
-
public
|
18
|
-
|
19
|
-
|
20
|
-
|
21
|
-
|
22
|
-
|
17
|
+
public void populate(java.sql.ResultSet resultset) {
|
18
|
+
setId(resultset.getInt("id"));
|
19
|
+
setZipcode(resultset.getString("zipcode"));
|
20
|
+
setAddr1(resultset.getString("addr1"));
|
21
|
+
setAddr2(resultset.getString("addr2"));
|
22
|
+
setAddr3(resultset.getString("addr3"));
|
23
23
|
}
|
24
24
|
|
25
25
|
public int getId() { return id }
|
@@ -37,6 +37,4 @@ public class Address implements java.io.Serializable {
|
|
37
37
|
public String getAddr3() { return addr3 }
|
38
38
|
public void setAddr3(String addr3) { this.addr3 = addr3; }
|
39
39
|
|
40
|
-
// -----------
|
41
|
-
|
42
40
|
}
|
@@ -14,12 +14,12 @@ public class Customer implements java.io.Serializable {
|
|
14
14
|
private String email; /* */
|
15
15
|
private int address_id; /* */
|
16
16
|
|
17
|
-
public
|
18
|
-
|
19
|
-
|
20
|
-
|
21
|
-
|
22
|
-
|
17
|
+
public void populate(java.sql.ResultSet resultset) {
|
18
|
+
setId(resultset.getInt("id"));
|
19
|
+
setName(resultset.getString("name"));
|
20
|
+
setTel(resultset.getString("tel"));
|
21
|
+
setEmail(resultset.getString("email"));
|
22
|
+
setAddressId(resultset.getInt("address_id"));
|
23
23
|
}
|
24
24
|
|
25
25
|
public int getId() { return id }
|
@@ -37,8 +37,6 @@ public class Customer implements java.io.Serializable {
|
|
37
37
|
public int getAddressId() { return address_id }
|
38
38
|
public void setAddressId(int address_id) { this.address_id = address_id; }
|
39
39
|
|
40
|
-
// -----------
|
41
|
-
|
42
40
|
private Address address;
|
43
41
|
public Address getAddress() { return address; }
|
44
42
|
public void setAddress(Address address) {
|
@@ -13,11 +13,11 @@ public class Item implements java.io.Serializable {
|
|
13
13
|
private String desc; /* */
|
14
14
|
private double price; /* */
|
15
15
|
|
16
|
-
public
|
17
|
-
|
18
|
-
|
19
|
-
|
20
|
-
|
16
|
+
public void populate(java.sql.ResultSet resultset) {
|
17
|
+
setId(resultset.getInt("id"));
|
18
|
+
setName(resultset.getString("name"));
|
19
|
+
setDesc(resultset.getString("desc"));
|
20
|
+
setPrice(resultset.getDouble("price"));
|
21
21
|
}
|
22
22
|
|
23
23
|
public int getId() { return id }
|
@@ -32,6 +32,4 @@ public class Item implements java.io.Serializable {
|
|
32
32
|
public double getPrice() { return price }
|
33
33
|
public void setPrice(double price) { this.price = price; }
|
34
34
|
|
35
|
-
// -----------
|
36
|
-
|
37
35
|
}
|
@@ -15,12 +15,12 @@ public class SalesOrder implements java.io.Serializable {
|
|
15
15
|
private Date delivery_date; /* */
|
16
16
|
private double amount; /* */
|
17
17
|
|
18
|
-
public
|
19
|
-
|
20
|
-
|
21
|
-
|
22
|
-
|
23
|
-
|
18
|
+
public void populate(java.sql.ResultSet resultset) {
|
19
|
+
setId(resultset.getInt("id"));
|
20
|
+
setCustomerId(resultset.getInt("customer_id"));
|
21
|
+
setOrderedDate(resultset.getDate("ordered_date"));
|
22
|
+
setDeliveryDate(resultset.getDate("delivery_date"));
|
23
|
+
setAmount(resultset.getDouble("amount"));
|
24
24
|
}
|
25
25
|
|
26
26
|
public int getId() { return id }
|
@@ -38,8 +38,6 @@ public class SalesOrder implements java.io.Serializable {
|
|
38
38
|
public double getAmount() { return amount }
|
39
39
|
public void setAmount(double amount) { this.amount = amount; }
|
40
40
|
|
41
|
-
// -----------
|
42
|
-
|
43
41
|
private Customer customer;
|
44
42
|
public Customer getCustomer() { return customer; }
|
45
43
|
public void setCustomer(Customer customer) {
|
@@ -14,12 +14,12 @@ public class SalesOrderLine implements java.io.Serializable {
|
|
14
14
|
private double price; /* */
|
15
15
|
private int quantity; /* */
|
16
16
|
|
17
|
-
public
|
18
|
-
|
19
|
-
|
20
|
-
|
21
|
-
|
22
|
-
|
17
|
+
public void populate(java.sql.ResultSet resultset) {
|
18
|
+
setNum(resultset.getInt("num"));
|
19
|
+
setOrderId(resultset.getInt("order_id"));
|
20
|
+
setItemId(resultset.getInt("item_id"));
|
21
|
+
setPrice(resultset.getDouble("price"));
|
22
|
+
setQuantity(resultset.getInt("quantity"));
|
23
23
|
}
|
24
24
|
|
25
25
|
public int getNum() { return num }
|
@@ -37,8 +37,6 @@ public class SalesOrderLine implements java.io.Serializable {
|
|
37
37
|
public int getQuantity() { return quantity }
|
38
38
|
public void setQuantity(int quantity) { this.quantity = quantity; }
|
39
39
|
|
40
|
-
// -----------
|
41
|
-
|
42
40
|
private SalesOrder order;
|
43
41
|
public SalesOrder getOrder() { return order; }
|
44
42
|
public void setOrder(SalesOrder order) {
|