Bläddra i källkod

classes and test class

Michelle DiMarino 6 år sedan
förälder
incheckning
ab993538f8

Binär
.DS_Store Visa fil


Binär
ormLab/.DS_Store Visa fil


+ 13
- 0
ormLab/.idea/compiler.xml Visa fil

@@ -0,0 +1,13 @@
1
+<?xml version="1.0" encoding="UTF-8"?>
2
+<project version="4">
3
+  <component name="CompilerConfiguration">
4
+    <annotationProcessing>
5
+      <profile name="Maven default annotation processors profile" enabled="true">
6
+        <sourceOutputDir name="target/generated-sources/annotations" />
7
+        <sourceTestOutputDir name="target/generated-test-sources/test-annotations" />
8
+        <outputRelativeToContentRoot value="true" />
9
+        <module name="ormLab" />
10
+      </profile>
11
+    </annotationProcessing>
12
+  </component>
13
+</project>

+ 14
- 0
ormLab/.idea/misc.xml Visa fil

@@ -0,0 +1,14 @@
1
+<?xml version="1.0" encoding="UTF-8"?>
2
+<project version="4">
3
+  <component name="ExternalStorageConfigurationManager" enabled="true" />
4
+  <component name="MavenProjectsManager">
5
+    <option name="originalFiles">
6
+      <list>
7
+        <option value="$PROJECT_DIR$/pom.xml" />
8
+      </list>
9
+    </option>
10
+  </component>
11
+  <component name="ProjectRootManager" version="2" languageLevel="JDK_1_8" project-jdk-name="1.8" project-jdk-type="JavaSDK">
12
+    <output url="file://$PROJECT_DIR$/out" />
13
+  </component>
14
+</project>

+ 6
- 0
ormLab/.idea/vcs.xml Visa fil

@@ -0,0 +1,6 @@
1
+<?xml version="1.0" encoding="UTF-8"?>
2
+<project version="4">
3
+  <component name="VcsDirectoryMappings">
4
+    <mapping directory="$PROJECT_DIR$/.." vcs="Git" />
5
+  </component>
6
+</project>

+ 479
- 0
ormLab/.idea/workspace.xml Visa fil

