Przeglądaj źródła

controlloopstub

Seth 6 lat temu
rodzic
commit
da21513355

+ 47
- 54
.idea/workspace.xml Wyświetl plik

2
 <project version="4">
2
 <project version="4">
3
   <component name="ChangeListManager">
3
   <component name="ChangeListManager">
4
     <list default="true" id="b71a0d05-772d-4338-8f47-61b6a36d5d57" name="Default Changelist" comment="">
4
     <list default="true" id="b71a0d05-772d-4338-8f47-61b6a36d5d57" name="Default Changelist" comment="">
5
-      <change afterPath="$PROJECT_DIR$/src/main/java/Console.java" afterDir="false" />
6
-      <change beforePath="$PROJECT_DIR$/.idea/workspace.xml" beforeDir="false" afterPath="$PROJECT_DIR$/.idea/workspace.xml" afterDir="false" />
5
+      <change beforePath="$PROJECT_DIR$/src/main/java/AccountApp.java" beforeDir="false" afterPath="$PROJECT_DIR$/src/main/java/AccountApp.java" afterDir="false" />
6
+      <change beforePath="$PROJECT_DIR$/src/main/java/AccountServ.java" beforeDir="false" afterPath="$PROJECT_DIR$/src/main/java/AccountServ.java" afterDir="false" />
7
+      <change beforePath="$PROJECT_DIR$/src/main/java/Console.java" beforeDir="false" afterPath="$PROJECT_DIR$/src/main/java/Console.java" afterDir="false" />
7
     </list>
8
     </list>
8
     <ignored path="$PROJECT_DIR$/target/" />
9
     <ignored path="$PROJECT_DIR$/target/" />
9
     <option name="EXCLUDED_CONVERTED_TO_IGNORED" value="true" />
10
     <option name="EXCLUDED_CONVERTED_TO_IGNORED" value="true" />
44
       </usages-collector>
45
       </usages-collector>
45
       <usages-collector id="statistics.file.extensions.edit">
46
       <usages-collector id="statistics.file.extensions.edit">
46
         <counts>
47
         <counts>
47
-          <entry key="java" value="817" />
48
+          <entry key="java" value="1425" />
48
         </counts>
49
         </counts>
49
       </usages-collector>
50
       </usages-collector>
50
       <usages-collector id="statistics.file.types.edit">
51
       <usages-collector id="statistics.file.types.edit">
51
         <counts>
52
         <counts>
52
-          <entry key="JAVA" value="817" />
53
+          <entry key="JAVA" value="1425" />
53
         </counts>
54
         </counts>
54
       </usages-collector>
55
       </usages-collector>
55
     </session>
56
     </session>
59
       <file pinned="false" current-in-tab="false">
60
       <file pinned="false" current-in-tab="false">
60
         <entry file="file://$PROJECT_DIR$/src/main/java/Account.java">
61
         <entry file="file://$PROJECT_DIR$/src/main/java/Account.java">
61
           <provider selected="true" editor-type-id="text-editor">
62
           <provider selected="true" editor-type-id="text-editor">
62
-            <state relative-caret-position="-112">
63
+            <state relative-caret-position="55">
63
               <caret line="5" column="13" selection-start-line="5" selection-start-column="13" selection-end-line="5" selection-end-column="13" />
64
               <caret line="5" column="13" selection-start-line="5" selection-start-column="13" selection-end-line="5" selection-end-column="13" />
64
             </state>
65
             </state>
65
           </provider>
66
           </provider>
68
       <file pinned="false" current-in-tab="false">
69
       <file pinned="false" current-in-tab="false">
69
         <entry file="file://$PROJECT_DIR$/src/test/java/MockDao.java">
70
         <entry file="file://$PROJECT_DIR$/src/test/java/MockDao.java">
70
           <provider selected="true" editor-type-id="text-editor">
71
           <provider selected="true" editor-type-id="text-editor">
71
-            <state relative-caret-position="319">
72
-              <caret line="28" column="19" lean-forward="true" selection-start-line="28" selection-start-column="19" selection-end-line="28" selection-end-column="19" />
72
+            <state relative-caret-position="-1666">
73
+              <caret line="37" column="12" selection-start-line="37" selection-start-column="10" selection-end-line="37" selection-end-column="12" />
73
               <folding>
74
               <folding>
74
                 <element signature="imports" expanded="true" />
75
                 <element signature="imports" expanded="true" />
