Добавление логов

This commit is contained in:
WarL0ck 2017-12-06 12:44:27 +07:00
parent 2550181534
commit a3d4640b43
3 changed files with 56 additions and 35 deletions

68
.idea/workspace.xml generated
View File

@ -2,10 +2,9 @@
<project version="4">
<component name="ChangeListManager">
<list default="true" id="6452b13b-5b16-420c-9e2d-0c40791a2ae8" name="Default" comment="">
<change type="DELETED" beforePath="$PROJECT_DIR$/restServer.rest" afterPath="" />
<change type="MODIFICATION" beforePath="$PROJECT_DIR$/.idea/workspace.xml" afterPath="$PROJECT_DIR$/.idea/workspace.xml" />
<change type="MODIFICATION" beforePath="$PROJECT_DIR$/src/main/java/ru/cft/task/restServer/EmailBook.java" afterPath="$PROJECT_DIR$/src/main/java/ru/cft/task/restServer/EmailBook.java" />
<change type="MODIFICATION" beforePath="$PROJECT_DIR$/src/main/java/ru/cft/task/restServer/EmailBookController.java" afterPath="$PROJECT_DIR$/src/main/java/ru/cft/task/restServer/EmailBookController.java" />
<change type="MODIFICATION" beforePath="$PROJECT_DIR$/src/main/resources/banner.txt" afterPath="$PROJECT_DIR$/src/main/resources/banner.txt" />
</list>
<ignored path="$PROJECT_DIR$/out/" />
<ignored path="$PROJECT_DIR$/target/" />
@ -86,7 +85,7 @@
<file leaf-file-name="Main.java" pinned="false" current-in-tab="false">
<entry file="file://$PROJECT_DIR$/src/main/java/ru/cft/task/restServer/Main.java">
<provider selected="true" editor-type-id="text-editor">
<state relative-caret-position="0">
<state relative-caret-position="153">
<caret line="12" column="0" lean-forward="false" selection-start-line="12" selection-start-column="0" selection-end-line="12" selection-end-column="0" />
<folding>
<element signature="imports" expanded="true" />
@ -100,8 +99,8 @@
<file leaf-file-name="EmailBook.java" pinned="false" current-in-tab="false">
<entry file="file://$PROJECT_DIR$/src/main/java/ru/cft/task/restServer/EmailBook.java">
<provider selected="true" editor-type-id="text-editor">
<state relative-caret-position="281">
<caret line="30" column="9" lean-forward="true" selection-start-line="30" selection-start-column="9" selection-end-line="30" selection-end-column="9" />
<state relative-caret-position="425">
<caret line="30" column="9" lean-forward="false" selection-start-line="30" selection-start-column="9" selection-end-line="30" selection-end-column="9" />
<folding>
<element signature="imports" expanded="true" />
</folding>
@ -112,8 +111,8 @@
<file leaf-file-name="EmailRecord.java" pinned="false" current-in-tab="false">
<entry file="file://$PROJECT_DIR$/src/main/java/ru/cft/task/restServer/EmailRecord.java">
<provider selected="true" editor-type-id="text-editor">
<state relative-caret-position="493">
<caret line="29" column="30" lean-forward="true" selection-start-line="29" selection-start-column="30" selection-end-line="29" selection-end-column="30" />
<state relative-caret-position="357">
<caret line="29" column="30" lean-forward="false" selection-start-line="29" selection-start-column="30" selection-end-line="29" selection-end-column="30" />
<folding>
<element signature="e#301#302#0" expanded="true" />
<element signature="e#326#327#0" expanded="true" />
@ -146,8 +145,8 @@
<file leaf-file-name="EmailBookController.java" pinned="false" current-in-tab="true">
<entry file="file://$PROJECT_DIR$/src/main/java/ru/cft/task/restServer/EmailBookController.java">
<provider selected="true" editor-type-id="text-editor">
<state relative-caret-position="218">
<caret line="40" column="113" lean-forward="true" selection-start-line="40" selection-start-column="113" selection-end-line="40" selection-end-column="113" />
<state relative-caret-position="303">
<caret line="19" column="79" lean-forward="false" selection-start-line="19" selection-start-column="79" selection-end-line="19" selection-end-column="79" />
<folding>
<element signature="imports" expanded="true" />
</folding>
@ -185,9 +184,9 @@
<option value="$PROJECT_DIR$/src/main/java/ru/cft/task/restServer/ErrorResponse.java" />
<option value="$PROJECT_DIR$/src/main/resources/application.properties" />
<option value="$PROJECT_DIR$/src/main/java/ru/cft/task/restServer/EmailRecord.java" />
<option value="$PROJECT_DIR$/src/main/java/ru/cft/task/restServer/EmailBookController.java" />
<option value="$PROJECT_DIR$/src/main/resources/banner.txt" />
<option value="$PROJECT_DIR$/src/main/java/ru/cft/task/restServer/EmailBook.java" />
<option value="$PROJECT_DIR$/src/main/java/ru/cft/task/restServer/EmailBookController.java" />
</list>
</option>
</component>
@ -265,8 +264,8 @@
</navigator>
<panes>
<pane id="Scratches" />
<pane id="PackagesPane" />
<pane id="AndroidView" />
<pane id="PackagesPane" />
<pane id="Scope" />
<pane id="ProjectPane">
<subPane>
@ -488,7 +487,14 @@
<option name="project" value="LOCAL" />
<updated>1512205461339</updated>
</task>
<option name="localTasksCounter" value="8" />
<task id="LOCAL-00008" summary="Добавление метода patch">
<created>1512279824947</created>
<option name="number" value="00008" />
<option name="presentableId" value="LOCAL-00008" />
<option name="project" value="LOCAL" />
<updated>1512279824947</updated>
</task>
<option name="localTasksCounter" value="9" />
<servers />
</component>
<component name="TodoView">
@ -505,31 +511,31 @@
<layout>
<window_info id="Palette" active="false" anchor="right" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="false" show_stripe_button="true" weight="0.33" sideWeight="0.5" order="3" side_tool="false" content_ui="tabs" />
<window_info id="TODO" active="false" anchor="bottom" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="false" show_stripe_button="true" weight="0.32915717" sideWeight="0.5" order="6" side_tool="false" content_ui="tabs" />
<window_info id="Messages" active="false" anchor="bottom" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="false" show_stripe_button="true" weight="0.32941177" sideWeight="0.4936034" order="7" side_tool="false" content_ui="tabs" />
<window_info id="Palette&#9;" active="false" anchor="right" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="false" show_stripe_button="true" weight="0.33" sideWeight="0.5" order="3" side_tool="false" content_ui="tabs" />
<window_info id="Image Layers" active="false" anchor="left" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="false" show_stripe_button="true" weight="0.33" sideWeight="0.5" order="2" side_tool="false" content_ui="tabs" />
<window_info id="Capture Analysis" active="false" anchor="right" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="false" show_stripe_button="true" weight="0.33" sideWeight="0.5" order="4" side_tool="false" content_ui="tabs" />
<window_info id="Event Log" active="false" anchor="bottom" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="false" show_stripe_button="true" weight="0.25416204" sideWeight="0.51171875" order="7" side_tool="true" content_ui="tabs" />
<window_info id="Maven Projects" active="false" anchor="right" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="false" show_stripe_button="true" weight="0.32928804" sideWeight="0.5" order="3" side_tool="false" content_ui="tabs" />
<window_info id="Run" active="false" anchor="bottom" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="false" show_stripe_button="true" weight="0.26082003" sideWeight="0.48828125" order="2" side_tool="false" content_ui="tabs" />
<window_info id="Version Control" active="true" anchor="bottom" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="true" show_stripe_button="true" weight="0.2357631" sideWeight="0.4890625" order="7" side_tool="false" content_ui="tabs" />
<window_info id="Run" active="false" anchor="bottom" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="false" show_stripe_button="true" weight="0.2596811" sideWeight="0.48828125" order="2" side_tool="false" content_ui="tabs" />
<window_info id="Terminal" active="false" anchor="bottom" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="false" show_stripe_button="true" weight="0.32941177" sideWeight="0.4978678" order="7" side_tool="false" content_ui="tabs" />
<window_info id="Capture Tool" active="false" anchor="left" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="false" show_stripe_button="true" weight="0.33" sideWeight="0.5" order="2" side_tool="false" content_ui="tabs" />
<window_info id="Designer" active="false" anchor="left" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="false" show_stripe_button="true" weight="0.33" sideWeight="0.5" order="2" side_tool="false" content_ui="tabs" />
<window_info id="Project" active="false" anchor="left" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="true" show_stripe_button="true" weight="0.18770227" sideWeight="0.49441788" order="0" side_tool="false" content_ui="combo" />
<window_info id="Find" active="false" anchor="bottom" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="false" show_stripe_button="true" weight="0.33" sideWeight="0.5" order="1" side_tool="false" content_ui="tabs" />
<window_info id="Project" active="false" anchor="left" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="true" show_stripe_button="true" weight="0.19417475" sideWeight="0.49441788" order="0" side_tool="false" content_ui="combo" />
<window_info id="Structure" active="false" anchor="left" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="false" show_stripe_button="true" weight="0.25" sideWeight="0.5" order="1" side_tool="false" content_ui="tabs" />
<window_info id="Ant Build" active="false" anchor="right" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="false" show_stripe_button="true" weight="0.25" sideWeight="0.5" order="1" side_tool="false" content_ui="tabs" />
<window_info id="UI Designer" active="false" anchor="left" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="false" show_stripe_button="true" weight="0.33" sideWeight="0.5" order="2" side_tool="false" content_ui="tabs" />
<window_info id="Theme Preview" active="false" anchor="right" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="false" show_stripe_button="true" weight="0.33" sideWeight="0.5" order="4" side_tool="false" content_ui="tabs" />
<window_info id="Debug" active="false" anchor="bottom" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="false" show_stripe_button="true" weight="0.4" sideWeight="0.5" order="3" side_tool="false" content_ui="tabs" />
<window_info id="Favorites" active="false" anchor="left" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="false" show_stripe_button="true" weight="0.18176973" sideWeight="0.50558215" order="2" side_tool="true" content_ui="tabs" />
<window_info id="Debug" active="false" anchor="bottom" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="false" show_stripe_button="true" weight="0.4" sideWeight="0.5" order="3" side_tool="false" content_ui="tabs" />
<window_info id="Cvs" active="false" anchor="bottom" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="false" show_stripe_button="true" weight="0.25" sideWeight="0.5" order="4" side_tool="false" content_ui="tabs" />
<window_info id="Message" active="false" anchor="bottom" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="false" show_stripe_button="true" weight="0.33" sideWeight="0.5" order="0" side_tool="false" content_ui="tabs" />
<window_info id="Commander" active="false" anchor="right" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="false" show_stripe_button="true" weight="0.4" sideWeight="0.5" order="0" side_tool="false" content_ui="tabs" />
<window_info id="Hierarchy" active="false" anchor="right" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="false" show_stripe_button="true" weight="0.25" sideWeight="0.5" order="2" side_tool="false" content_ui="combo" />
<window_info id="Messages" active="false" anchor="bottom" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="false" show_stripe_button="true" weight="0.32941177" sideWeight="0.4936034" order="7" side_tool="false" content_ui="tabs" />
<window_info id="Inspection" active="false" anchor="bottom" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="false" show_stripe_button="true" weight="0.4" sideWeight="0.5" order="5" side_tool="false" content_ui="tabs" />
<window_info id="REST Client" active="false" anchor="bottom" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="false" show_stripe_button="false" weight="0.32941177" sideWeight="0.4978678" order="8" side_tool="false" content_ui="tabs" />
<window_info id="Find" active="false" anchor="bottom" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="false" show_stripe_button="true" weight="0.33" sideWeight="0.5" order="1" side_tool="false" content_ui="tabs" />
</layout>
</component>
<component name="Vcs.Log.Tabs.Properties">
@ -581,7 +587,8 @@
<MESSAGE value="Реализация книги" />
<MESSAGE value="Промежуточный коммит" />
<MESSAGE value="Реализация exception" />
<option name="LAST_COMMIT_MESSAGE" value="Реализация exception" />
<MESSAGE value="Добавление метода patch" />
<option name="LAST_COMMIT_MESSAGE" value="Добавление метода patch" />
</component>
<component name="XDebuggerManager">
<breakpoint-manager>
@ -1001,6 +1008,16 @@
<provider selected="true" editor-type-id="text-editor">
<state relative-caret-position="357">
<caret line="21" column="0" lean-forward="false" selection-start-line="21" selection-start-column="0" selection-end-line="21" selection-end-column="0" />
<folding>
<element signature="e#148#149#0" expanded="false" />
<element signature="e#180#181#0" expanded="false" />
<element signature="e#227#228#0" expanded="false" />
<element signature="e#269#270#0" expanded="false" />
<element signature="e#303#304#0" expanded="false" />
<element signature="e#333#334#0" expanded="false" />
<element signature="e#379#380#0" expanded="false" />
<element signature="e#417#418#0" expanded="false" />
</folding>
</state>
</provider>
</entry>
@ -1014,7 +1031,7 @@
</entry>
<entry file="file://$PROJECT_DIR$/src/main/java/ru/cft/task/restServer/Main.java">
<provider selected="true" editor-type-id="text-editor">
<state relative-caret-position="0">
<state relative-caret-position="153">
<caret line="12" column="0" lean-forward="false" selection-start-line="12" selection-start-column="0" selection-end-line="12" selection-end-column="0" />
<folding>
<element signature="imports" expanded="true" />
@ -1035,7 +1052,6 @@
<provider selected="true" editor-type-id="text-editor">
<state relative-caret-position="85">
<caret line="5" column="33" lean-forward="true" selection-start-line="5" selection-start-column="33" selection-end-line="5" selection-end-column="33" />
<folding />
</state>
</provider>
</entry>
@ -1049,8 +1065,8 @@
</entry>
<entry file="file://$PROJECT_DIR$/src/main/java/ru/cft/task/restServer/EmailBook.java">
<provider selected="true" editor-type-id="text-editor">
<state relative-caret-position="281">
<caret line="30" column="9" lean-forward="true" selection-start-line="30" selection-start-column="9" selection-end-line="30" selection-end-column="9" />
<state relative-caret-position="425">
<caret line="30" column="9" lean-forward="false" selection-start-line="30" selection-start-column="9" selection-end-line="30" selection-end-column="9" />
<folding>
<element signature="imports" expanded="true" />
</folding>
@ -1059,8 +1075,8 @@
</entry>
<entry file="file://$PROJECT_DIR$/src/main/java/ru/cft/task/restServer/EmailRecord.java">
<provider selected="true" editor-type-id="text-editor">
<state relative-caret-position="493">
<caret line="29" column="30" lean-forward="true" selection-start-line="29" selection-start-column="30" selection-end-line="29" selection-end-column="30" />
<state relative-caret-position="357">
<caret line="29" column="30" lean-forward="false" selection-start-line="29" selection-start-column="30" selection-end-line="29" selection-end-column="30" />
<folding>
<element signature="e#301#302#0" expanded="true" />
<element signature="e#326#327#0" expanded="true" />
@ -1081,8 +1097,8 @@
</entry>
<entry file="file://$PROJECT_DIR$/src/main/java/ru/cft/task/restServer/EmailBookController.java">
<provider selected="true" editor-type-id="text-editor">
<state relative-caret-position="218">
<caret line="40" column="113" lean-forward="true" selection-start-line="40" selection-start-column="113" selection-end-line="40" selection-end-column="113" />
<state relative-caret-position="303">
<caret line="19" column="79" lean-forward="false" selection-start-line="19" selection-start-column="79" selection-end-line="19" selection-end-column="79" />
<folding>
<element signature="imports" expanded="true" />
</folding>

