diff --git a/.idea/libraries/Maven__antlr_antlr_2_7_7.xml b/.idea/libraries/Maven__antlr_antlr_2_7_7.xml
deleted file mode 100644
index b8d93d8..0000000
--- a/.idea/libraries/Maven__antlr_antlr_2_7_7.xml
+++ /dev/null
@@ -1,13 +0,0 @@
-
-
-
-
-
-
-
-
-
-
-
-
-
\ No newline at end of file
diff --git a/.idea/libraries/Maven__com_vaadin_external_google_android_json_0_0_20131108_vaadin1.xml b/.idea/libraries/Maven__com_vaadin_external_google_android_json_0_0_20131108_vaadin1.xml
deleted file mode 100644
index b8581a6..0000000
--- a/.idea/libraries/Maven__com_vaadin_external_google_android_json_0_0_20131108_vaadin1.xml
+++ /dev/null
@@ -1,13 +0,0 @@
-
-
-
-
-
-
-
-
-
-
-
-
-
\ No newline at end of file
diff --git a/.idea/libraries/Maven__dom4j_dom4j_1_6_1.xml b/.idea/libraries/Maven__dom4j_dom4j_1_6_1.xml
deleted file mode 100644
index 14681ee..0000000
--- a/.idea/libraries/Maven__dom4j_dom4j_1_6_1.xml
+++ /dev/null
@@ -1,13 +0,0 @@
-
-
-
-
-
-
-
-
-
-
-
-
-
\ No newline at end of file
diff --git a/.idea/libraries/Maven__javax_transaction_javax_transaction_api_1_2.xml b/.idea/libraries/Maven__javax_transaction_javax_transaction_api_1_2.xml
deleted file mode 100644
index 5f032d2..0000000
--- a/.idea/libraries/Maven__javax_transaction_javax_transaction_api_1_2.xml
+++ /dev/null
@@ -1,13 +0,0 @@
-
-
-
-
-
-
-
-
-
-
-
-
-
\ No newline at end of file
diff --git a/.idea/libraries/Maven__junit_junit_4_12.xml b/.idea/libraries/Maven__junit_junit_4_12.xml
deleted file mode 100644
index d411041..0000000
--- a/.idea/libraries/Maven__junit_junit_4_12.xml
+++ /dev/null
@@ -1,13 +0,0 @@
-
-
-
-
-
-
-
-
-
-
-
-
-
\ No newline at end of file
diff --git a/.idea/libraries/Maven__org_apache_tomcat_tomcat_jdbc_8_5_23.xml b/.idea/libraries/Maven__org_apache_tomcat_tomcat_jdbc_8_5_23.xml
deleted file mode 100644
index 38b86a3..0000000
--- a/.idea/libraries/Maven__org_apache_tomcat_tomcat_jdbc_8_5_23.xml
+++ /dev/null
@@ -1,13 +0,0 @@
-
-
-
-
-
-
-
-
-
-
-
-
-
\ No newline at end of file
diff --git a/.idea/libraries/Maven__org_apache_tomcat_tomcat_juli_8_5_23.xml b/.idea/libraries/Maven__org_apache_tomcat_tomcat_juli_8_5_23.xml
deleted file mode 100644
index a9350c3..0000000
--- a/.idea/libraries/Maven__org_apache_tomcat_tomcat_juli_8_5_23.xml
+++ /dev/null
@@ -1,13 +0,0 @@
-
-
-
-
-
-
-
-
-
-
-
-
-
\ No newline at end of file
diff --git a/.idea/libraries/Maven__org_aspectj_aspectjweaver_1_8_13.xml b/.idea/libraries/Maven__org_aspectj_aspectjweaver_1_8_13.xml
deleted file mode 100644
index d46e30a..0000000
--- a/.idea/libraries/Maven__org_aspectj_aspectjweaver_1_8_13.xml
+++ /dev/null
@@ -1,13 +0,0 @@
-
-
-
-
-
-
-
-
-
-
-
-
-
\ No newline at end of file
diff --git a/.idea/libraries/Maven__org_assertj_assertj_core_2_6_0.xml b/.idea/libraries/Maven__org_assertj_assertj_core_2_6_0.xml
deleted file mode 100644
index 58bdc9a..0000000
--- a/.idea/libraries/Maven__org_assertj_assertj_core_2_6_0.xml
+++ /dev/null
@@ -1,13 +0,0 @@
-
-
-
-
-
-
-
-
-
-
-
-
-
\ No newline at end of file
diff --git a/.idea/libraries/Maven__org_atteo_evo_inflector_1_2_2.xml b/.idea/libraries/Maven__org_atteo_evo_inflector_1_2_2.xml
deleted file mode 100644
index 2dde355..0000000
--- a/.idea/libraries/Maven__org_atteo_evo_inflector_1_2_2.xml
+++ /dev/null
@@ -1,13 +0,0 @@
-
-
-
-
-
-
-
-
-
-
-
-
-
\ No newline at end of file
diff --git a/.idea/libraries/Maven__org_hamcrest_hamcrest_core_1_3.xml b/.idea/libraries/Maven__org_hamcrest_hamcrest_core_1_3.xml
deleted file mode 100644
index f58bbc1..0000000
--- a/.idea/libraries/Maven__org_hamcrest_hamcrest_core_1_3.xml
+++ /dev/null
@@ -1,13 +0,0 @@
-
-
-
-
-
-
-
-
-
-
-
-
-
\ No newline at end of file
diff --git a/.idea/libraries/Maven__org_hamcrest_hamcrest_library_1_3.xml b/.idea/libraries/Maven__org_hamcrest_hamcrest_library_1_3.xml
deleted file mode 100644
index 78dbe45..0000000
--- a/.idea/libraries/Maven__org_hamcrest_hamcrest_library_1_3.xml
+++ /dev/null
@@ -1,13 +0,0 @@
-
-
-
-
-
-
-
-
-
-
-
-
-
\ No newline at end of file
diff --git a/.idea/libraries/Maven__org_hibernate_common_hibernate_commons_annotations_5_0_1_Final.xml b/.idea/libraries/Maven__org_hibernate_common_hibernate_commons_annotations_5_0_1_Final.xml
deleted file mode 100644
index ce34f42..0000000
--- a/.idea/libraries/Maven__org_hibernate_common_hibernate_commons_annotations_5_0_1_Final.xml
+++ /dev/null
@@ -1,13 +0,0 @@
-
-
-
-
-
-
-
-
-
-
-
-
-
\ No newline at end of file
diff --git a/.idea/libraries/Maven__org_hibernate_hibernate_core_5_0_12_Final.xml b/.idea/libraries/Maven__org_hibernate_hibernate_core_5_0_12_Final.xml
deleted file mode 100644
index 34893a4..0000000
--- a/.idea/libraries/Maven__org_hibernate_hibernate_core_5_0_12_Final.xml
+++ /dev/null
@@ -1,13 +0,0 @@
-
-
-
-
-
-
-
-
-
-
-
-
-
\ No newline at end of file
diff --git a/.idea/libraries/Maven__org_hibernate_hibernate_entitymanager_5_0_12_Final.xml b/.idea/libraries/Maven__org_hibernate_hibernate_entitymanager_5_0_12_Final.xml
deleted file mode 100644
index 27dda1e..0000000
--- a/.idea/libraries/Maven__org_hibernate_hibernate_entitymanager_5_0_12_Final.xml
+++ /dev/null
@@ -1,13 +0,0 @@
-
-
-
-
-
-
-
-
-
-
-
-
-
\ No newline at end of file
diff --git a/.idea/libraries/Maven__org_hibernate_javax_persistence_hibernate_jpa_2_1_api_1_0_0_Final.xml b/.idea/libraries/Maven__org_hibernate_javax_persistence_hibernate_jpa_2_1_api_1_0_0_Final.xml
deleted file mode 100644
index 6492b2b..0000000
--- a/.idea/libraries/Maven__org_hibernate_javax_persistence_hibernate_jpa_2_1_api_1_0_0_Final.xml
+++ /dev/null
@@ -1,13 +0,0 @@
-
-
-
-
-
-
-
-
-
-
-
-
-
\ No newline at end of file
diff --git a/.idea/libraries/Maven__org_javassist_javassist_3_21_0_GA.xml b/.idea/libraries/Maven__org_javassist_javassist_3_21_0_GA.xml
deleted file mode 100644
index 09c4cf0..0000000
--- a/.idea/libraries/Maven__org_javassist_javassist_3_21_0_GA.xml
+++ /dev/null
@@ -1,13 +0,0 @@
-
-
-
-
-
-
-
-
-
-
-
-
-
\ No newline at end of file
diff --git a/.idea/libraries/Maven__org_jboss_jandex_2_0_0_Final.xml b/.idea/libraries/Maven__org_jboss_jandex_2_0_0_Final.xml
deleted file mode 100644
index a74dcfd..0000000
--- a/.idea/libraries/Maven__org_jboss_jandex_2_0_0_Final.xml
+++ /dev/null
@@ -1,13 +0,0 @@
-
-
-
-
-
-
-
-
-
-
-
-
-
\ No newline at end of file
diff --git a/.idea/libraries/Maven__org_mockito_mockito_core_1_10_19.xml b/.idea/libraries/Maven__org_mockito_mockito_core_1_10_19.xml
deleted file mode 100644
index a523703..0000000
--- a/.idea/libraries/Maven__org_mockito_mockito_core_1_10_19.xml
+++ /dev/null
@@ -1,13 +0,0 @@
-
-
-
-
-
-
-
-
-
-
-
-
-
\ No newline at end of file
diff --git a/.idea/libraries/Maven__org_objenesis_objenesis_2_1.xml b/.idea/libraries/Maven__org_objenesis_objenesis_2_1.xml
deleted file mode 100644
index 7ab319b..0000000
--- a/.idea/libraries/Maven__org_objenesis_objenesis_2_1.xml
+++ /dev/null
@@ -1,13 +0,0 @@
-
-
-
-
-
-
-
-
-
-
-
-
-
\ No newline at end of file
diff --git a/.idea/libraries/Maven__org_skyscreamer_jsonassert_1_4_0.xml b/.idea/libraries/Maven__org_skyscreamer_jsonassert_1_4_0.xml
deleted file mode 100644
index f86d2c8..0000000
--- a/.idea/libraries/Maven__org_skyscreamer_jsonassert_1_4_0.xml
+++ /dev/null
@@ -1,13 +0,0 @@
-
-
-
-
-
-
-
-
-
-
-
-
-
\ No newline at end of file
diff --git a/.idea/libraries/Maven__org_springframework_boot_spring_boot_starter_aop_1_5_9_RELEASE.xml b/.idea/libraries/Maven__org_springframework_boot_spring_boot_starter_aop_1_5_9_RELEASE.xml
deleted file mode 100644
index 2932fb5..0000000
--- a/.idea/libraries/Maven__org_springframework_boot_spring_boot_starter_aop_1_5_9_RELEASE.xml
+++ /dev/null
@@ -1,13 +0,0 @@
-
-
-
-
-
-
-
-
-
-
-
-
-
\ No newline at end of file
diff --git a/.idea/libraries/Maven__org_springframework_boot_spring_boot_starter_data_jpa_1_5_9_RELEASE.xml b/.idea/libraries/Maven__org_springframework_boot_spring_boot_starter_data_jpa_1_5_9_RELEASE.xml
deleted file mode 100644
index adc9680..0000000
--- a/.idea/libraries/Maven__org_springframework_boot_spring_boot_starter_data_jpa_1_5_9_RELEASE.xml
+++ /dev/null
@@ -1,13 +0,0 @@
-
-
-
-
-
-
-
-
-
-
-
-
-
\ No newline at end of file
diff --git a/.idea/libraries/Maven__org_springframework_boot_spring_boot_starter_jdbc_1_5_9_RELEASE.xml b/.idea/libraries/Maven__org_springframework_boot_spring_boot_starter_jdbc_1_5_9_RELEASE.xml
deleted file mode 100644
index 338299a..0000000
--- a/.idea/libraries/Maven__org_springframework_boot_spring_boot_starter_jdbc_1_5_9_RELEASE.xml
+++ /dev/null
@@ -1,13 +0,0 @@
-
-
-
-
-
-
-
-
-
-
-
-
-
\ No newline at end of file
diff --git a/.idea/libraries/Maven__org_springframework_boot_spring_boot_starter_test_1_5_9_RELEASE.xml b/.idea/libraries/Maven__org_springframework_boot_spring_boot_starter_test_1_5_9_RELEASE.xml
deleted file mode 100644
index d7db397..0000000
--- a/.idea/libraries/Maven__org_springframework_boot_spring_boot_starter_test_1_5_9_RELEASE.xml
+++ /dev/null
@@ -1,13 +0,0 @@
-
-
-
-
-
-
-
-
-
-
-
-
-
\ No newline at end of file
diff --git a/.idea/libraries/Maven__org_springframework_boot_spring_boot_test_1_5_9_RELEASE.xml b/.idea/libraries/Maven__org_springframework_boot_spring_boot_test_1_5_9_RELEASE.xml
deleted file mode 100644
index 9312efe..0000000
--- a/.idea/libraries/Maven__org_springframework_boot_spring_boot_test_1_5_9_RELEASE.xml
+++ /dev/null
@@ -1,13 +0,0 @@
-
-
-
-
-
-
-
-
-
-
-
-
-
\ No newline at end of file
diff --git a/.idea/libraries/Maven__org_springframework_boot_spring_boot_test_autoconfigure_1_5_9_RELEASE.xml b/.idea/libraries/Maven__org_springframework_boot_spring_boot_test_autoconfigure_1_5_9_RELEASE.xml
deleted file mode 100644
index 07d7bca..0000000
--- a/.idea/libraries/Maven__org_springframework_boot_spring_boot_test_autoconfigure_1_5_9_RELEASE.xml
+++ /dev/null
@@ -1,13 +0,0 @@
-
-
-
-
-
-
-
-
-
-
-
-
-
\ No newline at end of file
diff --git a/.idea/libraries/Maven__org_springframework_data_spring_data_commons_2_0_2_RELEASE.xml b/.idea/libraries/Maven__org_springframework_data_spring_data_commons_2_0_2_RELEASE.xml
deleted file mode 100644
index 3f1bdbc..0000000
--- a/.idea/libraries/Maven__org_springframework_data_spring_data_commons_2_0_2_RELEASE.xml
+++ /dev/null
@@ -1,13 +0,0 @@
-
-
-
-
-
-
-
-
-
-
-
-
-
\ No newline at end of file
diff --git a/.idea/libraries/Maven__org_springframework_data_spring_data_jpa_1_11_9_RELEASE.xml b/.idea/libraries/Maven__org_springframework_data_spring_data_jpa_1_11_9_RELEASE.xml
deleted file mode 100644
index 3f35534..0000000
--- a/.idea/libraries/Maven__org_springframework_data_spring_data_jpa_1_11_9_RELEASE.xml
+++ /dev/null
@@ -1,13 +0,0 @@
-
-
-
-
-
-
-
-
-
-
-
-
-
\ No newline at end of file
diff --git a/.idea/libraries/Maven__org_springframework_data_spring_data_rest_core_2_6_9_RELEASE.xml b/.idea/libraries/Maven__org_springframework_data_spring_data_rest_core_2_6_9_RELEASE.xml
deleted file mode 100644
index 3816e08..0000000
--- a/.idea/libraries/Maven__org_springframework_data_spring_data_rest_core_2_6_9_RELEASE.xml
+++ /dev/null
@@ -1,13 +0,0 @@
-
-
-
-
-
-
-
-
-
-
-
-
-
\ No newline at end of file
diff --git a/.idea/libraries/Maven__org_springframework_hateoas_spring_hateoas_0_23_0_RELEASE.xml b/.idea/libraries/Maven__org_springframework_hateoas_spring_hateoas_0_23_0_RELEASE.xml
deleted file mode 100644
index 92e7f9f..0000000
--- a/.idea/libraries/Maven__org_springframework_hateoas_spring_hateoas_0_23_0_RELEASE.xml
+++ /dev/null
@@ -1,13 +0,0 @@
-
-
-
-
-
-
-
-
-
-
-
-
-
\ No newline at end of file
diff --git a/.idea/libraries/Maven__org_springframework_plugin_spring_plugin_core_1_2_0_RELEASE.xml b/.idea/libraries/Maven__org_springframework_plugin_spring_plugin_core_1_2_0_RELEASE.xml
deleted file mode 100644
index fbc0452..0000000
--- a/.idea/libraries/Maven__org_springframework_plugin_spring_plugin_core_1_2_0_RELEASE.xml
+++ /dev/null
@@ -1,13 +0,0 @@
-
-
-
-
-
-
-
-
-
-
-
-
-
\ No newline at end of file
diff --git a/.idea/libraries/Maven__org_springframework_spring_aspects_4_3_13_RELEASE.xml b/.idea/libraries/Maven__org_springframework_spring_aspects_4_3_13_RELEASE.xml
deleted file mode 100644
index 2d53c11..0000000
--- a/.idea/libraries/Maven__org_springframework_spring_aspects_4_3_13_RELEASE.xml
+++ /dev/null
@@ -1,13 +0,0 @@
-
-
-
-
-
-
-
-
-
-
-
-
-
\ No newline at end of file
diff --git a/.idea/libraries/Maven__org_springframework_spring_jdbc_4_3_13_RELEASE.xml b/.idea/libraries/Maven__org_springframework_spring_jdbc_4_3_13_RELEASE.xml
deleted file mode 100644
index 49da486..0000000
--- a/.idea/libraries/Maven__org_springframework_spring_jdbc_4_3_13_RELEASE.xml
+++ /dev/null
@@ -1,13 +0,0 @@
-
-
-
-
-
-
-
-
-
-
-
-
-
\ No newline at end of file
diff --git a/.idea/libraries/Maven__org_springframework_spring_orm_4_3_13_RELEASE.xml b/.idea/libraries/Maven__org_springframework_spring_orm_4_3_13_RELEASE.xml
deleted file mode 100644
index 354d247..0000000
--- a/.idea/libraries/Maven__org_springframework_spring_orm_4_3_13_RELEASE.xml
+++ /dev/null
@@ -1,13 +0,0 @@
-
-
-
-
-
-
-
-
-
-
-
-
-
\ No newline at end of file
diff --git a/.idea/libraries/Maven__org_springframework_spring_test_4_3_13_RELEASE.xml b/.idea/libraries/Maven__org_springframework_spring_test_4_3_13_RELEASE.xml
deleted file mode 100644
index 0c0fcbf..0000000
--- a/.idea/libraries/Maven__org_springframework_spring_test_4_3_13_RELEASE.xml
+++ /dev/null
@@ -1,13 +0,0 @@
-
-
-
-
-
-
-
-
-
-
-
-
-
\ No newline at end of file
diff --git a/.idea/libraries/Maven__org_springframework_spring_tx_4_3_13_RELEASE.xml b/.idea/libraries/Maven__org_springframework_spring_tx_4_3_13_RELEASE.xml
deleted file mode 100644
index d56e28f..0000000
--- a/.idea/libraries/Maven__org_springframework_spring_tx_4_3_13_RELEASE.xml
+++ /dev/null
@@ -1,13 +0,0 @@
-
-
-
-
-
-
-
-
-
-
-
-
-
\ No newline at end of file
diff --git a/.idea/workspace.xml b/.idea/workspace.xml
index eab6c50..da426b7 100644
--- a/.idea/workspace.xml
+++ b/.idea/workspace.xml
@@ -2,42 +2,49 @@
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
@@ -118,8 +125,8 @@
-
-
+
+
@@ -128,8 +135,8 @@
-
-
+
+
@@ -139,29 +146,14 @@
-
+
-
-
+
+
-
-
-
-
-
-
-
-
+
-
-
-
-
-
-
-
-
@@ -170,25 +162,26 @@
-
-
+
+
+
+
+
+
-
+
-
-
+
+
-
-
-
-
+
@@ -219,9 +212,9 @@
-
-
+
+
@@ -300,6 +293,9 @@
+
+
+
@@ -340,17 +336,11 @@
-
-
-
-
-
-
@@ -374,7 +364,7 @@
-
+
@@ -396,20 +386,6 @@
-
-
-
-
-
-
-
-
-
-
-
-
-
-
@@ -430,6 +406,12 @@
+
+
+
+
+
+
@@ -464,11 +446,19 @@
-
-
-
-
-
+
+
+
+
+
+
+
+
+
+
+
+
+
@@ -524,30 +514,34 @@
-
+
+
+
-
-
-
+
+
+
-
+
+
-
+
+
@@ -601,7 +595,9 @@
-
+
+
+
@@ -609,6 +605,116 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
@@ -634,10 +740,7 @@
-
-
-
-
+
@@ -647,41 +750,23 @@
-
-
-
-
-
-
-
-
+
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
+
+
+
+
+
@@ -711,10 +796,7 @@
-
-
-
-
+
@@ -724,41 +806,23 @@
-
-
-
-
-
-
-
-
+
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
+
+
+
+
+
@@ -788,10 +852,7 @@
-
-
-
-
+
@@ -820,106 +881,22 @@
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
+
+
+
+
+
+
-
-
+
+
@@ -928,25 +905,53 @@
-
+
-
-
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
-
+
-
-
+
+
-
-
-
-
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/pom.xml b/pom.xml
index 2f344f8..52304f7 100644
--- a/pom.xml
+++ b/pom.xml
@@ -74,20 +74,6 @@
org.springframework.boot
spring-boot-starter-web
-
- org.springframework.boot
- spring-boot-starter-test
- test
-
-
- org.springframework.boot
- spring-boot-starter-data-jpa
-
-
- org.springframework.data
- spring-data-commons
- 2.0.2.RELEASE
-
com.jayway.jsonpath
json-path
@@ -98,15 +84,5 @@
spring-boot
1.5.9.RELEASE
-
- org.springframework.data
- spring-data-rest-core
- 2.6.9.RELEASE
-
-
- org.springframework.data
- spring-data-rest-core
- 2.6.9.RELEASE
-
\ No newline at end of file
diff --git a/restServer.iml b/restServer.iml
index 04d65e2..4b12c8d 100644
--- a/restServer.iml
+++ b/restServer.iml
@@ -17,6 +17,7 @@
+
@@ -30,58 +31,20 @@
+
+
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
+
+
-
-
-
-
-
-
-
\ No newline at end of file
diff --git a/src/main/java/ru/cft/task/restServer/EmailBook.java b/src/main/java/ru/cft/task/restServer/EmailBook.java
index 7d28f9b..49831aa 100644
--- a/src/main/java/ru/cft/task/restServer/EmailBook.java
+++ b/src/main/java/ru/cft/task/restServer/EmailBook.java
@@ -1,8 +1,47 @@
package ru.cft.task.restServer;
-import org.springframework.data.repository.CrudRepository;
-import org.springframework.data.rest.core.annotation.RepositoryRestResource;
+import org.springframework.stereotype.Component;
-@RepositoryRestResource
-public interface EmailBook extends CrudRepository{
+import java.util.ArrayList;
+import java.util.List;
+import java.util.concurrent.atomic.AtomicLong;
+
+@Component
+public class EmailBook {
+ private List book;
+ private final AtomicLong new_id = new AtomicLong();
+
+ public EmailBook() {
+ book = new ArrayList<>();
+ }
+
+ public long addEmailRecord(String name, String email) {
+ long id = new_id.incrementAndGet();
+ book.add(new EmailRecord(id, name, email));
+ return id;
+ }
+
+ public boolean removeEmailRecord(long id) {
+ for (EmailRecord rec : book) {
+ if (rec.getId() == id) {
+ book.remove(rec);
+ return true;
+ }
+ }
+ return false;
+ }
+
+ public int count() {
+ return book.size();
+ }
+
+ public EmailRecord findRec(long id) {
+ for (EmailRecord rec : book) {
+ if (rec.getId() == id) {
+ book.remove(rec);
+ return rec;
+ }
+ }
+ return null;
+ }
}
diff --git a/src/main/java/ru/cft/task/restServer/EmailBookController.java b/src/main/java/ru/cft/task/restServer/EmailBookController.java
index 82f6020..684f715 100644
--- a/src/main/java/ru/cft/task/restServer/EmailBookController.java
+++ b/src/main/java/ru/cft/task/restServer/EmailBookController.java
@@ -6,29 +6,26 @@ import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;
-import java.util.concurrent.atomic.AtomicLong;
@RestController
public class EmailBookController {
- private final AtomicLong new_id = new AtomicLong();
@Autowired
private EmailBook emailBook;
@RequestMapping(method = RequestMethod.POST)
- public EmailRecord addEmailRec(@RequestParam(value = "name", defaultValue = "John Unknown") String name,
- @RequestParam(value = "email", defaultValue = "john@unknown.ru") String email) {
- EmailRecord rec = new EmailRecord(new_id.incrementAndGet(), name, email);
- return rec;
+ public long addEmailRec(@RequestParam(value = "name", defaultValue = "John Unknown") String name,
+ @RequestParam(value = "email", defaultValue = "john@unknown.ru") String email) {
+ return emailBook.addEmailRecord(name, email);
}
@RequestMapping(method = RequestMethod.DELETE)
- public boolean removeEmailRec(@RequestParam(value = "id", required = true) Long id) {
- return true;
+ public boolean removeEmailRec(@RequestParam(value = "id", required = true) long id) {
+ return emailBook.removeEmailRecord(id);
}
@RequestMapping(method = RequestMethod.GET)
- public int sizeBook() {
- return 1;
+ public EmailRecord findEmailRec(@RequestParam(value = "id", required = true) long id) {
+ return emailBook.findRec(id);
}
}
diff --git a/src/main/java/ru/cft/task/restServer/EmailRecord.java b/src/main/java/ru/cft/task/restServer/EmailRecord.java
index 1bcedb9..888b896 100644
--- a/src/main/java/ru/cft/task/restServer/EmailRecord.java
+++ b/src/main/java/ru/cft/task/restServer/EmailRecord.java
@@ -1,29 +1,11 @@
package ru.cft.task.restServer;
-import javax.persistence.Column;
-import javax.persistence.Entity;
-import javax.persistence.GeneratedValue;
-import javax.persistence.Id;
-
-@Entity
public class EmailRecord {
- @Id
- @GeneratedValue
- @Column(name = "id")
private long id;
-
- @Column(name = "name")
private String name;
-
- @Column(name = "email")
private String email;
- public EmailRecord() {
- super();
- }
-
public EmailRecord(long id, String name, String email) {
- super();
this.id = id;
this.name = name;
this.email = email;