75
                 <element signature="e#1718#1719#0" expanded="true" />
76
                 <element signature="e#1718#1719#0" expanded="true" />
92
           </provider>
93
           </provider>
93
         </entry>
94
         </entry>
94
       </file>
95
       </file>
95
-      <file pinned="false" current-in-tab="false">
96
+      <file pinned="false" current-in-tab="true">
96
         <entry file="file://$PROJECT_DIR$/src/main/java/AccountApp.java">
97
         <entry file="file://$PROJECT_DIR$/src/main/java/AccountApp.java">
97
           <provider selected="true" editor-type-id="text-editor">
98
           <provider selected="true" editor-type-id="text-editor">
98
-            <state relative-caret-position="368">
99
-              <caret line="50" column="23" selection-start-line="50" selection-start-column="23" selection-end-line="50" selection-end-column="23" />
99
+            <state relative-caret-position="188">
100
+              <caret line="45" column="24" lean-forward="true" selection-start-line="45" selection-start-column="24" selection-end-line="45" selection-end-column="24" />
100
               <folding>
101
               <folding>
101
                 <element signature="imports" expanded="true" />
102
                 <element signature="imports" expanded="true" />
102
               </folding>
103
               </folding>
107
       <file pinned="false" current-in-tab="false">
108
       <file pinned="false" current-in-tab="false">
108
         <entry file="file://$PROJECT_DIR$/src/main/java/AccountServ.java">
109
         <entry file="file://$PROJECT_DIR$/src/main/java/AccountServ.java">
109
           <provider selected="true" editor-type-id="text-editor">
110
           <provider selected="true" editor-type-id="text-editor">
110
-            <state relative-caret-position="375">
111
-              <caret line="25" column="35" selection-start-line="25" selection-start-column="35" selection-end-line="25" selection-end-column="35" />
111
+            <state relative-caret-position="450">
112
+              <caret line="30" lean-forward="true" selection-start-line="30" selection-end-line="30" />
112
               <folding>
113
               <folding>
113
                 <element signature="imports" expanded="true" />
114
                 <element signature="imports" expanded="true" />
114
                 <element signature="e#175#176#0" expanded="true" />
115
                 <element signature="e#175#176#0" expanded="true" />
118
           </provider>
119
           </provider>
119
         </entry>
120
         </entry>
120
       </file>
121
       </file>
121
-      <file pinned="false" current-in-tab="true">
122
+      <file pinned="false" current-in-tab="false">
122
         <entry file="file://$PROJECT_DIR$/src/main/java/Console.java">
123
         <entry file="file://$PROJECT_DIR$/src/main/java/Console.java">
123
           <provider selected="true" editor-type-id="text-editor">
124
           <provider selected="true" editor-type-id="text-editor">
124
-            <state relative-caret-position="330">
125
-              <caret line="22" lean-forward="true" selection-start-line="22" selection-end-line="22" />
125
+            <state relative-caret-position="435">
126
+              <caret line="29" column="30" selection-start-line="29" selection-start-column="30" selection-end-line="29" selection-end-column="30" />
126
               <folding>
127
               <folding>
127
                 <element signature="e#135#136#0" expanded="true" />
128
                 <element signature="e#135#136#0" expanded="true" />
128
                 <element signature="e#169#170#0" expanded="true" />
129
                 <element signature="e#169#170#0" expanded="true" />
137
           </provider>
138
           </provider>
138
         </entry>
139
         </entry>
139
       </file>
140
       </file>
140
-      <file pinned="false" current-in-tab="false">
141
-        <entry file="file://$PROJECT_DIR$/SimpleAccount.iml">
142
-          <provider selected="true" editor-type-id="text-editor">
143
-            <state relative-caret-position="270">
144
-              <caret line="20" column="9" selection-start-line="20" selection-start-column="9" selection-end-line="20" selection-end-column="9" />
145
-            </state>
146
-          </provider>
147
-        </entry>
148
-      </file>
149
     </leaf>
141
     </leaf>
150
   </component>
142
   </component>
151
   <component name="FileTemplateManagerImpl">
143
   <component name="FileTemplateManagerImpl">
164
       <find>dele</find>
156
       <find>dele</find>
165
       <find>UPDATE</find>
157
       <find>UPDATE</find>
166
       <find>upda</find>
158
       <find>upda</find>
159
+      <find>id</find>
167
     </findStrings>
160
     </findStrings>
168
   </component>
