Комментирование кода
This commit is contained in:
parent
951ac955ed
commit
0b414fa175
153
.idea/workspace.xml
generated
153
.idea/workspace.xml
generated
@ -3,6 +3,13 @@
|
|||||||
<component name="ChangeListManager">
|
<component name="ChangeListManager">
|
||||||
<list default="true" id="6452b13b-5b16-420c-9e2d-0c40791a2ae8" name="Default" comment="">
|
<list default="true" id="6452b13b-5b16-420c-9e2d-0c40791a2ae8" name="Default" comment="">
|
||||||
<change beforePath="$PROJECT_DIR$/.idea/workspace.xml" afterPath="$PROJECT_DIR$/.idea/workspace.xml" />
|
<change beforePath="$PROJECT_DIR$/.idea/workspace.xml" afterPath="$PROJECT_DIR$/.idea/workspace.xml" />
|
||||||
|
<change 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 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 beforePath="$PROJECT_DIR$/src/main/java/ru/cft/task/restServer/EmailException.java" afterPath="$PROJECT_DIR$/src/main/java/ru/cft/task/restServer/EmailException.java" />
|
||||||
|
<change beforePath="$PROJECT_DIR$/src/main/java/ru/cft/task/restServer/EmailRecord.java" afterPath="$PROJECT_DIR$/src/main/java/ru/cft/task/restServer/EmailRecord.java" />
|
||||||
|
<change beforePath="$PROJECT_DIR$/src/main/java/ru/cft/task/restServer/ErrorResponse.java" afterPath="$PROJECT_DIR$/src/main/java/ru/cft/task/restServer/ErrorResponse.java" />
|
||||||
|
<change beforePath="$PROJECT_DIR$/src/main/java/ru/cft/task/restServer/ExceptionControllerAdvice.java" afterPath="$PROJECT_DIR$/src/main/java/ru/cft/task/restServer/ExceptionControllerAdvice.java" />
|
||||||
|
<change beforePath="$PROJECT_DIR$/src/main/java/ru/cft/task/restServer/Main.java" afterPath="$PROJECT_DIR$/src/main/java/ru/cft/task/restServer/Main.java" />
|
||||||
</list>
|
</list>
|
||||||
<ignored path="$PROJECT_DIR$/out/" />
|
<ignored path="$PROJECT_DIR$/out/" />
|
||||||
<ignored path="$PROJECT_DIR$/target/" />
|
<ignored path="$PROJECT_DIR$/target/" />
|
||||||
@ -80,11 +87,11 @@
|
|||||||
</component>
|
</component>
|
||||||
<component name="FileEditorManager">
|
<component name="FileEditorManager">
|
||||||
<leaf SIDE_TABS_SIZE_LIMIT_KEY="300">
|
<leaf SIDE_TABS_SIZE_LIMIT_KEY="300">
|
||||||
<file leaf-file-name="EmailBookController.java" pinned="false" current-in-tab="false">
|
<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">
|
<entry file="file://$PROJECT_DIR$/src/main/java/ru/cft/task/restServer/EmailBookController.java">
|
||||||
<provider selected="true" editor-type-id="text-editor">
|
<provider selected="true" editor-type-id="text-editor">
|
||||||
<state relative-caret-position="493">
|
<state relative-caret-position="289">
|
||||||
<caret line="68" column="19" lean-forward="false" selection-start-line="68" selection-start-column="19" selection-end-line="68" selection-end-column="19" />
|
<caret line="49" column="47" lean-forward="true" selection-start-line="49" selection-start-column="47" selection-end-line="49" selection-end-column="47" />
|
||||||
<folding>
|
<folding>
|
||||||
<element signature="imports" expanded="true" />
|
<element signature="imports" expanded="true" />
|
||||||
</folding>
|
</folding>
|
||||||
@ -92,26 +99,6 @@
|
|||||||
</provider>
|
</provider>
|
||||||
</entry>
|
</entry>
|
||||||
</file>
|
</file>
|
||||||
<file leaf-file-name="ExceptionControllerAdvice.java" pinned="false" current-in-tab="true">
|
|
||||||
<entry file="file://$PROJECT_DIR$/src/main/java/ru/cft/task/restServer/ExceptionControllerAdvice.java">
|
|
||||||
<provider selected="true" editor-type-id="text-editor">
|
|
||||||
<state relative-caret-position="289">
|
|
||||||
<caret line="22" column="0" lean-forward="true" selection-start-line="22" selection-start-column="0" selection-end-line="22" selection-end-column="0" />
|
|
||||||
<folding />
|
|
||||||
</state>
|
|
||||||
</provider>
|
|
||||||
</entry>
|
|
||||||
</file>
|
|
||||||
<file leaf-file-name="application.properties" pinned="false" current-in-tab="false">
|
|
||||||
<entry file="file://$PROJECT_DIR$/src/main/resources/application.properties">
|
|
||||||
<provider selected="true" editor-type-id="text-editor">
|
|
||||||
<state relative-caret-position="34">
|
|
||||||
<caret line="2" column="23" lean-forward="false" selection-start-line="2" selection-start-column="23" selection-end-line="2" selection-end-column="23" />
|
|
||||||
<folding />
|
|
||||||
</state>
|
|
||||||
</provider>
|
|
||||||
</entry>
|
|
||||||
</file>
|
|
||||||
</leaf>
|
</leaf>
|
||||||
</component>
|
</component>
|
||||||
<component name="FileTemplateManagerImpl">
|
<component name="FileTemplateManagerImpl">
|
||||||
@ -136,16 +123,16 @@
|
|||||||
<option value="$PROJECT_DIR$/src/main/java/ru/cft/task/restServer/emailBook.java" />
|
<option value="$PROJECT_DIR$/src/main/java/ru/cft/task/restServer/emailBook.java" />
|
||||||
<option value="$PROJECT_DIR$/src/main/resources/log4j.properties" />
|
<option value="$PROJECT_DIR$/src/main/resources/log4j.properties" />
|
||||||
<option value="$PROJECT_DIR$/src/main/java/ru/cft/task/restServer/BookStatus.java" />
|
<option value="$PROJECT_DIR$/src/main/java/ru/cft/task/restServer/BookStatus.java" />
|
||||||
<option value="$PROJECT_DIR$/src/main/java/ru/cft/task/restServer/Main.java" />
|
|
||||||
<option value="$PROJECT_DIR$/src/main/java/ru/cft/task/restServer/EmailException.java" />
|
|
||||||
<option value="$PROJECT_DIR$/src/main/java/ru/cft/task/restServer/ErrorResponse.java" />
|
|
||||||
<option value="$PROJECT_DIR$/src/main/java/ru/cft/task/restServer/EmailRecord.java" />
|
|
||||||
<option value="$PROJECT_DIR$/src/main/java/ru/cft/task/restServer/EmailBook.java" />
|
|
||||||
<option value="$PROJECT_DIR$/pom.xml" />
|
<option value="$PROJECT_DIR$/pom.xml" />
|
||||||
<option value="$PROJECT_DIR$/src/main/resources/banner.txt" />
|
<option value="$PROJECT_DIR$/src/main/resources/banner.txt" />
|
||||||
<option value="$PROJECT_DIR$/src/main/resources/application.properties" />
|
<option value="$PROJECT_DIR$/src/main/resources/application.properties" />
|
||||||
<option value="$PROJECT_DIR$/src/main/java/ru/cft/task/restServer/EmailBookController.java" />
|
|
||||||
<option value="$PROJECT_DIR$/src/main/java/ru/cft/task/restServer/ExceptionControllerAdvice.java" />
|
<option value="$PROJECT_DIR$/src/main/java/ru/cft/task/restServer/ExceptionControllerAdvice.java" />
|
||||||
|
<option value="$PROJECT_DIR$/src/main/java/ru/cft/task/restServer/Main.java" />
|
||||||
|
<option value="$PROJECT_DIR$/src/main/java/ru/cft/task/restServer/ErrorResponse.java" />
|
||||||
|
<option value="$PROJECT_DIR$/src/main/java/ru/cft/task/restServer/EmailRecord.java" />
|
||||||
|
<option value="$PROJECT_DIR$/src/main/java/ru/cft/task/restServer/EmailException.java" />
|
||||||
|
<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>
|
</list>
|
||||||
</option>
|
</option>
|
||||||
</component>
|
</component>
|
||||||
@ -222,7 +209,6 @@
|
|||||||
<foldersAlwaysOnTop value="true" />
|
<foldersAlwaysOnTop value="true" />
|
||||||
</navigator>
|
</navigator>
|
||||||
<panes>
|
<panes>
|
||||||
<pane id="Scope" />
|
|
||||||
<pane id="PackagesPane" />
|
<pane id="PackagesPane" />
|
||||||
<pane id="ProjectPane">
|
<pane id="ProjectPane">
|
||||||
<subPane>
|
<subPane>
|
||||||
@ -269,6 +255,7 @@
|
|||||||
</subPane>
|
</subPane>
|
||||||
</pane>
|
</pane>
|
||||||
<pane id="Scratches" />
|
<pane id="Scratches" />
|
||||||
|
<pane id="Scope" />
|
||||||
<pane id="AndroidView" />
|
<pane id="AndroidView" />
|
||||||
</panes>
|
</panes>
|
||||||
</component>
|
</component>
|
||||||
@ -481,7 +468,14 @@
|
|||||||
<option name="project" value="LOCAL" />
|
<option name="project" value="LOCAL" />
|
||||||
<updated>1512623307696</updated>
|
<updated>1512623307696</updated>
|
||||||
</task>
|
</task>
|
||||||
<option name="localTasksCounter" value="12" />
|
<task id="LOCAL-00012" summary="Стабильный релиз">
|
||||||
|
<created>1512623415230</created>
|
||||||
|
<option name="number" value="00012" />
|
||||||
|
<option name="presentableId" value="LOCAL-00012" />
|
||||||
|
<option name="project" value="LOCAL" />
|
||||||
|
<updated>1512623415230</updated>
|
||||||
|
</task>
|
||||||
|
<option name="localTasksCounter" value="13" />
|
||||||
<servers />
|
<servers />
|
||||||
</component>
|
</component>
|
||||||
<component name="TodoView">
|
<component name="TodoView">
|
||||||
@ -506,7 +500,7 @@
|
|||||||
<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.23529412" sideWeight="0.4890625" order="7" 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.23529412" sideWeight="0.4890625" order="7" 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="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="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="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.21801706" sideWeight="0.49441788" order="0" side_tool="false" content_ui="combo" />
|
<window_info id="Project" active="false" anchor="left" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="true" show_stripe_button="true" weight="0.22228146" 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="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="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="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" />
|
||||||
@ -581,7 +575,7 @@
|
|||||||
</component>
|
</component>
|
||||||
<component name="XDebuggerManager">
|
<component name="XDebuggerManager">
|
||||||
<breakpoint-manager>
|
<breakpoint-manager>
|
||||||
<option name="time" value="2" />
|
<option name="time" value="4" />
|
||||||
</breakpoint-manager>
|
</breakpoint-manager>
|
||||||
<watches-manager />
|
<watches-manager />
|
||||||
</component>
|
</component>
|
||||||
@ -624,9 +618,7 @@
|
|||||||
<provider selected="true" editor-type-id="text-editor">
|
<provider selected="true" editor-type-id="text-editor">
|
||||||
<state relative-caret-position="289">
|
<state relative-caret-position="289">
|
||||||
<caret line="23" column="85" lean-forward="false" selection-start-line="23" selection-start-column="85" selection-end-line="23" selection-end-column="85" />
|
<caret line="23" column="85" lean-forward="false" selection-start-line="23" selection-start-column="85" selection-end-line="23" selection-end-column="85" />
|
||||||
<folding>
|
<folding />
|
||||||
<element signature="imports" expanded="false" />
|
|
||||||
</folding>
|
|
||||||
</state>
|
</state>
|
||||||
</provider>
|
</provider>
|
||||||
</entry>
|
</entry>
|
||||||
@ -666,9 +658,7 @@
|
|||||||
<provider selected="true" editor-type-id="text-editor">
|
<provider selected="true" editor-type-id="text-editor">
|
||||||
<state relative-caret-position="85">
|
<state relative-caret-position="85">
|
||||||
<caret line="6" column="50" lean-forward="false" selection-start-line="6" selection-start-column="50" selection-end-line="6" selection-end-column="50" />
|
<caret line="6" column="50" lean-forward="false" selection-start-line="6" selection-start-column="50" selection-end-line="6" selection-end-column="50" />
|
||||||
<folding>
|
<folding />
|
||||||
<element signature="imports" expanded="false" />
|
|
||||||
</folding>
|
|
||||||
</state>
|
</state>
|
||||||
</provider>
|
</provider>
|
||||||
</entry>
|
</entry>
|
||||||
@ -708,9 +698,7 @@
|
|||||||
<provider selected="true" editor-type-id="text-editor">
|
<provider selected="true" editor-type-id="text-editor">
|
||||||
<state relative-caret-position="85">
|
<state relative-caret-position="85">
|
||||||
<caret line="6" column="50" lean-forward="true" selection-start-line="6" selection-start-column="50" selection-end-line="6" selection-end-column="50" />
|
<caret line="6" column="50" lean-forward="true" selection-start-line="6" selection-start-column="50" selection-end-line="6" selection-end-column="50" />
|
||||||
<folding>
|
<folding />
|
||||||
<element signature="imports" expanded="false" />
|
|
||||||
</folding>
|
|
||||||
</state>
|
</state>
|
||||||
</provider>
|
</provider>
|
||||||
</entry>
|
</entry>
|
||||||
@ -761,9 +749,7 @@
|
|||||||
<provider selected="true" editor-type-id="text-editor">
|
<provider selected="true" editor-type-id="text-editor">
|
||||||
<state relative-caret-position="493">
|
<state relative-caret-position="493">
|
||||||
<caret line="29" column="5" lean-forward="false" selection-start-line="29" selection-start-column="5" selection-end-line="29" selection-end-column="5" />
|
<caret line="29" column="5" lean-forward="false" selection-start-line="29" selection-start-column="5" selection-end-line="29" selection-end-column="5" />
|
||||||
<folding>
|
<folding />
|
||||||
<element signature="imports" expanded="false" />
|
|
||||||
</folding>
|
|
||||||
</state>
|
</state>
|
||||||
</provider>
|
</provider>
|
||||||
</entry>
|
</entry>
|
||||||
@ -804,9 +790,7 @@
|
|||||||
<provider selected="true" editor-type-id="text-editor">
|
<provider selected="true" editor-type-id="text-editor">
|
||||||
<state relative-caret-position="459">
|
<state relative-caret-position="459">
|
||||||
<caret line="27" column="75" lean-forward="true" selection-start-line="27" selection-start-column="75" selection-end-line="27" selection-end-column="75" />
|
<caret line="27" column="75" lean-forward="true" selection-start-line="27" selection-start-column="75" selection-end-line="27" selection-end-column="75" />
|
||||||
<folding>
|
<folding />
|
||||||
<element signature="imports" expanded="false" />
|
|
||||||
</folding>
|
|
||||||
</state>
|
</state>
|
||||||
</provider>
|
</provider>
|
||||||
</entry>
|
</entry>
|
||||||
@ -873,21 +857,6 @@
|
|||||||
</state>
|
</state>
|
||||||
</provider>
|
</provider>
|
||||||
</entry>
|
</entry>
|
||||||
<entry file="file://$PROJECT_DIR$/src/main/java/ru/cft/task/restServer/EmailException.java">
|
|
||||||
<provider selected="true" editor-type-id="text-editor">
|
|
||||||
<state relative-caret-position="34">
|
|
||||||
<caret line="2" column="13" lean-forward="false" selection-start-line="2" selection-start-column="13" selection-end-line="2" selection-end-column="13" />
|
|
||||||
<folding />
|
|
||||||
</state>
|
|
||||||
</provider>
|
|
||||||
</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="357">
|
|
||||||
<caret line="27" column="5" lean-forward="false" selection-start-line="27" selection-start-column="5" selection-end-line="27" selection-end-column="5" />
|
|
||||||
</state>
|
|
||||||
</provider>
|
|
||||||
</entry>
|
|
||||||
<entry file="file://$PROJECT_DIR$/src/main/resources/banner.txt">
|
<entry file="file://$PROJECT_DIR$/src/main/resources/banner.txt">
|
||||||
<provider selected="true" editor-type-id="text-editor">
|
<provider selected="true" editor-type-id="text-editor">
|
||||||
<state relative-caret-position="68">
|
<state relative-caret-position="68">
|
||||||
@ -903,20 +872,18 @@
|
|||||||
</state>
|
</state>
|
||||||
</provider>
|
</provider>
|
||||||
</entry>
|
</entry>
|
||||||
<entry file="file://$PROJECT_DIR$/src/main/java/ru/cft/task/restServer/EmailBook.java">
|
<entry file="file://$PROJECT_DIR$/src/main/java/ru/cft/task/restServer/Main.java">
|
||||||
<provider selected="true" editor-type-id="text-editor">
|
<provider selected="true" editor-type-id="text-editor">
|
||||||
<state relative-caret-position="119">
|
<state relative-caret-position="119">
|
||||||
<caret line="47" column="66" lean-forward="true" selection-start-line="47" selection-start-column="66" selection-end-line="47" selection-end-column="66" />
|
<caret line="8" column="32" lean-forward="false" selection-start-line="8" selection-start-column="32" selection-end-line="8" selection-end-column="32" />
|
||||||
<folding>
|
<folding />
|
||||||
<element signature="imports" expanded="false" />
|
|
||||||
</folding>
|
|
||||||
</state>
|
</state>
|
||||||
</provider>
|
</provider>
|
||||||
</entry>
|
</entry>
|
||||||
<entry file="file://$PROJECT_DIR$/src/main/java/ru/cft/task/restServer/Main.java">
|
<entry file="file://$PROJECT_DIR$/src/main/java/ru/cft/task/restServer/ExceptionControllerAdvice.java">
|
||||||
<provider selected="true" editor-type-id="text-editor">
|
<provider selected="true" editor-type-id="text-editor">
|
||||||
<state relative-caret-position="85">
|
<state relative-caret-position="136">
|
||||||
<caret line="6" column="13" lean-forward="false" selection-start-line="6" selection-start-column="13" selection-end-line="6" selection-end-column="13" />
|
<caret line="13" column="37" lean-forward="false" selection-start-line="13" selection-start-column="37" selection-end-line="13" selection-end-column="37" />
|
||||||
<folding />
|
<folding />
|
||||||
</state>
|
</state>
|
||||||
</provider>
|
</provider>
|
||||||
@ -929,29 +896,45 @@
|
|||||||
</state>
|
</state>
|
||||||
</provider>
|
</provider>
|
||||||
</entry>
|
</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="493">
|
|
||||||
<caret line="68" column="19" lean-forward="false" selection-start-line="68" selection-start-column="19" selection-end-line="68" selection-end-column="19" />
|
|
||||||
<folding>
|
|
||||||
<element signature="imports" expanded="true" />
|
|
||||||
</folding>
|
|
||||||
</state>
|
|
||||||
</provider>
|
|
||||||
</entry>
|
|
||||||
<entry file="file://$PROJECT_DIR$/src/main/java/ru/cft/task/restServer/ErrorResponse.java">
|
<entry file="file://$PROJECT_DIR$/src/main/java/ru/cft/task/restServer/ErrorResponse.java">
|
||||||
<provider selected="true" editor-type-id="text-editor">
|
<provider selected="true" editor-type-id="text-editor">
|
||||||
<state relative-caret-position="34">
|
<state relative-caret-position="34">
|
||||||
<caret line="2" column="13" lean-forward="false" selection-start-line="2" selection-start-column="13" selection-end-line="2" selection-end-column="13" />
|
<caret line="2" column="37" lean-forward="false" selection-start-line="2" selection-start-column="37" selection-end-line="2" selection-end-column="37" />
|
||||||
<folding />
|
<folding />
|
||||||
</state>
|
</state>
|
||||||
</provider>
|
</provider>
|
||||||
</entry>
|
</entry>
|
||||||
<entry file="file://$PROJECT_DIR$/src/main/java/ru/cft/task/restServer/ExceptionControllerAdvice.java">
|
<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="102">
|
||||||
|
<caret line="6" column="36" lean-forward="false" selection-start-line="6" selection-start-column="36" selection-end-line="6" selection-end-column="36" />
|
||||||
|
<folding />
|
||||||
|
</state>
|
||||||
|
</provider>
|
||||||
|
</entry>
|
||||||
|
<entry file="file://$PROJECT_DIR$/src/main/java/ru/cft/task/restServer/EmailException.java">
|
||||||
|
<provider selected="true" editor-type-id="text-editor">
|
||||||
|
<state relative-caret-position="34">
|
||||||
|
<caret line="2" column="30" lean-forward="false" selection-start-line="2" selection-start-column="30" selection-end-line="2" selection-end-column="30" />
|
||||||
|
<folding />
|
||||||
|
</state>
|
||||||
|
</provider>
|
||||||
|
</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="324">
|
||||||
|
<caret line="72" column="23" lean-forward="false" selection-start-line="72" selection-start-column="23" selection-end-line="72" selection-end-column="23" />
|
||||||
|
<folding />
|
||||||
|
</state>
|
||||||
|
</provider>
|
||||||
|
</entry>
|
||||||
|
<entry file="file://$PROJECT_DIR$/src/main/java/ru/cft/task/restServer/EmailBookController.java">
|
||||||
<provider selected="true" editor-type-id="text-editor">
|
<provider selected="true" editor-type-id="text-editor">
|
||||||
<state relative-caret-position="289">
|
<state relative-caret-position="289">
|
||||||
<caret line="22" column="0" lean-forward="true" selection-start-line="22" selection-start-column="0" selection-end-line="22" selection-end-column="0" />
|
<caret line="49" column="47" lean-forward="true" selection-start-line="49" selection-start-column="47" selection-end-line="49" selection-end-column="47" />
|
||||||
<folding />
|
<folding>
|
||||||
|
<element signature="imports" expanded="true" />
|
||||||
|
</folding>
|
||||||
</state>
|
</state>
|
||||||
</provider>
|
</provider>
|
||||||
</entry>
|
</entry>
|
||||||
|
@ -7,13 +7,16 @@ import java.util.Map;
|
|||||||
|
|
||||||
@Component
|
@Component
|
||||||
public class EmailBook {
|
public class EmailBook {
|
||||||
private Map<Long, EmailRecord> book;
|
private Map<Long, EmailRecord> book; // Внутренний массив записей
|
||||||
|
|
||||||
public EmailBook() {
|
public EmailBook() {
|
||||||
|
// Массив, хешем в котором будет id записи для быстрого поиска
|
||||||
book = new HashMap<>();
|
book = new HashMap<>();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Добавление записи в массив
|
||||||
public EmailRecord addEmailRecord(long id, String name, String email) throws EmailException {
|
public EmailRecord addEmailRecord(long id, String name, String email) throws EmailException {
|
||||||
|
// ПРоверка на уникальность email
|
||||||
for (Map.Entry<Long, EmailRecord> rec : book.entrySet()) {
|
for (Map.Entry<Long, EmailRecord> rec : book.entrySet()) {
|
||||||
if (rec.getValue().getEmail().equalsIgnoreCase(email)) {
|
if (rec.getValue().getEmail().equalsIgnoreCase(email)) {
|
||||||
throw new EmailException("Запись с {email = " + email + "} уже есть в базе");
|
throw new EmailException("Запись с {email = " + email + "} уже есть в базе");
|
||||||
@ -21,10 +24,12 @@ public class EmailBook {
|
|||||||
}
|
}
|
||||||
EmailRecord new_rec = new EmailRecord(id, name, email);
|
EmailRecord new_rec = new EmailRecord(id, name, email);
|
||||||
book.put(id, new_rec);
|
book.put(id, new_rec);
|
||||||
return new_rec;
|
return new_rec; // Возвращаем новую добавленную запись
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Удаление записи из массива
|
||||||
public boolean removeEmailRecord(long id) throws EmailException {
|
public boolean removeEmailRecord(long id) throws EmailException {
|
||||||
|
// Ищем по id, если не найдено бросаем исключение
|
||||||
if (book.containsKey(id)) {
|
if (book.containsKey(id)) {
|
||||||
book.remove(id);
|
book.remove(id);
|
||||||
return true;
|
return true;
|
||||||
@ -32,10 +37,12 @@ public class EmailBook {
|
|||||||
throw new EmailException("Запись с {id = " + id + "} не найдена");
|
throw new EmailException("Запись с {id = " + id + "} не найдена");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Просто считаем кол-во записей массива
|
||||||
public int count() {
|
public int count() {
|
||||||
return book.size();
|
return book.size();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Поиск записи по id
|
||||||
public EmailRecord findRecordById(long id) throws EmailException {
|
public EmailRecord findRecordById(long id) throws EmailException {
|
||||||
if (book.containsKey(id)) {
|
if (book.containsKey(id)) {
|
||||||
return book.get(id);
|
return book.get(id);
|
||||||
@ -43,6 +50,7 @@ public class EmailBook {
|
|||||||
throw new EmailException("Запись с {id = " + id + "} не найдена");
|
throw new EmailException("Запись с {id = " + id + "} не найдена");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Поиск записи по имени
|
||||||
public EmailRecord findRecordByName(String name) throws EmailException {
|
public EmailRecord findRecordByName(String name) throws EmailException {
|
||||||
for (Map.Entry<Long, EmailRecord> rec : book.entrySet()) {
|
for (Map.Entry<Long, EmailRecord> rec : book.entrySet()) {
|
||||||
if (rec.getValue().getName().equalsIgnoreCase(name)) {
|
if (rec.getValue().getName().equalsIgnoreCase(name)) {
|
||||||
@ -52,6 +60,7 @@ public class EmailBook {
|
|||||||
throw new EmailException("Запись с {name = " + name + "} не найдена");
|
throw new EmailException("Запись с {name = " + name + "} не найдена");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Поиск записи по почте
|
||||||
public EmailRecord findRecordByEmail(String email) throws EmailException {
|
public EmailRecord findRecordByEmail(String email) throws EmailException {
|
||||||
for (Map.Entry<Long, EmailRecord> rec : book.entrySet()) {
|
for (Map.Entry<Long, EmailRecord> rec : book.entrySet()) {
|
||||||
if (rec.getValue().getEmail().equalsIgnoreCase(email)) {
|
if (rec.getValue().getEmail().equalsIgnoreCase(email)) {
|
||||||
@ -61,6 +70,7 @@ public class EmailBook {
|
|||||||
throw new EmailException("Запись с {email = " + email + "} не найдена");
|
throw new EmailException("Запись с {email = " + email + "} не найдена");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Изменение записи
|
||||||
public EmailRecord editRecord(long id, String name, String email) throws EmailException {
|
public EmailRecord editRecord(long id, String name, String email) throws EmailException {
|
||||||
if (book.containsKey(id)) {
|
if (book.containsKey(id)) {
|
||||||
if (!name.isEmpty()) {
|
if (!name.isEmpty()) {
|
||||||
|
@ -10,15 +10,16 @@ import org.springframework.web.bind.annotation.*;
|
|||||||
import java.util.concurrent.atomic.AtomicLong;
|
import java.util.concurrent.atomic.AtomicLong;
|
||||||
|
|
||||||
@RestController
|
@RestController
|
||||||
@RequestMapping(value = "/")
|
@RequestMapping(value = "/") // Единая точка входа /
|
||||||
public class EmailBookController {
|
public class EmailBookController {
|
||||||
|
|
||||||
private static final Logger logger = LoggerFactory.getLogger(EmailBookController.class);
|
private static final Logger logger = LoggerFactory.getLogger(EmailBookController.class);
|
||||||
private final AtomicLong new_id = new AtomicLong();
|
private final AtomicLong new_id = new AtomicLong(); // секвенция для id записей
|
||||||
|
|
||||||
@Autowired
|
@Autowired
|
||||||
private EmailBook emailBook;
|
private EmailBook emailBook;
|
||||||
|
|
||||||
|
// Точка входа для создания записи (метод POST )
|
||||||
@RequestMapping(method = RequestMethod.POST)
|
@RequestMapping(method = RequestMethod.POST)
|
||||||
public ResponseEntity<EmailRecord> addEmailRec(@RequestParam(value = "name") String name,
|
public ResponseEntity<EmailRecord> addEmailRec(@RequestParam(value = "name") String name,
|
||||||
@RequestParam(value = "email") String email) throws EmailException {
|
@RequestParam(value = "email") String email) throws EmailException {
|
||||||
@ -26,23 +27,26 @@ public class EmailBookController {
|
|||||||
return new ResponseEntity<EmailRecord>(emailBook.addEmailRecord(new_id.incrementAndGet(), name, email), HttpStatus.OK);
|
return new ResponseEntity<EmailRecord>(emailBook.addEmailRecord(new_id.incrementAndGet(), name, email), HttpStatus.OK);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Точка входа для поиска записи (метод GET )
|
||||||
|
// приоритет id -> email -> name
|
||||||
@RequestMapping(method = RequestMethod.GET)
|
@RequestMapping(method = RequestMethod.GET)
|
||||||
public ResponseEntity<EmailRecord> findEmailRec(@RequestParam(value = "id", required = false) String id,
|
public ResponseEntity<EmailRecord> findEmailRec(@RequestParam(value = "id", required = false) String id,
|
||||||
@RequestParam(value = "name", required = false) String name,
|
@RequestParam(value = "name", required = false) String name,
|
||||||
@RequestParam(value = "email", required = false) String email
|
@RequestParam(value = "email", required = false) String email
|
||||||
) throws EmailException {
|
) throws EmailException {
|
||||||
logger.warn("Method GET: {id = " + id + ", name = " + name + ", email = " + email + "}");
|
logger.warn("Method GET: {id = " + id + ", name = " + name + ", email = " + email + "}");
|
||||||
if (name != null && !name.isEmpty()) {
|
if (id != null && !id.isEmpty()) {
|
||||||
return new ResponseEntity<EmailRecord>(emailBook.findRecordByName(name), HttpStatus.OK);
|
return new ResponseEntity<EmailRecord>(emailBook.findRecordById(Long.valueOf(id)), HttpStatus.OK);
|
||||||
} else if (email != null && !email.isEmpty()) {
|
} else if (email != null && !email.isEmpty()) {
|
||||||
return new ResponseEntity<EmailRecord>(emailBook.findRecordByEmail(email), HttpStatus.OK);
|
return new ResponseEntity<EmailRecord>(emailBook.findRecordByEmail(email), HttpStatus.OK);
|
||||||
} else if (id != null && !id.isEmpty()) {
|
} else if (name != null && !name.isEmpty()) {
|
||||||
return new ResponseEntity<EmailRecord>(emailBook.findRecordById(Long.valueOf(id)), HttpStatus.OK);
|
return new ResponseEntity<EmailRecord>(emailBook.findRecordByName(name), HttpStatus.OK);
|
||||||
} else {
|
} else {
|
||||||
throw new EmailException("Задайте параметр для поиска");
|
throw new EmailException("Задайте параметр для поиска");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Точка входа для изменения записи (метод PUT )
|
||||||
@RequestMapping(method = RequestMethod.PUT)
|
@RequestMapping(method = RequestMethod.PUT)
|
||||||
public ResponseEntity<EmailRecord> editEmailRec(@RequestParam(value = "id", required = true) String id,
|
public ResponseEntity<EmailRecord> editEmailRec(@RequestParam(value = "id", required = true) String id,
|
||||||
@RequestParam(value = "name") String name,
|
@RequestParam(value = "name") String name,
|
||||||
@ -52,6 +56,7 @@ public class EmailBookController {
|
|||||||
return new ResponseEntity<EmailRecord>(emailBook.editRecord(Long.valueOf(id), name, email), HttpStatus.OK);
|
return new ResponseEntity<EmailRecord>(emailBook.editRecord(Long.valueOf(id), name, email), HttpStatus.OK);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Точка входа для удаления записи (метод DELETE, путь /delete/{id})
|
||||||
@RequestMapping(value = "/delete/{id}", method = RequestMethod.DELETE)
|
@RequestMapping(value = "/delete/{id}", method = RequestMethod.DELETE)
|
||||||
public ResponseEntity<ErrorResponse> removeEmailRec(@PathVariable(value = "id") long id) throws EmailException {
|
public ResponseEntity<ErrorResponse> removeEmailRec(@PathVariable(value = "id") long id) throws EmailException {
|
||||||
logger.warn("Method DELETE: {id = " + id + "}");
|
logger.warn("Method DELETE: {id = " + id + "}");
|
||||||
@ -61,9 +66,10 @@ public class EmailBookController {
|
|||||||
message.setMessage("Запись {id = " + id + "} успешно удалена");
|
message.setMessage("Запись {id = " + id + "} успешно удалена");
|
||||||
return new ResponseEntity<ErrorResponse>(message, HttpStatus.OK);
|
return new ResponseEntity<ErrorResponse>(message, HttpStatus.OK);
|
||||||
}
|
}
|
||||||
return null;
|
return null; // Просто заглушка, сюда не должно дойти - или успешно удалиться или вызовется исключение
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Точка входа для вывода кол-ва записей (метод GET, путь /count)
|
||||||
@RequestMapping(value = "/count", method = RequestMethod.GET)
|
@RequestMapping(value = "/count", method = RequestMethod.GET)
|
||||||
public int countEmailRecords() {
|
public int countEmailRecords() {
|
||||||
logger.warn("Method GET: count");
|
logger.warn("Method GET: count");
|
||||||
|
@ -1,5 +1,6 @@
|
|||||||
package ru.cft.task.restServer;
|
package ru.cft.task.restServer;
|
||||||
|
|
||||||
|
// Класс исключения для работы
|
||||||
public class EmailException extends Exception {
|
public class EmailException extends Exception {
|
||||||
private static final long serialVersionUID = 1L;
|
private static final long serialVersionUID = 1L;
|
||||||
|
|
||||||
|
@ -1,9 +1,10 @@
|
|||||||
package ru.cft.task.restServer;
|
package ru.cft.task.restServer;
|
||||||
|
|
||||||
|
// Класс записи
|
||||||
public class EmailRecord {
|
public class EmailRecord {
|
||||||
private long id;
|
private long id; // id записи
|
||||||
private String name;
|
private String name; // Имя
|
||||||
private String email;
|
private String email; // почта
|
||||||
|
|
||||||
public EmailRecord(long id, String name, String email) {
|
public EmailRecord(long id, String name, String email) {
|
||||||
this.id = id;
|
this.id = id;
|
||||||
|
@ -1,5 +1,6 @@
|
|||||||
package ru.cft.task.restServer;
|
package ru.cft.task.restServer;
|
||||||
|
|
||||||
|
// Класс описания возвращаемой ошибки
|
||||||
public class ErrorResponse {
|
public class ErrorResponse {
|
||||||
private int errorCode;
|
private int errorCode;
|
||||||
private String message;
|
private String message;
|
||||||
|
@ -11,6 +11,7 @@ import org.springframework.web.bind.annotation.ExceptionHandler;
|
|||||||
public class ExceptionControllerAdvice {
|
public class ExceptionControllerAdvice {
|
||||||
private static final Logger logger = LoggerFactory.getLogger(EmailBookController.class);
|
private static final Logger logger = LoggerFactory.getLogger(EmailBookController.class);
|
||||||
|
|
||||||
|
// Класс для хендлеров исключений
|
||||||
@ExceptionHandler(Exception.class)
|
@ExceptionHandler(Exception.class)
|
||||||
public ResponseEntity<ErrorResponse> exceptionHandler(Exception ex) {
|
public ResponseEntity<ErrorResponse> exceptionHandler(Exception ex) {
|
||||||
ErrorResponse error = new ErrorResponse();
|
ErrorResponse error = new ErrorResponse();
|
||||||
|
@ -6,6 +6,7 @@ import org.springframework.boot.autoconfigure.SpringBootApplication;
|
|||||||
@SpringBootApplication
|
@SpringBootApplication
|
||||||
public class Main {
|
public class Main {
|
||||||
|
|
||||||
|
// Создание и запуска Spring boot приложения
|
||||||
public static void main(String[] args) {
|
public static void main(String[] args) {
|
||||||
SpringApplication.run(Main.class, args);
|
SpringApplication.run(Main.class, args);
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user