-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathPopulate.java
More file actions
88 lines (77 loc) · 2.94 KB
/
Copy pathPopulate.java
File metadata and controls
88 lines (77 loc) · 2.94 KB
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
import Base.IContext;
import Base.Model.*;
import Base.Repository.IRepository;
import Repository.ModelContext;
import java.awt.*;
import java.math.BigDecimal;
/**
* Created by Mateusz on 17/01/2016.
*/
public class Populate {
public static void main(String[] args) {
IContext context = new ModelContext();
IRepository<Boots> bootsRepository = context.getRepositoryFor(Boots.class);
for (int i = 0; i < 5; i++) {
Boots boots = new Boots();
boots.setName("Buty");
boots.setPrice(new BigDecimal(199.90));
boots.setSex(Sex.WOMAN);
boots.setColor(Color.BLACK);
boots.setBrand("Adidas");
boots.setHeels(false);
boots.setSize(40);
bootsRepository.add(boots);
}
IRepository<ElegantShirt> elegantShirtRepository = context.getRepositoryFor(ElegantShirt.class);
for (int i = 0; i < 5; i++) {
ElegantShirt shirt = new ElegantShirt();
shirt.setName("Koszule");
shirt.setPrice(new BigDecimal(199.99));
shirt.setSex(Sex.WOMAN);
shirt.setColor(Color.BLACK);
shirt.setBrand("Adidas");
shirt.setTie(true);
shirt.setCollarSize(40);
shirt.setMaterial("Materiał");
elegantShirtRepository.add(shirt);
}
IRepository<Jacket> jacketRepository = context.getRepositoryFor(Jacket.class);
for (int i = 0; i < 5; i++) {
Jacket jacket = new Jacket();
jacket.setName("Jacket");
jacket.setPrice(new BigDecimal(199.99));
jacket.setSex(Sex.WOMAN);
jacket.setColor(Color.BLACK);
jacket.setBrand("Adidas");
jacket.setSize(Size.M);
jacket.setJacketType(JacketType.SUMMER_JACKET);
jacket.setLockType(LockType.BUTTONS);
jacketRepository.add(jacket);
}
IRepository<Pants> pantsRepository = context.getRepositoryFor(Pants.class);
for (int i = 0; i < 5; i++) {
Pants pants = new Pants();
pants.setName("Spodnie");
pants.setPrice(new BigDecimal(199.99));
pants.setSex(Sex.WOMAN);
pants.setColor(Color.BLACK);
pants.setBrand("Adidas");
pants.setLengthSize(44);
pants.setWidthSize(35);
pants.setMaterial("Materiał");
pantsRepository.add(pants);
}
IRepository<TShirt> tShirtIRepository = context.getRepositoryFor(TShirt.class);
for (int i = 0; i < 5; i++) {
TShirt tShirt = new TShirt();
tShirt.setName("Koszulki");
tShirt.setPrice(new BigDecimal(199.99));
tShirt.setSex(Sex.WOMAN);
tShirt.setColor(Color.BLACK);
tShirt.setBrand("Adidas");
tShirt.setSize(Size.L);
tShirt.setMaterial("Materiał");
tShirtIRepository.add(tShirt);
}
}
}