161
   </component>
169
   <component name="Git.Settings">
162
   <component name="Git.Settings">
173
     <option name="CHANGED_PATHS">
166
     <option name="CHANGED_PATHS">
174
       <list>
167
       <list>
175
         <option value="$PROJECT_DIR$/src/test/java/AccountServTest.java" />
168
         <option value="$PROJECT_DIR$/src/test/java/AccountServTest.java" />
176
-        <option value="$PROJECT_DIR$/src/main/java/AccountApp.java" />
177
         <option value="$PROJECT_DIR$/src/test/java/MockDao.java" />
169
         <option value="$PROJECT_DIR$/src/test/java/MockDao.java" />
178
         <option value="$PROJECT_DIR$/src/main/java/AccountServ.java" />
170
         <option value="$PROJECT_DIR$/src/main/java/AccountServ.java" />
179
         <option value="$PROJECT_DIR$/src/main/java/Console.java" />
171
         <option value="$PROJECT_DIR$/src/main/java/Console.java" />
172
+        <option value="$PROJECT_DIR$/src/main/java/AccountApp.java" />
180
       </list>
173
       </list>
181
     </option>
174
     </option>
182
   </component>
175
   </component>
246
   <component name="PropertiesComponent">
239
   <component name="PropertiesComponent">
247
     <property name="WebServerToolWindowFactoryState" value="false" />
240
     <property name="WebServerToolWindowFactoryState" value="false" />
248
     <property name="aspect.path.notification.shown" value="true" />
241
     <property name="aspect.path.notification.shown" value="true" />
249
-    <property name="com.android.tools.idea.instantapp.provision.ProvisionBeforeRunTaskProvider.myTimeStamp" value="1542484750730" />
242
+    <property name="com.android.tools.idea.instantapp.provision.ProvisionBeforeRunTaskProvider.myTimeStamp" value="1542565159357" />
250
     <property name="last_opened_file_path" value="$PROJECT_DIR$" />
243
     <property name="last_opened_file_path" value="$PROJECT_DIR$" />
251
     <property name="nodejs_interpreter_path.stuck_in_default_project" value="undefined stuck path" />
244
     <property name="nodejs_interpreter_path.stuck_in_default_project" value="undefined stuck path" />
252
     <property name="nodejs_npm_path_reset_for_default_project" value="true" />
245
     <property name="nodejs_npm_path_reset_for_default_project" value="true" />
294
       <workItem from="1542239571129" duration="6414000" />
287
       <workItem from="1542239571129" duration="6414000" />
295
       <workItem from="1542402275147" duration="2006000" />
288
       <workItem from="1542402275147" duration="2006000" />
296
       <workItem from="1542420139392" duration="4000" />
289
       <workItem from="1542420139392" duration="4000" />
297
-      <workItem from="1542475891339" duration="3289000" />
290
+      <workItem from="1542475891339" duration="6221000" />
298
     </task>
291
     </task>
299
     <servers />
292
     <servers />
300
   </component>
293
   </component>
301
   <component name="TimeTrackingManager">
294
   <component name="TimeTrackingManager">
302
-    <option name="totallyTimeSpent" value="11713000" />
295
+    <option name="totallyTimeSpent" value="14645000" />
303
   </component>
296
   </component>
304
   <component name="ToolWindowManager">
297
   <component name="ToolWindowManager">
305
     <frame x="0" y="23" width="1440" height="807" extended-state="0" />
298
     <frame x="0" y="23" width="1440" height="807" extended-state="0" />
360
         </state>
353
         </state>
361
       </provider>
354
       </provider>
362
     </entry>
355
     </entry>
363
-    <entry file="file://$PROJECT_DIR$/src/main/java/Account.java">
364
-      <provider selected="true" editor-type-id="text-editor">
365
-        <state relative-caret-position="-112">
366
-          <caret line="5" column="13" selection-start-line="5" selection-start-column="13" selection-end-line="5" selection-end-column="13" />
367
-        </state>
368
-      </provider>
369
-    </entry>
370
     <entry file="jar://$MAVEN_REPOSITORY$/com/j256/ormlite/ormlite-core/4.48/ormlite-core-4.48.jar!/com/j256/ormlite/stmt/PreparedUpdate.class">
356
     <entry file="jar://$MAVEN_REPOSITORY$/com/j256/ormlite/ormlite-core/4.48/ormlite-core-4.48.jar!/com/j256/ormlite/stmt/PreparedUpdate.class">