@@ -0,0 +1,479 @@
1
+<?xml version="1.0" encoding="UTF-8"?>
2
+<project version="4">
3
+  <component name="ChangeListManager">
4
+    <list default="true" id="d3e9235f-d69e-4589-97ea-7b08f00d1d0f" name="Default Changelist" comment="">
5
+      <change afterPath="$PROJECT_DIR$/src/main/java/Console.java" afterDir="false" />
6
+      <change afterPath="$PROJECT_DIR$/src/main/java/DatabaseConnection.java" afterDir="false" />
7
+      <change afterPath="$PROJECT_DIR$/src/main/java/Service.java" afterDir="false" />
8
+      <change afterPath="$PROJECT_DIR$/src/test/java/ServiceTest.java" afterDir="false" />
9
+    </list>
10
+    <ignored path="$PROJECT_DIR$/out/" />
11
+    <ignored path="$PROJECT_DIR$/target/" />
12
+    <option name="EXCLUDED_CONVERTED_TO_IGNORED" value="true" />
13
+    <option name="SHOW_DIALOG" value="false" />
14
+    <option name="HIGHLIGHT_CONFLICTS" value="true" />
15
+    <option name="HIGHLIGHT_NON_ACTIVE_CHANGELIST" value="false" />
16
+    <option name="LAST_RESOLUTION" value="IGNORE" />
17
+  </component>
18
+  <component name="FUSProjectUsageTrigger">
19
+    <session id="-1790706458">
20
+      <usages-collector id="statistics.lifecycle.project">
21
+        <counts>
22
+          <entry key="project.open.time.2" value="1" />
23
+          <entry key="project.opened" value="1" />
24
+        </counts>
25
+      </usages-collector>
26
+      <usages-collector id="statistics.file.extensions.edit">
27
+        <counts>
28
+          <entry key="java" value="30" />
29
+          <entry key="xml" value="15" />
30
+        </counts>
31
+      </usages-collector>
32
+      <usages-collector id="statistics.file.types.edit">
33
+        <counts>
34
+          <entry key="JAVA" value="30" />
35
+          <entry key="XML" value="15" />
36
+        </counts>
37
+      </usages-collector>
38
+      <usages-collector id="statistics.file.extensions.open">
39
+        <counts>
40
+          <entry key="java" value="3" />
41
+        </counts>
42
+      </usages-collector>
43
+      <usages-collector id="statistics.file.types.open">
44
+        <counts>
45
+          <entry key="JAVA" value="3" />
46
+        </counts>
47
+      </usages-collector>
48
+    </session>
49
+    <session id="589865822">
50
+      <usages-collector id="statistics.lifecycle.project">
51
+        <counts>
52
+          <entry key="project.open.time.7" value="1" />
53
+          <entry key="project.opened" value="1" />
54
+        </counts>
55
+      </usages-collector>
56
+      <usages-collector id="statistics.file.extensions.edit">
57
+        <counts>
58
+          <entry key="java" value="630" />
59
+          <entry key="xml" value="8" />
60
+        </counts>
61
+      </usages-collector>
62
+      <usages-collector id="statistics.file.types.edit">
63
+        <counts>
64
+          <entry key="JAVA" value="630" />
65
+          <entry key="XML" value="8" />
66
+        </counts>
67
+      </usages-collector>
68
+      <usages-collector id="statistics.file.extensions.open">
69
+        <counts>
70
+          <entry key="java" value="4" />
71
+        </counts>
72
+      </usages-collector>
73
+      <usages-collector id="statistics.file.types.open">
74
+        <counts>
75
+          <entry key="JAVA" value="4" />
76
+        </counts>
77
+      </usages-collector>
78
+    </session>
79
+  </component>
80
+  <component name="FileEditorManager">
81
+    <leaf SIDE_TABS_SIZE_LIMIT_KEY="300">
82
+      <file pinned="false" current-in-tab="false">
83
+        <entry file="file://$PROJECT_DIR$/src/main/java/Account.java">
84
+          <provider selected="true" editor-type-id="text-editor">
85
+            <state relative-caret-position="765">
86
+              <caret line="65" selection-start-line="65" selection-end-line="65" />
87
+              <folding>
88
+                <element signature="imports" expanded="true" />
89
+              </folding>
90
+            </state>
91
+          </provider>
92
+        </entry>
93
+      </file>
94
+      <file pinned="false" current-in-tab="false">
95
+        <entry file="file://$PROJECT_DIR$/src/main/java/AccountApp.java">
96
+          <provider selected="true" editor-type-id="text-editor">
97
+            <state relative-caret-position="434">
98
+              <caret line="62" lean-forward="true" selection-start-line="61" selection-start-column="21" selection-end-line="62" />
99
+              <folding>
100
+                <element signature="imports" expanded="true" />
101
+              </folding>
102
+            </state>
103
+          </provider>
104
+        </entry>
105
+      </file>
106
+      <file pinned="false" current-in-tab="true">
107
+        <entry file="file://$PROJECT_DIR$/src/main/java/Service.java">
108
+          <provider selected="true" editor-type-id="text-editor">
109
+            <state relative-caret-position="180">
110
+              <caret line="12" column="43" selection-start-line="12" selection-start-column="43" selection-end-line="12" selection-end-column="43" />
111
+              <folding>
112
+                <element signature="imports" expanded="true" />
113
+              </folding>
114
+            </state>
115
+          </provider>
116
+        </entry>
117
+      </file>
118
+      <file pinned="false" current-in-tab="false">
119
+        <entry file="file://$PROJECT_DIR$/src/test/java/ServiceTest.java">
120
+          <provider selected="true" editor-type-id="text-editor">
121
+            <state relative-caret-position="420">
122
+              <caret line="28" selection-start-line="28" selection-end-line="28" />
123
+              <folding>
124
+                <element signature="imports" expanded="true" />
125
+              </folding>
126
+            </state>
127
+          </provider>
128
+        </entry>
129
+      </file>
130
+      <file pinned="false" current-in-tab="false">
131
+        <entry file="file://$PROJECT_DIR$/src/main/java/DatabaseConnection.java">
132
+          <provider selected="true" editor-type-id="text-editor">
133
+            <state relative-caret-position="120">
134
+              <caret line="8" selection-start-line="8" selection-end-line="8" />
135
+            </state>
136
+          </provider>
137
+        </entry>
138
+      </file>
139
+    </leaf>
140
+  </component>
141
+  <component name="FileTemplateManagerImpl">
142
+    <option name="RECENT_TEMPLATES">
143
+      <list>
144
+        <option value="Interface" />
145
+        <option value="Class" />
146
+      </list>
147
+    </option>
148
+  </component>
149
+  <component name="Git.Settings">
150
+    <option name="RECENT_GIT_ROOT_PATH" value="$PROJECT_DIR$/.." />
151
+  </component>
152
+  <component name="IdeDocumentHistory">
153
+    <option name="CHANGED_PATHS">
154
+      <list>
155
+        <option value="$PROJECT_DIR$/src/main/java/Account.java" />
156
+        <option value="$PROJECT_DIR$/src/main/java/AccountApp.java" />
157
+        <option value="$PROJECT_DIR$/pom.xml" />
158
+        <option value="$PROJECT_DIR$/src/main/java/DatabaseConnection.java" />
159
+        <option value="$PROJECT_DIR$/src/test/java/ServiceTest.java" />
160
+        <option value="$PROJECT_DIR$/src/main/java/Service.java" />
161
+      </list>
162
+    </option>
163
+  </component>
164
+  <component name="JsBuildToolGruntFileManager" detection-done="true" sorting="DEFINITION_ORDER" />
165
+  <component name="JsBuildToolPackageJson" detection-done="true" sorting="DEFINITION_ORDER" />
166
+  <component name="JsGulpfileManager">
167
+    <detection-done>true</detection-done>
168
+    <sorting>DEFINITION_ORDER</sorting>
169
+  </component>
170
+  <component name="MavenImportPreferences">
171
+    <option name="importingSettings">
172
+      <MavenImportingSettings>
173
+        <option name="importAutomatically" value="true" />
174
+      </MavenImportingSettings>
175
+    </option>
176
+  </component>
177
+  <component name="MavenProjectNavigator">
178
+    <treeState>
179
+      <expand>
180
+        <path>
181
+          <item name="" type="16c1761:MavenProjectsStructure$RootNode" />
182
+          <item name="ormLab" type="9519ce18:MavenProjectsStructure$ProjectNode" />
183
+        </path>
184
+      </expand>
185
+      <select />
186
+    </treeState>
187
+  </component>
188
+  <component name="ProjectFrameBounds">
189
+    <option name="y" value="24" />
190
+    <option name="width" value="1260" />
191
+    <option name="height" value="708" />
192
+  </component>
193
+  <component name="ProjectLevelVcsManager" settingsEditedManually="true" />
194
+  <component name="ProjectView">
195
+    <navigator proportions="" version="1">
196
+      <foldersAlwaysOnTop value="true" />
197
+    </navigator>
198
+    <panes>
199
+      <pane id="PackagesPane" />
200
+      <pane id="Scope" />
201
+      <pane id="ProjectPane">
202
+        <subPane>
203
+          <expand>
204
+            <path>
205
+              <item name="ormLab" type="b2602c69:ProjectViewProjectNode" />
206
+              <item name="ormLab" type="462c0819:PsiDirectoryNode" />
207
+            </path>
208
+            <path>
209
+              <item name="ormLab" type="b2602c69:ProjectViewProjectNode" />
210
+              <item name="ormLab" type="462c0819:PsiDirectoryNode" />
211
+              <item name="src" type="462c0819:PsiDirectoryNode" />
212
+            </path>
213
+            <path>
214
+              <item name="ormLab" type="b2602c69:ProjectViewProjectNode" />
215
+              <item name="ormLab" type="462c0819:PsiDirectoryNode" />
216
+              <item name="src" type="462c0819:PsiDirectoryNode" />
217
+              <item name="main" type="462c0819:PsiDirectoryNode" />
218
+            </path>
219
+            <path>
220
+              <item name="ormLab" type="b2602c69:ProjectViewProjectNode" />
221
+              <item name="ormLab" type="462c0819:PsiDirectoryNode" />
222
+              <item name="src" type="462c0819:PsiDirectoryNode" />
223
+              <item name="main" type="462c0819:PsiDirectoryNode" />
224
+              <item name="java" type="462c0819:PsiDirectoryNode" />
225
+            </path>
226
+            <path>
227
+              <item name="ormLab" type="b2602c69:ProjectViewProjectNode" />
228
+              <item name="ormLab" type="462c0819:PsiDirectoryNode" />
229
+              <item name="src" type="462c0819:PsiDirectoryNode" />
230
+              <item name="test" type="462c0819:PsiDirectoryNode" />
231
+            </path>
232
+            <path>
233
+              <item name="ormLab" type="b2602c69:ProjectViewProjectNode" />
234
+              <item name="ormLab" type="462c0819:PsiDirectoryNode" />
235
+              <item name="src" type="462c0819:PsiDirectoryNode" />
236
+              <item name="test" type="462c0819:PsiDirectoryNode" />
237
+              <item name="java" type="462c0819:PsiDirectoryNode" />
238
+            </path>
239
+          </expand>
240
+          <select />
241
+        </subPane>
242
+      </pane>
243
+    </panes>
244
+  </component>
245
+  <component name="PropertiesComponent">
246
+    <property name="WebServerToolWindowFactoryState" value="false" />
247
+    <property name="aspect.path.notification.shown" value="true" />
248
+    <property name="com.android.tools.idea.instantapp.provision.ProvisionBeforeRunTaskProvider.myTimeStamp" value="1542312725634" />
249
+    <property name="last_opened_file_path" value="$PROJECT_DIR$/pom.xml" />
250
+    <property name="nodejs_interpreter_path.stuck_in_default_project" value="undefined stuck path" />
251
+    <property name="nodejs_npm_path_reset_for_default_project" value="true" />
252
+    <property name="project.structure.last.edited" value="Project" />
253
+    <property name="project.structure.proportion" value="0.0" />
254
+    <property name="project.structure.side.proportion" value="0.0" />
255
+  </component>
256
+  <component name="RunDashboard">
257
+    <option name="ruleStates">
258
+      <list>
259
+        <RuleState>
260
+          <option name="name" value="ConfigurationTypeDashboardGroupingRule" />
261
+        </RuleState>
262
+        <RuleState>
263
+          <option name="name" value="StatusDashboardGroupingRule" />
264
+        </RuleState>
265
+      </list>
266
+    </option>
267
+  </component>
268
+  <component name="RunManager">
269
+    <configuration name="AccountApp" type="Application" factoryName="Application" temporary="true" nameIsGenerated="true">
270
+      <option name="MAIN_CLASS_NAME" value="AccountApp" />
271
+      <module name="ormLab" />
272
+      <method v="2">
273
+        <option name="Make" enabled="true" />
274
+      </method>
275
+    </configuration>
276
+    <recent_temporary>
277
+      <list>
278
+        <item itemvalue="Application.AccountApp" />
279
+      </list>
280
+    </recent_temporary>
281
+  </component>
282
+  <component name="SvnConfiguration">
283
+    <configuration />
284
+  </component>
285
+  <component name="TaskManager">
286
+    <task active="true" id="Default" summary="Default task">
287
+      <changelist id="d3e9235f-d69e-4589-97ea-7b08f00d1d0f" name="Default Changelist" comment="" />
288
+      <created>1542305475408</created>
289
+      <option name="number" value="Default" />
290
+      <option name="presentableId" value="Default" />
291
+      <updated>1542305475408</updated>
292
+      <workItem from="1542305477578" duration="1737000" />
293
+      <workItem from="1542308857229" duration="4169000" />
294
+    </task>
295
+    <servers />
296
+  </component>
297
+  <component name="TimeTrackingManager">
298
+    <option name="totallyTimeSpent" value="5906000" />
299
+  </component>
300
+  <component name="ToolWindowManager">
301
+    <frame x="0" y="24" width="1260" height="708" extended-state="0" />
302
+    <editor active="true" />
303
+    <layout>
304
+      <window_info active="true" content_ui="combo" id="Project" order="0" visible="true" weight="0.2536946" />
305
+      <window_info id="Structure" order="1" side_tool="true" weight="0.25" />
306
+      <window_info id="Image Layers" order="2" />
307
+      <window_info id="Designer" order="3" />
308
+      <window_info id="UI Designer" order="4" />
309
+      <window_info id="Capture Tool" order="5" />
310
+      <window_info id="Favorites" order="6" side_tool="true" />
311
+      <window_info anchor="bottom" id="Thumbnails" weight="0.32954547" />
312
+      <window_info anchor="bottom" id="Message" order="0" />
313
+      <window_info anchor="bottom" id="Find" order="1" />
314
+      <window_info anchor="bottom" id="Run" order="2" weight="0.32954547" />
315
+      <window_info anchor="bottom" id="Debug" order="3" weight="0.4" />
316
+      <window_info anchor="bottom" id="Cvs" order="4" weight="0.25" />
317
+      <window_info anchor="bottom" id="Inspection" order="5" weight="0.4" />
318
+      <window_info anchor="bottom" id="TODO" order="6" />
319
+      <window_info anchor="bottom" id="Version Control" order="7" show_stripe_button="false" />
320
+      <window_info anchor="bottom" id="Database Changes" order="8" show_stripe_button="false" />
321
+      <window_info anchor="bottom" id="Terminal" order="9" />
322
+      <window_info anchor="bottom" id="Event Log" order="10" side_tool="true" />
323
+      <window_info anchor="bottom" id="Messages" order="11" weight="0.32954547" />
324
+      <window_info anchor="right" id="Commander" internal_type="SLIDING" order="0" type="SLIDING" weight="0.4" />
325
+      <window_info anchor="right" id="Ant Build" order="1" weight="0.25" />
326
+      <window_info anchor="right" content_ui="combo" id="Hierarchy" order="2" weight="0.25" />
327
+      <window_info anchor="right" id="Palette" order="3" />
328
+      <window_info anchor="right" id="Capture Analysis" order="4" />
329
+      <window_info anchor="right" id="Database" order="5" />
330
+      <window_info anchor="right" id="Theme Preview" order="6" />
331
+      <window_info anchor="right" id="Palette&#9;" order="7" />
332
+      <window_info anchor="right" id="Maven Projects" order="8" weight="0.32922825" />
333
+    </layout>
334
+  </component>
335
+  <component name="TypeScriptGeneratedFilesManager">
336
+    <option name="version" value="1" />
337
+  </component>
338
+  <component name="VcsContentAnnotationSettings">
339
+    <option name="myLimit" value="2678400000" />
340
+  </component>
341
+  <component name="editorHistoryManager">
342
+    <entry file="file://$PROJECT_DIR$/src/main/java/Console.java">
343
+      <provider selected="true" editor-type-id="text-editor">
344
+        <state>
345
+          <caret column="20" selection-start-column="20" selection-end-column="20" />
346
+        </state>
347
+      </provider>
348
+    </entry>
349
+    <entry file="file://$PROJECT_DIR$/src/main/java/DatabaseConnection.java">
350
+      <provider selected="true" editor-type-id="text-editor">
351
+        <state relative-caret-position="120">
352
+          <caret line="8" selection-start-line="8" selection-end-line="8" />
353
+        </state>
354
+      </provider>
355
+    </entry>
356
+    <entry file="file://$PROJECT_DIR$/src/test/java/ServiceTest.java">
357
+      <provider selected="true" editor-type-id="text-editor">
358
+        <state relative-caret-position="420">
359
+          <caret line="28" selection-start-line="28" selection-end-line="28" />
360
+          <folding>
361
+            <element signature="imports" expanded="true" />
362
+          </folding>
363
+        </state>
364
+      </provider>
365
+    </entry>
366
+    <entry file="file://$PROJECT_DIR$/pom.xml">
367
+      <provider selected="true" editor-type-id="text-editor">
368
+        <state relative-caret-position="539">
369
+          <caret line="40" selection-start-line="40" selection-end-line="40" />
370
+        </state>
371
+      </provider>
372
+    </entry>
373
+    <entry file="file://$PROJECT_DIR$/src/main/java/Account.java">
374
+      <provider selected="true" editor-type-id="text-editor">
375
+        <state relative-caret-position="765">
376
+          <caret line="65" selection-start-line="65" selection-end-line="65" />
377
+          <folding>
378
+            <element signature="imports" expanded="true" />
379
+          </folding>
380
+        </state>
381
+      </provider>
382
+    </entry>
383
+    <entry file="file://$PROJECT_DIR$/src/main/java/AccountApp.java">
384
+      <provider selected="true" editor-type-id="text-editor">
385
+        <state relative-caret-position="434">
386
+          <caret line="62" lean-forward="true" selection-start-line="61" selection-start-column="21" selection-end-line="62" />
387
+          <folding>
388
+            <element signature="imports" expanded="true" />
389
+          </folding>
390
+        </state>
391
+      </provider>
392
+    </entry>
393
+    <entry file="file://$PROJECT_DIR$/src/main/java/Service.java">
394
+      <provider selected="true" editor-type-id="text-editor">
395
+        <state relative-caret-position="180">
396
+          <caret line="12" column="43" selection-start-line="12" selection-start-column="43" selection-end-line="12" selection-end-column="43" />
397
+          <folding>
398
+            <element signature="imports" expanded="true" />
399
+          </folding>
400
+        </state>
401
+      </provider>
402
+    </entry>
403
+  </component>
404
+  <component name="masterDetails">
405
+    <states>
406
+      <state key="ArtifactsStructureConfigurable.UI">
407
+        <settings>
408
+          <artifact-editor />
409
+          <splitter-proportions>
410
+            <option name="proportions">
411
+              <list>
412
+                <option value="0.2" />
413
+              </list>
414
+            </option>
415
+          </splitter-proportions>
416
+        </settings>
417
+      </state>
418
+      <state key="FacetStructureConfigurable.UI">
419
+        <settings>
420
+          <last-edited>No facets are configured</last-edited>
421
+          <splitter-proportions>
422
+            <option name="proportions">
423
+              <list>
424
+                <option value="0.2" />
425
+              </list>
426
+            </option>
427
+          </splitter-proportions>
428
+        </settings>
429
+      </state>
430
+      <state key="GlobalLibrariesConfigurable.UI">
431
+        <settings>
432
+          <splitter-proportions>
433
+            <option name="proportions">
434
+              <list>
435
+                <option value="0.2" />
436
+              </list>
437
+            </option>
438
+          </splitter-proportions>
439
+        </settings>
440
+      </state>
441
+      <state key="JdkListConfigurable.UI">
442
+        <settings>
443
+          <last-edited>1.8</last-edited>
444
+          <splitter-proportions>
445
+            <option name="proportions">
446
+              <list>
447
+                <option value="0.2" />
448
+              </list>
449
+            </option>
450
+          </splitter-proportions>
451
+        </settings>
452
+      </state>
453
+      <state key="ModuleStructureConfigurable.UI">
454
+        <settings>
455
+          <last-edited>ormLab</last-edited>
456
+          <splitter-proportions>
457
+            <option name="proportions">
458
+              <list>
459
+                <option value="0.2" />
460
+              </list>
461
+            </option>
462
+          </splitter-proportions>
463
+        </settings>
464
+      </state>
465
+      <state key="ProjectLibrariesConfigurable.UI">
466
+        <settings>
467
+          <last-edited>Maven: com.j256.ormlite:ormlite-core:4.48</last-edited>
468
+          <splitter-proportions>
469
+            <option name="proportions">
470
+              <list>
471
+                <option value="0.2" />
472
+              </list>
473
+            </option>
474
+          </splitter-proportions>
475
+        </settings>
476
+      </state>
477
+    </states>
478
+  </component>
479
+</project>