View File

View File

@ -17,16 +17,18 @@ public class EmailBookController {
private EmailBook emailBook;
@RequestMapping(method = RequestMethod.POST)
public ResponseEntity<EmailRecord> addEmailRec(@RequestParam(value = "name", defaultValue = "John Unknown") String name,
@RequestParam(value = "email", defaultValue = "john@unknown.ru") String email) throws EmailException {
public ResponseEntity<EmailRecord> addEmailRec(@RequestParam(value = "name") String name,
@RequestParam(value = "email") String email) throws EmailException {
System.out.println("Method POST: {name =" + name + ", email = " + email + "}");
return new ResponseEntity<EmailRecord>(emailBook.addEmailRecord(new_id.incrementAndGet(), name, email), HttpStatus.OK);
}
@RequestMapping(method = RequestMethod.GET)
public ResponseEntity<EmailRecord> findEmailRec(@RequestParam(value = "id", defaultValue = "") String id,
@RequestParam(value = "name", defaultValue = "") String name,
@RequestParam(value = "email", defaultValue = "") String email
public ResponseEntity<EmailRecord> findEmailRec(@RequestParam(value = "id") String id,
@RequestParam(value = "name") String name,
@RequestParam(value = "email") String email
) throws EmailException {
System.out.println("Method GET: {id = " + id + ", name =" + name + ", email = " + email + "}");
if (!name.isEmpty()) {
return new ResponseEntity<EmailRecord>(emailBook.findRecordByName(name), HttpStatus.OK);
} else if (!email.isEmpty()) {
@ -37,15 +39,17 @@ public class EmailBookController {
}
@RequestMapping(method = RequestMethod.PATCH)
public ResponseEntity<EmailRecord> editEmailRec(@RequestParam(value = "id", required = true) long id,
@RequestParam(value = "name", defaultValue = "") String name,
@RequestParam(value = "email", defaultValue = "") String email
public ResponseEntity<EmailRecord> editEmailRec(@RequestParam(value = "id", required = true) String id,
@RequestParam(value = "name") String name,
@RequestParam(value = "email") String email
) throws EmailException {
return new ResponseEntity<EmailRecord>(emailBook.editRecord(id, name, email), HttpStatus.OK);
System.out.println("Method PATCH: {id = " + id + ", name =" + name + ", email = " + email + "}");
return new ResponseEntity<EmailRecord>(emailBook.editRecord(Long.valueOf(id), name, email), HttpStatus.OK);
}
@RequestMapping(method = RequestMethod.DELETE)
public ResponseEntity<ErrorResponse> removeEmailRec(@RequestParam(value = "id", required = true) long id) throws EmailException {
System.out.println("Method DELETE: {id = " + id + "}");
if (emailBook.removeEmailRecord(id)) {
ErrorResponse message = new ErrorResponse();
message.setErrorCode(HttpStatus.OK.value());
@ -57,6 +61,7 @@ public class EmailBookController {
@RequestMapping(value = "/count", method = RequestMethod.GET)
public int countEmailRecords() {
System.out.println("Method GET: count");
return emailBook.count();
}