371
       <provider selected="true" editor-type-id="text-editor">
357
       <provider selected="true" editor-type-id="text-editor">
372
         <state relative-caret-position="60">
358
         <state relative-caret-position="60">
381
         </state>
367
         </state>
382
       </provider>
368
       </provider>
383
     </entry>
369
     </entry>
384
-    <entry file="file://$PROJECT_DIR$/src/main/java/AccountApp.java">
370
+    <entry file="file://$PROJECT_DIR$/src/main/java/Account.java">
385
       <provider selected="true" editor-type-id="text-editor">
371
       <provider selected="true" editor-type-id="text-editor">
386
-        <state relative-caret-position="368">
387
-          <caret line="50" column="23" selection-start-line="50" selection-start-column="23" selection-end-line="50" selection-end-column="23" />
388
-          <folding>
389
-            <element signature="imports" expanded="true" />
390
-          </folding>
372
+        <state relative-caret-position="55">
373
+          <caret line="5" column="13" selection-start-line="5" selection-start-column="13" selection-end-line="5" selection-end-column="13" />
374
+        </state>
375
+      </provider>
376
+    </entry>
377
+    <entry file="file://$PROJECT_DIR$/src/test/java/AccountServTest.java">
378
+      <provider selected="true" editor-type-id="text-editor">
379
+        <state relative-caret-position="480">
380
+          <caret line="35" selection-start-line="35" selection-end-line="35" />
391
         </state>
381
         </state>
392
       </provider>
382
       </provider>
393
     </entry>
383
     </entry>
394
     <entry file="file://$PROJECT_DIR$/src/test/java/MockDao.java">
384
     <entry file="file://$PROJECT_DIR$/src/test/java/MockDao.java">
395
       <provider selected="true" editor-type-id="text-editor">
385
       <provider selected="true" editor-type-id="text-editor">
396
-        <state relative-caret-position="319">
397
-          <caret line="28" column="19" lean-forward="true" selection-start-line="28" selection-start-column="19" selection-end-line="28" selection-end-column="19" />
386
+        <state relative-caret-position="-1666">
387
+          <caret line="37" column="12" selection-start-line="37" selection-start-column="10" selection-end-line="37" selection-end-column="12" />
398
           <folding>
388
           <folding>
399
             <element signature="imports" expanded="true" />
389
             <element signature="imports" expanded="true" />
400
             <element signature="e#1718#1719#0" expanded="true" />
390
             <element signature="e#1718#1719#0" expanded="true" />
407
         </state>
397
         </state>
408
       </provider>
398
       </provider>
409
     </entry>
399
     </entry>
410
-    <entry file="file://$PROJECT_DIR$/src/test/java/AccountServTest.java">
411
-      <provider selected="true" editor-type-id="text-editor">
412
-        <state relative-caret-position="480">
413
-          <caret line="35" selection-start-line="35" selection-end-line="35" />
414
-        </state>
415
-      </provider>
416
-    </entry>
417
     <entry file="file://$PROJECT_DIR$/src/main/java/AccountServ.java">
400
     <entry file="file://$PROJECT_DIR$/src/main/java/AccountServ.java">
418
       <provider selected="true" editor-type-id="text-editor">
401
       <provider selected="true" editor-type-id="text-editor">
419
-        <state relative-caret-position="375">
420
-          <caret line="25" column="35" selection-start-line="25" selection-start-column="35" selection-end-line="25" selection-end-column="35" />
402
+        <state relative-caret-position="450">
403
+          <caret line="30" lean-forward="true" selection-start-line="30" selection-end-line="30" />
421
           <folding>
404
           <folding>
422
             <element signature="imports" expanded="true" />
405
             <element signature="imports" expanded="true" />
423
             <element signature="e#175#176#0" expanded="true" />
406
             <element signature="e#175#176#0" expanded="true" />
428
     </entry>
411
     </entry>
429
     <entry file="file://$PROJECT_DIR$/src/main/java/Console.java">
412
     <entry file="file://$PROJECT_DIR$/src/main/java/Console.java">
430
       <provider selected="true" editor-type-id="text-editor">
413
       <provider selected="true" editor-type-id="text-editor">
431
-        <state relative-caret-position="330">
432
-          <caret line="22" lean-forward="true" selection-start-line="22" selection-end-line="22" />
414
+        <state relative-caret-position="435">
415
+          <caret line="29" column="30" selection-start-line="29" selection-start-column="30" selection-end-line="29" selection-end-column="30" />
433
           <folding>