+ 46
- 0
ormLab/pom.xml Visa fil

@@ -0,0 +1,46 @@
1
+<?xml version="1.0" encoding="UTF-8"?>
2
+<project xmlns="http://maven.apache.org/POM/4.0.0"
3
+         xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
4
+         xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
5
+    <modelVersion>4.0.0</modelVersion>
6
+
7
+    <groupId>ormLab</groupId>
8
+    <artifactId>ormLab</artifactId>
9
+    <version>1.0-SNAPSHOT</version>
10
+
11
+    <dependencies>
12
+
13
+    <!-- https://mvnrepository.com/artifact/com.j256.ormlite/ormlite-core -->
14
+    <dependency>
15
+        <groupId>com.j256.ormlite</groupId>
16
+        <artifactId>ormlite-core</artifactId>
17
+        <version>4.48</version>
18
+    </dependency>
19
+
20
+    <!-- https://mvnrepository.com/artifact/com.j256.ormlite/ormlite-jdbc -->
21
+    <dependency>
22
+        <groupId>com.j256.ormlite</groupId>
23
+        <artifactId>ormlite-jdbc</artifactId>
24
+        <version>4.48</version>
25
+    </dependency>
26
+
27
+        <!-- https://mvnrepository.com/artifact/mysql/mysql-connector-java -->
28
+        <dependency>
29
+            <groupId>mysql</groupId>
30
+            <artifactId>mysql-connector-java</artifactId>
31
+            <version>8.0.12</version>
32
+        </dependency>
33
+
34
+        <!-- https://mvnrepository.com/artifact/junit/junit -->
35
+        <dependency>
36
+            <groupId>junit</groupId>
37
+            <artifactId>junit</artifactId>
38
+            <version>4.12</version>
39
+            <scope>test</scope>
40
+        </dependency>
41
+
42
+
43
+    </dependencies>
44
+
45
+
46
+</project>

Binär
ormLab/src/.DS_Store Visa fil


+ 66
- 0
ormLab/src/main/java/Account.java Visa fil

@@ -0,0 +1,66 @@
1
+import com.j256.ormlite.field.DatabaseField;
2
+import com.j256.ormlite.table.DatabaseTable;
3
+
4
+    @DatabaseTable(tableName = "account")
5
+    public class Account {
6
+
7
+        public static final String NAME_FIELD_NAME = "name";
8
+        public static final String PASSWORD_FIELD_NAME = "password";
9
+
10
+        @DatabaseField(columnName = "id", generatedId = true)
11
+        private int id;
12
+
13
+        @DatabaseField(columnName = "name", canBeNull = false)
14
+        private String name;
15
+
16
+        @DatabaseField(columnName = "password")
17
+        private String password;
18
+
19
+        Account() {
20
+            // all persisted classes must define a no-arg constructor with at least package visibility
21
+        }
22
+
23
+        public Account(String name) {
24
+            this.name = name;
25
+        }
26
+
27
+        public Account(String name, String password) {
28
+            this.name = name;
29
+            this.password = password;
30
+        }
31
+
32
+        public int getId() {
33
+            return id;
34
+        }
35
+
36
+        public String getName() {
37
+            return name;
38
+        }
39
+
40
+        public void setName(String name) {
41
+            this.name = name;
42
+        }
43
+
44
+        public String getPassword() {
45
+            return password;
46
+        }
47
+
48
+        public void setPassword(String password) {
49
+            this.password = password;
50
+        }
51
+
52
+        @Override
53
+        public int hashCode() {
54
+            return name.hashCode();
55
+        }
56
+
57
+        @Override
58
+        public boolean equals(Object other) {
59
+            if (other == null || other.getClass() != getClass()) {
60
+                return false;
61
+            }
62
+            return name.equals(((Account) other).name);
63
+        }
64
+    }
65
+
66
+