416
           <folding>
434
             <element signature="e#135#136#0" expanded="true" />
417
             <element signature="e#135#136#0" expanded="true" />
435
             <element signature="e#169#170#0" expanded="true" />
418
             <element signature="e#169#170#0" expanded="true" />
443
         </state>
426
         </state>
444
       </provider>
427
       </provider>
445
     </entry>
428
     </entry>
429
+    <entry file="file://$PROJECT_DIR$/src/main/java/AccountApp.java">
430
+      <provider selected="true" editor-type-id="text-editor">
431
+        <state relative-caret-position="188">
432
+          <caret line="45" column="24" lean-forward="true" selection-start-line="45" selection-start-column="24" selection-end-line="45" selection-end-column="24" />
433
+          <folding>
434
+            <element signature="imports" expanded="true" />
435
+          </folding>
436
+        </state>
437
+      </provider>
438
+    </entry>
446
   </component>
439
   </component>
447
   <component name="masterDetails">
440
   <component name="masterDetails">
448
     <states>
441
     <states>

+ 19
- 14
src/main/java/AccountApp.java Wyświetl plik

5
 
5
 
6
     public class AccountApp {
6
     public class AccountApp {
7
 
7
 
8
+
8
         // we are using a MySQl database
9
         // we are using a MySQl database
9
         private final static String DATABASE_URL = "jdbc:mysql://localhost:3306/orm_lab?useUnicode=true";
10
         private final static String DATABASE_URL = "jdbc:mysql://localhost:3306/orm_lab?useUnicode=true";
10
         private final static String YOURUSERNAME = "root";
11
         private final static String YOURUSERNAME = "root";
11
         private final static String YOURPASSWORD = "";
12
         private final static String YOURPASSWORD = "";
13
+        private Console console = new Console();
12
 
14
 
13
         private Dao<Account, Integer> accountDao;
15
         private Dao<Account, Integer> accountDao;
14
 
16
 
37
          * Read and write some example data.
39
          * Read and write some example data.
38
          */
40
          */
39
         private void processData() throws Exception {
41
         private void processData() throws Exception {
40
-            // create an instance of Account
41
-            String name = "Jim Coakley";
42
-            Account account = new Account(name);
43
-
44
-            // persist the account object to the database
45
-            accountDao.create(account);
46
-            int id = account.getId();
47
-            System.out.println(id);
48
-            // assign a password
49
-            account.setPassword("_secret");
50
-            // update the database after changing the object
51
-            accountDao.update(account);
52
-            // delete the account
53
-            //accountDao.deleteById(id);
42
+           boolean end = false;
43
+            console.print("Welcome to your account manager");
44
+                while(!end){
45
+                   int input = console.prntTakeInt("Please enter your selection: ");
46
+                    if (input == 1) {
47
+
48
+                    } else if(input == 2) {
49
+
50
+                    } else if(input == 3) {
51
+
52
+                    } else if(input == 4) {
53
+
54
+                    } else {
55
+                        end = true;
56
+                    }
57
+                }
58
+
54
         }
59
         }
55
 
60
 
56
         /**
61
         /**

+ 9
- 2
src/main/java/AccountServ.java Wyświetl plik

18
         return dao.queryForId(id);
18
         return dao.queryForId(id);
19
     }
19
     }
20
 
20
 
21
-    public int update(Account account) throws SQLException {
22
-        return dao.update(account);
21
+
22
+    public void setPassword(Account account, String password) throws SQLException {
23
+        account.setPassword(password);
24
+        dao.update(account);
25
+    }
26
+
27
+    public void setName(Account account, String name) throws SQLException {
28
+        account.setName(name);
29
+        dao.update(account);
23
     }
30
     }
24
 
31
 
25
     public int delete(Account account) throws SQLException {
32
     public int delete(Account account) throws SQLException {

+ 8
- 0
src/main/java/Console.java Wyświetl plik

20
     return scanner.nextInt();
20
     return scanner.nextInt();
21
 }
21
 }
22
 
22
 
23
+public int prntTakeInt(String output) {
24
+    System.out.println(output);
25
+    return scanner.nextInt();
26
+}
23
 
27
 
28
+public String prntTakeStr(String output) {
29
+    System.out.println(output);
30
+    return scanner.nextLine();
31
+}
24
 }
32
 }