+ 65
- 0
ormLab/src/main/java/AccountApp.java Visa fil

@@ -0,0 +1,65 @@
1
+import com.j256.ormlite.dao.Dao;
2
+import com.j256.ormlite.dao.DaoManager;
3
+import com.j256.ormlite.jdbc.JdbcConnectionSource;
4
+import com.j256.ormlite.support.ConnectionSource;
5
+
6
+public class AccountApp {
7
+
8
+    // we are using a MySQl database
9
+    private final static String DATABASE_URL = "jdbc:mysql://localhost:3306/orm_lab?useUnicode=true";
10
+
11
+    private Dao<Account, Integer> accountDao;
12
+
13
+    public static void main(String[] args) throws Exception {
14
+        // turn our static method into an instance of Main
15
+        new AccountApp().doMain(args);
16
+    }
17
+
18
+    private void doMain(String[] args) throws Exception {
19
+        ConnectionSource connectionSource = null;
20
+        try {
21
+            // create our data-source for the database
22
+            connectionSource = new JdbcConnectionSource(DATABASE_URL, "root", "");
23
+            // setup our  DAOs
24
+            setupDao(connectionSource);
25
+            // read, write and delete some data
26
+            processData();
27
+
28
+            System.out.println("\n\nIt seems to have worked\n\n");
29
+        } finally {
30
+            // destroy the data source which should close underlying connections
31
+            if (connectionSource != null) {
32
+                connectionSource.close();
33
+            }
34
+        }
35
+    }
36
+
37
+    /**
38
+     * Read and write some example data.
39
+     */
40
+    private void processData() throws Exception {
41
+        // create an instance of Account
42
+        String name = "Jim Coakley";
43
+        Account account = new Account(name);
44
+
45
+        // persist the account object to the database
46
+        accountDao.create(account);
47
+        int id = account.getId();
48
+        System.out.println(id);
49
+        // assign a password
50
+        account.setPassword("_secret");
51
+        // update the database after changing the object
52
+        accountDao.update(account);
53
+        // delete the account
54
+        //accountDao.deleteById(id);
55
+    }
56
+
57
+    /**
58
+     * Setup our  DAOs
59
+     */
60
+    private void setupDao(ConnectionSource connectionSource) throws Exception {
61
+
62
+        accountDao = DaoManager.createDao(connectionSource, Account.class);
63
+
64
+    }
65
+}

+ 2
- 0
ormLab/src/main/java/Console.java Visa fil

@@ -0,0 +1,2 @@
1
+public class Console {
2
+}

+ 10
- 0
ormLab/src/main/java/DatabaseConnection.java Visa fil

@@ -0,0 +1,10 @@
1
+public interface DatabaseConnection<T> {
2
+    public void create();
3
+
4
+    public void read();
5
+
6
+    public void update();
7
+
8
+    public void delete();
9
+
10
+}

+ 31
- 0
ormLab/src/main/java/Service.java Visa fil

@@ -0,0 +1,31 @@
1
+import com.j256.ormlite.dao.Dao;
2
+import com.j256.ormlite.dao.DaoManager;
3
+
4
+public class Service {
5
+
6
+    private Dao<Account, Integer> daoAccount;
7
+
8
+    public Service(){
9
+        this.daoAccount = DaoManager.createDao(connectionSource, Account.class);
10
+
11
+    }
12
+
13
+    public void create(Account newAccount, ){
14
+        daoAccount.create();
15
+
16
+    }
17
+
18
+    public void read(){
19
+        DAO.queryForId();
20
+
21
+
22
+    }
23
+
24
+    public void update(){
25
+
26
+    }
27
+
28
+    public void delete(){
29
+
30
+    }
31
+}

+ 44
- 0
ormLab/src/test/java/ServiceTest.java Visa fil

@@ -0,0 +1,44 @@
1
+import org.junit.Test;
2
+import org.junit.Assert;
3
+
4
+public class ServiceTest {
5
+
6
+    @Test
7
+    public void createTest(){
8
+
9
+    }
10
+
11
+    @Test
12
+    public void readTest(){
13
+
14
+    }
15
+
16
+    @Test
17
+    public void updateTest(){
18
+
19
+    }
20
+
21
+    @Test
22
+    public void deleteTest(){
23
+
24
+    }
25
+
26
+    class mockDBConnection implements DatabaseConnection{
27
+
28
+        public void create() {
29
+
30
+        }
31
+
32
+        public void read() {
33
+
34
+        }
35
+
36
+        public void update() {
37
+
38
+        }
39
+
40
+        public void delete() {
41
+
42
+        }
43
+    }
44
+}

Binär
ormLab/target/classes/Account.class Visa fil


Binär
ormLab/target/classes/AccountApp.class Visa fil