diff --git a/.idea/artifacts/LO53_mobile_localization_war.xml b/.idea/artifacts/LO53_mobile_localization_war.xml new file mode 100644 index 0000000..a1056cd --- /dev/null +++ b/.idea/artifacts/LO53_mobile_localization_war.xml @@ -0,0 +1,8 @@ + + + $PROJECT_DIR$/target + + + + + \ No newline at end of file diff --git a/.idea/artifacts/LO53_mobile_localization_war_exploded.xml b/.idea/artifacts/LO53_mobile_localization_war_exploded.xml new file mode 100644 index 0000000..8b5dcfb --- /dev/null +++ b/.idea/artifacts/LO53_mobile_localization_war_exploded.xml @@ -0,0 +1,44 @@ + + + $PROJECT_DIR$/target/mobile_localization-1.0-SNAPSHOT + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/.idea/compiler.xml b/.idea/compiler.xml new file mode 100644 index 0000000..ea77f66 --- /dev/null +++ b/.idea/compiler.xml @@ -0,0 +1,16 @@ + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/.idea/dataSources.xml b/.idea/dataSources.xml new file mode 100644 index 0000000..bd47f4e --- /dev/null +++ b/.idea/dataSources.xml @@ -0,0 +1,27 @@ + + + + + postgresql + true + org.postgresql.Driver + jdbc:postgresql://localhost:5432/LO53 + + + postgresql + true + true + $PROJECT_DIR$/src/main/resources/hibernate.cfg.xml + org.postgresql.Driver + jdbc:postgresql://localhost:5432/LO53 + + + file://$APPLICATION_CONFIG_DIR$/jdbc-drivers/PostgreSQL/9.4-1201/postgresql-9.4-1201.jdbc4.jar + + + file://$APPLICATION_CONFIG_DIR$/jdbc-drivers/PostgreSQL/9.4-1201/postgresql-driver-license.txt + + + + + \ No newline at end of file diff --git a/.idea/dataSources/767b098c-c5bc-42ee-b3bc-d02e521ecc23.xml b/.idea/dataSources/767b098c-c5bc-42ee-b3bc-d02e521ecc23.xml new file mode 100644 index 0000000..6693114 --- /dev/null +++ b/.idea/dataSources/767b098c-c5bc-42ee-b3bc-d02e521ecc23.xml @@ -0,0 +1,251 @@ + + + + + + 30998 + 1 + 1 + + + 2200 + 2017-05-31.07:36:16.132 + 11286 + 1 + 1 + + + 11 + + + 99 + + + 11848 + + + 11849 + + + 12113 + + + 35521 + 11277 + 1 + + + 35523 + 11285 +
+ + 35528 + 11286 +
+ + 35533 + 11284 +
+ + 35541 + 11286 +
+ + 1 + integer|0 + 1 + 11278 + + + 2 + varchar(18)|0 + 11278 + + + 3 + integer|0 + 11278 + + + 35526 + id + 1 + + + 35546 + mac_address + 1 + + + 35527 + id + accesspoint_pkey + 1 + + + 35547 + mac_address + uk_58em6b5lhouv812y1d05nwv9w + + + 35548 + location_id_id + location + location_pkey + id + + + 1 + integer|0 + 1 + 11279 + + + 2 + double precision|0 + 1 + 11279 + + + 3 + double precision|0 + 1 + 11279 + + + 4 + integer|0 + 11279 + + + 35531 + id + 1 + + + 35532 + id + location_pkey + 1 + + + 35553 + map_id + map + map_pkey + id + + + 1 + integer|0 + 1 + 11280 + + + 2 + bytea|0 + 11280 + + + 3 + varchar(100)|0 + 11280 + + + 4 + double precision|0 + 1 + 11280 + + + 5 + double precision|0 + 1 + 11280 + + + 6 + integer|0 + 1 + 11280 + + + 7 + integer|0 + 1 + 11280 + + + 35539 + id + 1 + + + 35540 + id + map_pkey + 1 + + + 1 + integer|0 + 1 + 11281 + + + 2 + integer|0 + 1 + 11281 + + + 3 + integer|0 + 1 + 11281 + + + 4 + double precision|0 + 1 + 11281 + + + 5 + integer|0 + 11281 + + + 6 + integer|0 + 11281 + + + 35544 + accesspointid +locationid + 1 + + + 35545 + accesspointid +locationid + rssi_pkey + 1 + + + 35558 + accesspoint_id + accesspoint + accesspoint_pkey + id + + + 35563 + location_id + location + location_pkey + id + +
+
\ No newline at end of file diff --git a/.idea/dataSources/767b098c-c5bc-42ee-b3bc-d02e521ecc23/_metadata_/metadata b/.idea/dataSources/767b098c-c5bc-42ee-b3bc-d02e521ecc23/_metadata_/metadata new file mode 100644 index 0000000..615afc4 Binary files /dev/null and b/.idea/dataSources/767b098c-c5bc-42ee-b3bc-d02e521ecc23/_metadata_/metadata differ diff --git a/.idea/dataSources/767b098c-c5bc-42ee-b3bc-d02e521ecc23/_metadata_/metadata.keystream b/.idea/dataSources/767b098c-c5bc-42ee-b3bc-d02e521ecc23/_metadata_/metadata.keystream new file mode 100644 index 0000000..e9901a0 Binary files /dev/null and b/.idea/dataSources/767b098c-c5bc-42ee-b3bc-d02e521ecc23/_metadata_/metadata.keystream differ diff --git a/.idea/dataSources/767b098c-c5bc-42ee-b3bc-d02e521ecc23/_metadata_/metadata.keystream.len b/.idea/dataSources/767b098c-c5bc-42ee-b3bc-d02e521ecc23/_metadata_/metadata.keystream.len new file mode 100644 index 0000000..4b05c55 Binary files /dev/null and b/.idea/dataSources/767b098c-c5bc-42ee-b3bc-d02e521ecc23/_metadata_/metadata.keystream.len differ diff --git a/.idea/dataSources/767b098c-c5bc-42ee-b3bc-d02e521ecc23/_metadata_/metadata.len b/.idea/dataSources/767b098c-c5bc-42ee-b3bc-d02e521ecc23/_metadata_/metadata.len new file mode 100644 index 0000000..60e2d8a Binary files /dev/null and b/.idea/dataSources/767b098c-c5bc-42ee-b3bc-d02e521ecc23/_metadata_/metadata.len differ diff --git a/.idea/dataSources/767b098c-c5bc-42ee-b3bc-d02e521ecc23/_metadata_/metadata.values.at b/.idea/dataSources/767b098c-c5bc-42ee-b3bc-d02e521ecc23/_metadata_/metadata.values.at new file mode 100644 index 0000000..1086822 Binary files /dev/null and b/.idea/dataSources/767b098c-c5bc-42ee-b3bc-d02e521ecc23/_metadata_/metadata.values.at differ diff --git a/.idea/dataSources/767b098c-c5bc-42ee-b3bc-d02e521ecc23/_metadata_/metadata_i b/.idea/dataSources/767b098c-c5bc-42ee-b3bc-d02e521ecc23/_metadata_/metadata_i new file mode 100644 index 0000000..22bd9a0 Binary files /dev/null and b/.idea/dataSources/767b098c-c5bc-42ee-b3bc-d02e521ecc23/_metadata_/metadata_i differ diff --git a/.idea/dataSources/767b098c-c5bc-42ee-b3bc-d02e521ecc23/_metadata_/metadata_i.len b/.idea/dataSources/767b098c-c5bc-42ee-b3bc-d02e521ecc23/_metadata_/metadata_i.len new file mode 100644 index 0000000..131e265 Binary files /dev/null and b/.idea/dataSources/767b098c-c5bc-42ee-b3bc-d02e521ecc23/_metadata_/metadata_i.len differ diff --git a/.idea/dataSources/767b098c-c5bc-42ee-b3bc-d02e521ecc23/storage.xml b/.idea/dataSources/767b098c-c5bc-42ee-b3bc-d02e521ecc23/storage.xml new file mode 100644 index 0000000..dcfde27 --- /dev/null +++ b/.idea/dataSources/767b098c-c5bc-42ee-b3bc-d02e521ecc23/storage.xml @@ -0,0 +1,2 @@ + + \ No newline at end of file diff --git a/.idea/dataSources/e8821dd5-920f-4867-a7e5-2a062b734820.xml b/.idea/dataSources/e8821dd5-920f-4867-a7e5-2a062b734820.xml new file mode 100644 index 0000000..950dbf4 --- /dev/null +++ b/.idea/dataSources/e8821dd5-920f-4867-a7e5-2a062b734820.xml @@ -0,0 +1,32 @@ + + + + + + 16454 + 1 + 1 + + + 2200 + 2017-05-04.09:49:48.812 + 1 + 1 + + + 11 + + + 99 + + + 11848 + + + 11849 + + + 12113 + + + \ No newline at end of file diff --git a/.idea/dataSources/e8821dd5-920f-4867-a7e5-2a062b734820/_metadata_/metadata b/.idea/dataSources/e8821dd5-920f-4867-a7e5-2a062b734820/_metadata_/metadata new file mode 100644 index 0000000..dec6903 Binary files /dev/null and b/.idea/dataSources/e8821dd5-920f-4867-a7e5-2a062b734820/_metadata_/metadata differ diff --git a/.idea/dataSources/e8821dd5-920f-4867-a7e5-2a062b734820/_metadata_/metadata.keystream b/.idea/dataSources/e8821dd5-920f-4867-a7e5-2a062b734820/_metadata_/metadata.keystream new file mode 100644 index 0000000..e9901a0 Binary files /dev/null and b/.idea/dataSources/e8821dd5-920f-4867-a7e5-2a062b734820/_metadata_/metadata.keystream differ diff --git a/.idea/dataSources/e8821dd5-920f-4867-a7e5-2a062b734820/_metadata_/metadata.keystream.len b/.idea/dataSources/e8821dd5-920f-4867-a7e5-2a062b734820/_metadata_/metadata.keystream.len new file mode 100644 index 0000000..4b05c55 Binary files /dev/null and b/.idea/dataSources/e8821dd5-920f-4867-a7e5-2a062b734820/_metadata_/metadata.keystream.len differ diff --git a/.idea/dataSources/e8821dd5-920f-4867-a7e5-2a062b734820/_metadata_/metadata.len b/.idea/dataSources/e8821dd5-920f-4867-a7e5-2a062b734820/_metadata_/metadata.len new file mode 100644 index 0000000..60e2d8a Binary files /dev/null and b/.idea/dataSources/e8821dd5-920f-4867-a7e5-2a062b734820/_metadata_/metadata.len differ diff --git a/.idea/dataSources/e8821dd5-920f-4867-a7e5-2a062b734820/_metadata_/metadata.values.at b/.idea/dataSources/e8821dd5-920f-4867-a7e5-2a062b734820/_metadata_/metadata.values.at new file mode 100644 index 0000000..8395350 Binary files /dev/null and b/.idea/dataSources/e8821dd5-920f-4867-a7e5-2a062b734820/_metadata_/metadata.values.at differ diff --git a/.idea/dataSources/e8821dd5-920f-4867-a7e5-2a062b734820/_metadata_/metadata_i b/.idea/dataSources/e8821dd5-920f-4867-a7e5-2a062b734820/_metadata_/metadata_i new file mode 100644 index 0000000..22bd9a0 Binary files /dev/null and b/.idea/dataSources/e8821dd5-920f-4867-a7e5-2a062b734820/_metadata_/metadata_i differ diff --git a/.idea/dataSources/e8821dd5-920f-4867-a7e5-2a062b734820/_metadata_/metadata_i.len b/.idea/dataSources/e8821dd5-920f-4867-a7e5-2a062b734820/_metadata_/metadata_i.len new file mode 100644 index 0000000..131e265 Binary files /dev/null and b/.idea/dataSources/e8821dd5-920f-4867-a7e5-2a062b734820/_metadata_/metadata_i.len differ diff --git a/.idea/dataSources/e8821dd5-920f-4867-a7e5-2a062b734820/storage.xml b/.idea/dataSources/e8821dd5-920f-4867-a7e5-2a062b734820/storage.xml new file mode 100644 index 0000000..dcfde27 --- /dev/null +++ b/.idea/dataSources/e8821dd5-920f-4867-a7e5-2a062b734820/storage.xml @@ -0,0 +1,2 @@ + + \ No newline at end of file diff --git a/.idea/libraries/Maven__antlr_antlr_2_7_7.xml b/.idea/libraries/Maven__antlr_antlr_2_7_7.xml new file mode 100644 index 0000000..b8d93d8 --- /dev/null +++ b/.idea/libraries/Maven__antlr_antlr_2_7_7.xml @@ -0,0 +1,13 @@ + + + + + + + + + + + + + \ No newline at end of file diff --git a/.idea/libraries/Maven__com_fasterxml_classmate_1_3_0.xml b/.idea/libraries/Maven__com_fasterxml_classmate_1_3_0.xml new file mode 100644 index 0000000..073c2de --- /dev/null +++ b/.idea/libraries/Maven__com_fasterxml_classmate_1_3_0.xml @@ -0,0 +1,13 @@ + + + + + + + + + + + + + \ No newline at end of file diff --git a/.idea/libraries/Maven__commons_beanutils_commons_beanutils_1_9_3.xml b/.idea/libraries/Maven__commons_beanutils_commons_beanutils_1_9_3.xml new file mode 100644 index 0000000..687a60e --- /dev/null +++ b/.idea/libraries/Maven__commons_beanutils_commons_beanutils_1_9_3.xml @@ -0,0 +1,13 @@ + + + + + + + + + + + + + \ No newline at end of file diff --git a/.idea/libraries/Maven__commons_collections_commons_collections_3_2_2.xml b/.idea/libraries/Maven__commons_collections_commons_collections_3_2_2.xml new file mode 100644 index 0000000..13afda2 --- /dev/null +++ b/.idea/libraries/Maven__commons_collections_commons_collections_3_2_2.xml @@ -0,0 +1,13 @@ + + + + + + + + + + + + + \ No newline at end of file diff --git a/.idea/libraries/Maven__commons_logging_commons_logging_1_2.xml b/.idea/libraries/Maven__commons_logging_commons_logging_1_2.xml new file mode 100644 index 0000000..eab40b3 --- /dev/null +++ b/.idea/libraries/Maven__commons_logging_commons_logging_1_2.xml @@ -0,0 +1,13 @@ + + + + + + + + + + + + + \ 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 new file mode 100644 index 0000000..14681ee --- /dev/null +++ b/.idea/libraries/Maven__dom4j_dom4j_1_6_1.xml @@ -0,0 +1,13 @@ + + + + + + + + + + + + + \ No newline at end of file diff --git a/.idea/libraries/Maven__javax_annotation_jsr250_api_1_0.xml b/.idea/libraries/Maven__javax_annotation_jsr250_api_1_0.xml new file mode 100644 index 0000000..e367958 --- /dev/null +++ b/.idea/libraries/Maven__javax_annotation_jsr250_api_1_0.xml @@ -0,0 +1,13 @@ + + + + + + + + + + + + + \ No newline at end of file diff --git a/.idea/libraries/Maven__javax_el_el_api_2_2.xml b/.idea/libraries/Maven__javax_el_el_api_2_2.xml new file mode 100644 index 0000000..069511b --- /dev/null +++ b/.idea/libraries/Maven__javax_el_el_api_2_2.xml @@ -0,0 +1,13 @@ + + + + + + + + + + + + + \ No newline at end of file diff --git a/.idea/libraries/Maven__javax_enterprise_cdi_api_1_1.xml b/.idea/libraries/Maven__javax_enterprise_cdi_api_1_1.xml new file mode 100644 index 0000000..d54bc25 --- /dev/null +++ b/.idea/libraries/Maven__javax_enterprise_cdi_api_1_1.xml @@ -0,0 +1,13 @@ + + + + + + + + + + + + + \ No newline at end of file diff --git a/.idea/libraries/Maven__javax_inject_javax_inject_1.xml b/.idea/libraries/Maven__javax_inject_javax_inject_1.xml new file mode 100644 index 0000000..93cf65a --- /dev/null +++ b/.idea/libraries/Maven__javax_inject_javax_inject_1.xml @@ -0,0 +1,13 @@ + + + + + + + + + + + + + \ 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 new file mode 100644 index 0000000..d411041 --- /dev/null +++ b/.idea/libraries/Maven__junit_junit_4_12.xml @@ -0,0 +1,13 @@ + + + + + + + + + + + + + \ No newline at end of file diff --git a/.idea/libraries/Maven__log4j_log4j_1_2_14.xml b/.idea/libraries/Maven__log4j_log4j_1_2_14.xml new file mode 100644 index 0000000..2825a67 --- /dev/null +++ b/.idea/libraries/Maven__log4j_log4j_1_2_14.xml @@ -0,0 +1,13 @@ + + + + + + + + + + + + + \ No newline at end of file diff --git a/.idea/libraries/Maven__org_apache_geronimo_specs_geronimo_jta_1_1_spec_1_1_1.xml b/.idea/libraries/Maven__org_apache_geronimo_specs_geronimo_jta_1_1_spec_1_1_1.xml new file mode 100644 index 0000000..a6f25db --- /dev/null +++ b/.idea/libraries/Maven__org_apache_geronimo_specs_geronimo_jta_1_1_spec_1_1_1.xml @@ -0,0 +1,13 @@ + + + + + + + + + + + + + \ No newline at end of file diff --git a/.idea/libraries/Maven__org_apache_tomcat_tomcat_servlet_api_9_0_0_M15.xml b/.idea/libraries/Maven__org_apache_tomcat_tomcat_servlet_api_9_0_0_M15.xml new file mode 100644 index 0000000..cc77d1b --- /dev/null +++ b/.idea/libraries/Maven__org_apache_tomcat_tomcat_servlet_api_9_0_0_M15.xml @@ -0,0 +1,13 @@ + + + + + + + + + + + + + \ 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 new file mode 100644 index 0000000..f58bbc1 --- /dev/null +++ b/.idea/libraries/Maven__org_hamcrest_hamcrest_core_1_3.xml @@ -0,0 +1,13 @@ + + + + + + + + + + + + + \ 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 new file mode 100644 index 0000000..ce34f42 --- /dev/null +++ b/.idea/libraries/Maven__org_hibernate_common_hibernate_commons_annotations_5_0_1_Final.xml @@ -0,0 +1,13 @@ + + + + + + + + + + + + + \ No newline at end of file diff --git a/.idea/libraries/Maven__org_hibernate_hibernate_annotations_3_5_6_Final.xml b/.idea/libraries/Maven__org_hibernate_hibernate_annotations_3_5_6_Final.xml new file mode 100644 index 0000000..d26bdad --- /dev/null +++ b/.idea/libraries/Maven__org_hibernate_hibernate_annotations_3_5_6_Final.xml @@ -0,0 +1,13 @@ + + + + + + + + + + + + + \ No newline at end of file diff --git a/.idea/libraries/Maven__org_hibernate_hibernate_commons_annotations_3_2_0_Final.xml b/.idea/libraries/Maven__org_hibernate_hibernate_commons_annotations_3_2_0_Final.xml new file mode 100644 index 0000000..dbb890e --- /dev/null +++ b/.idea/libraries/Maven__org_hibernate_hibernate_commons_annotations_3_2_0_Final.xml @@ -0,0 +1,13 @@ + + + + + + + + + + + + + \ No newline at end of file diff --git a/.idea/libraries/Maven__org_hibernate_hibernate_core_5_2_5_Final.xml b/.idea/libraries/Maven__org_hibernate_hibernate_core_5_2_5_Final.xml new file mode 100644 index 0000000..07eb2cd --- /dev/null +++ b/.idea/libraries/Maven__org_hibernate_hibernate_core_5_2_5_Final.xml @@ -0,0 +1,13 @@ + + + + + + + + + + + + + \ No newline at end of file diff --git a/.idea/libraries/Maven__org_hibernate_javax_persistence_hibernate_jpa_2_0_api_1_0_0_Final.xml b/.idea/libraries/Maven__org_hibernate_javax_persistence_hibernate_jpa_2_0_api_1_0_0_Final.xml new file mode 100644 index 0000000..6b42b8a --- /dev/null +++ b/.idea/libraries/Maven__org_hibernate_javax_persistence_hibernate_jpa_2_0_api_1_0_0_Final.xml @@ -0,0 +1,13 @@ + + + + + + + + + + + + + \ 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 new file mode 100644 index 0000000..6492b2b --- /dev/null +++ b/.idea/libraries/Maven__org_hibernate_javax_persistence_hibernate_jpa_2_1_api_1_0_0_Final.xml @@ -0,0 +1,13 @@ + + + + + + + + + + + + + \ No newline at end of file diff --git a/.idea/libraries/Maven__org_javassist_javassist_3_20_0_GA.xml b/.idea/libraries/Maven__org_javassist_javassist_3_20_0_GA.xml new file mode 100644 index 0000000..c21c9b0 --- /dev/null +++ b/.idea/libraries/Maven__org_javassist_javassist_3_20_0_GA.xml @@ -0,0 +1,13 @@ + + + + + + + + + + + + + \ No newline at end of file diff --git a/.idea/libraries/Maven__org_jboss_jandex_2_0_3_Final.xml b/.idea/libraries/Maven__org_jboss_jandex_2_0_3_Final.xml new file mode 100644 index 0000000..b841e21 --- /dev/null +++ b/.idea/libraries/Maven__org_jboss_jandex_2_0_3_Final.xml @@ -0,0 +1,13 @@ + + + + + + + + + + + + + \ No newline at end of file diff --git a/.idea/libraries/Maven__org_jboss_logging_jboss_logging_3_3_0_Final.xml b/.idea/libraries/Maven__org_jboss_logging_jboss_logging_3_3_0_Final.xml new file mode 100644 index 0000000..186d87f --- /dev/null +++ b/.idea/libraries/Maven__org_jboss_logging_jboss_logging_3_3_0_Final.xml @@ -0,0 +1,13 @@ + + + + + + + + + + + + + \ No newline at end of file diff --git a/.idea/libraries/Maven__org_jboss_spec_javax_interceptor_jboss_interceptors_api_1_1_spec_1_0_0_Beta1.xml b/.idea/libraries/Maven__org_jboss_spec_javax_interceptor_jboss_interceptors_api_1_1_spec_1_0_0_Beta1.xml new file mode 100644 index 0000000..8b4d497 --- /dev/null +++ b/.idea/libraries/Maven__org_jboss_spec_javax_interceptor_jboss_interceptors_api_1_1_spec_1_0_0_Beta1.xml @@ -0,0 +1,13 @@ + + + + + + + + + + + + + \ No newline at end of file diff --git a/.idea/libraries/Maven__org_slf4j_slf4j_api_1_5_8.xml b/.idea/libraries/Maven__org_slf4j_slf4j_api_1_5_8.xml new file mode 100644 index 0000000..0ea470a --- /dev/null +++ b/.idea/libraries/Maven__org_slf4j_slf4j_api_1_5_8.xml @@ -0,0 +1,13 @@ + + + + + + + + + + + + + \ No newline at end of file diff --git a/.idea/libraries/Maven__org_slf4j_slf4j_log4j12_1_5_8.xml b/.idea/libraries/Maven__org_slf4j_slf4j_log4j12_1_5_8.xml new file mode 100644 index 0000000..f4725a3 --- /dev/null +++ b/.idea/libraries/Maven__org_slf4j_slf4j_log4j12_1_5_8.xml @@ -0,0 +1,13 @@ + + + + + + + + + + + + + \ No newline at end of file diff --git a/.idea/libraries/Maven__postgresql_postgresql_9_1_901_jdbc4.xml b/.idea/libraries/Maven__postgresql_postgresql_9_1_901_jdbc4.xml new file mode 100644 index 0000000..3e8bb21 --- /dev/null +++ b/.idea/libraries/Maven__postgresql_postgresql_9_1_901_jdbc4.xml @@ -0,0 +1,13 @@ + + + + + + + + + + + + + \ No newline at end of file diff --git a/.idea/misc.xml b/.idea/misc.xml new file mode 100644 index 0000000..5b6a5c4 --- /dev/null +++ b/.idea/misc.xml @@ -0,0 +1,16 @@ + + + + + + + + + + + + \ No newline at end of file diff --git a/.idea/modules.xml b/.idea/modules.xml new file mode 100644 index 0000000..49f819e --- /dev/null +++ b/.idea/modules.xml @@ -0,0 +1,8 @@ + + + + + + + + \ No newline at end of file diff --git a/.idea/uiDesigner.xml b/.idea/uiDesigner.xml new file mode 100644 index 0000000..e96534f --- /dev/null +++ b/.idea/uiDesigner.xml @@ -0,0 +1,124 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/LO53_mobile_localization.iml b/LO53_mobile_localization.iml new file mode 100644 index 0000000..b150b64 --- /dev/null +++ b/LO53_mobile_localization.iml @@ -0,0 +1,65 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/pom.xml b/pom.xml new file mode 100644 index 0000000..cbf63c4 --- /dev/null +++ b/pom.xml @@ -0,0 +1,79 @@ + + + 4.0.0 + + com.utbm.LO53_mobile_localization + mobile_localization + 1.0-SNAPSHOT + war + + + + + org.apache.tomcat.maven + tomcat7-maven-plugin + 2.2 + + http://localhost:8080/ + + + + org.apache.maven.plugins + maven-compiler-plugin + + 1.7 + 1.7 + + + + + + + + org.hibernate + hibernate-core + 5.2.5.Final + + + org.apache.tomcat + tomcat-servlet-api + 9.0.0.M15 + + + org.slf4j + slf4j-log4j12 + 1.5.8 + runtime + + + org.slf4j + slf4j-api + 1.5.8 + + + postgresql + postgresql + 9.1-901.jdbc4 + + + org.hibernate + hibernate-annotations + 3.5.6-Final + + + commons-beanutils + commons-beanutils + 1.9.3 + + + junit + junit + 4.12 + test + + + + + \ No newline at end of file diff --git a/src/main/java/com/lo53_mobile_localization/core/MainClass.java b/src/main/java/com/lo53_mobile_localization/core/MainClass.java new file mode 100644 index 0000000..07869fe --- /dev/null +++ b/src/main/java/com/lo53_mobile_localization/core/MainClass.java @@ -0,0 +1,16 @@ +package com.lo53_mobile_localization.core; + +import com.lo53_mobile_localization.core.util.HibernateUtil; +import org.hibernate.Session; + +/** + * Created by Thomas on 04/05/2017. + */ +public class MainClass { + + public static void main (String[] args){ + + final Session s = HibernateUtil.getSession(); + } + +} diff --git a/src/main/java/com/lo53_mobile_localization/core/entity/AccessPoint.java b/src/main/java/com/lo53_mobile_localization/core/entity/AccessPoint.java new file mode 100644 index 0000000..f0b445d --- /dev/null +++ b/src/main/java/com/lo53_mobile_localization/core/entity/AccessPoint.java @@ -0,0 +1,49 @@ +package com.lo53_mobile_localization.core.entity; + +import javax.persistence.*; +import java.io.Serializable; +import java.util.Collection; + +/** + * Created by Thomas on 03/05/2017. + */ + +@Entity +public class AccessPoint implements Serializable, IEntity{ + + @GeneratedValue + @Id + private int id; + + @Column(unique=true, length = 18) + private String mac_address; + + @OneToOne + private Location location_id; + + public int getId() { + return id; + } + + public void setId(int id) { + this.id = id; + } + + public String getMac_address() { + return mac_address; + } + + public void setMac_address(String mac_address) { + this.mac_address = mac_address; + } + + public Location getLocation_id() { + return location_id; + } + + public void setLocation_id(Location location_id) { + this.location_id = location_id; + } + + +} diff --git a/src/main/java/com/lo53_mobile_localization/core/entity/IEntity.java b/src/main/java/com/lo53_mobile_localization/core/entity/IEntity.java new file mode 100644 index 0000000..9beb4a1 --- /dev/null +++ b/src/main/java/com/lo53_mobile_localization/core/entity/IEntity.java @@ -0,0 +1,8 @@ +package com.lo53_mobile_localization.core.entity; + +/** + * Created by Thomas on 03/05/2017. + */ +public interface IEntity { + int getId(); +} diff --git a/src/main/java/com/lo53_mobile_localization/core/entity/Location.java b/src/main/java/com/lo53_mobile_localization/core/entity/Location.java new file mode 100644 index 0000000..d128085 --- /dev/null +++ b/src/main/java/com/lo53_mobile_localization/core/entity/Location.java @@ -0,0 +1,57 @@ +package com.lo53_mobile_localization.core.entity; + +import javax.persistence.*; +import java.io.Serializable; +import java.util.HashSet; +import java.util.Set; + +/** + * Created by Thomas on 03/05/2017. + */ + +@Entity +public class Location implements Serializable, IEntity{ + + @GeneratedValue + @Id + private int id; + + private double x; + + private double y; + + @ManyToOne + private Map map; + + public int getId() { + return id; + } + + public void setId(int id) { + this.id = id; + } + + public double getX() { + return x; + } + + public void setX(double x) { + this.x = x; + } + + public double getY() { + return y; + } + + public void setY(double y) { + this.y = y; + } + + public Map getMap() { + return map; + } + + public void setMap(Map map) { + this.map = map; + } +} diff --git a/src/main/java/com/lo53_mobile_localization/core/entity/Map.java b/src/main/java/com/lo53_mobile_localization/core/entity/Map.java new file mode 100644 index 0000000..9b10dfb --- /dev/null +++ b/src/main/java/com/lo53_mobile_localization/core/entity/Map.java @@ -0,0 +1,85 @@ +package com.lo53_mobile_localization.core.entity; + +import javax.persistence.*; +import java.io.Serializable; + +/** + * Created by Thomas on 03/05/2017. + */ +@Entity +public class Map implements Serializable, IEntity{ + + @GeneratedValue + @Id + private int id; + + @Column(length = 100) + private String description; + + private int px_width; + + private int px_height; + + private double m_width; + + private double m_height; + + private byte [] content; + + + public int getId() { + return id; + } + + public void setId(int id) { + this.id = id; + } + + public String getDescription() { + return description; + } + + public void setDescription(String description) { + this.description = description; + } + + public int getPx_width() { + return px_width; + } + + public void setPx_width(int px_width) { + this.px_width = px_width; + } + + public int getPx_height() { + return px_height; + } + + public void setPx_height(int px_height) { + this.px_height = px_height; + } + + public double getM_width() { + return m_width; + } + + public void setM_width(double m_width) { + this.m_width = m_width; + } + + public double getM_height() { + return m_height; + } + + public void setM_height(double m_height) { + this.m_height = m_height; + } + + public byte[] getContent() { + return content; + } + + public void setContent(byte[] content) { + this.content = content; + } +} diff --git a/src/main/java/com/lo53_mobile_localization/core/entity/Rssi.java b/src/main/java/com/lo53_mobile_localization/core/entity/Rssi.java new file mode 100644 index 0000000..02f03d5 --- /dev/null +++ b/src/main/java/com/lo53_mobile_localization/core/entity/Rssi.java @@ -0,0 +1,65 @@ +package com.lo53_mobile_localization.core.entity; + +import javax.persistence.*; +import java.io.Serializable; + +/** + * Created by Thomas on 03/05/2017. + */ + +@Entity +public class Rssi implements Serializable { + + @EmbeddedId + private RssiID id; + + @MapsId("locationId") + @JoinColumn(name = "location_id") + @OneToOne + private Location location; + + @MapsId("accessPointId") + @JoinColumn(name = "accessPoint_id") + @OneToOne + private AccessPoint accessPoint; + + private double value; + + private int occurences; + + public double getValue() { + return value; + } + + public void setValue(double value) { + this.value = value; + } + + public int getOccurences() { + return occurences; + } + + public void setOccurences(int occurences) { + this.occurences = occurences; + } + + public RssiID getId() { + return id; + } + + public Location getLocation() { + return location; + } + + public void setLocation(Location location) { + this.location = location; + } + + public AccessPoint getAccessPoint() { + return accessPoint; + } + + public void setAccessPoint(AccessPoint accessPoint) { + this.accessPoint = accessPoint; + } +} diff --git a/src/main/java/com/lo53_mobile_localization/core/entity/RssiID.java b/src/main/java/com/lo53_mobile_localization/core/entity/RssiID.java new file mode 100644 index 0000000..5473651 --- /dev/null +++ b/src/main/java/com/lo53_mobile_localization/core/entity/RssiID.java @@ -0,0 +1,34 @@ +package com.lo53_mobile_localization.core.entity; + +import javax.persistence.Column; +import javax.persistence.Embeddable; +import java.io.Serializable; + +/** + * Created by Thomas on 18/05/2017. + */ + +@Embeddable +public class RssiID implements Serializable { + + @Column(name = "location_id") + private int locationId; + @Column(name = "accessPoint_id") + private int accessPointId; + + public int getLocationId() { + return locationId; + } + + public void setLocationId(int locationId) { + this.locationId = locationId; + } + + public int getAccessPointId() { + return accessPointId; + } + + public void setAccessPointId(int accessPointId) { + this.accessPointId = accessPointId; + } +} diff --git a/src/main/java/com/lo53_mobile_localization/core/repository/AccessPointDAO.java b/src/main/java/com/lo53_mobile_localization/core/repository/AccessPointDAO.java new file mode 100644 index 0000000..136cf88 --- /dev/null +++ b/src/main/java/com/lo53_mobile_localization/core/repository/AccessPointDAO.java @@ -0,0 +1,15 @@ +package com.lo53_mobile_localization.core.repository; + +import com.lo53_mobile_localization.core.entity.AccessPoint; + +/** + * Created by Thomas on 10/05/2017. + */ +public class AccessPointDAO extends DefaultDAO{ + + public AccessPointDAO() { + super(); + entityType = AccessPoint.class; + } + +} diff --git a/src/main/java/com/lo53_mobile_localization/core/repository/DefaultDAO.java b/src/main/java/com/lo53_mobile_localization/core/repository/DefaultDAO.java new file mode 100644 index 0000000..9242f2c --- /dev/null +++ b/src/main/java/com/lo53_mobile_localization/core/repository/DefaultDAO.java @@ -0,0 +1,139 @@ +package com.lo53_mobile_localization.core.repository; + +import com.lo53_mobile_localization.core.entity.IEntity; +import com.lo53_mobile_localization.core.util.HibernateUtil; +import org.hibernate.HibernateException; +import org.apache.commons.beanutils.BeanUtils; +import org.hibernate.Session; +import org.hibernate.Transaction; +import org.hibernate.query.Query; +import org.slf4j.Logger; + +import java.lang.reflect.InvocationTargetException; +import java.util.List; + +/** + * Created by Thomas on 10/05/2017. + */ +public abstract class DefaultDAO { + + protected Logger LOGGER; + protected Class entityType; + + /** + * To insert an entity into the database + * @param entity + */ + public void insertEntity(T entity) { + Session session = HibernateUtil.getSession(); + Transaction tr = session.getTransaction(); + try { + tr.begin(); + session.persist(entity); + tr.commit(); + } catch(Exception e) { + LOGGER.error("error in insertEntity: " + e); + if(tr != null) + tr.rollback(); + throw e; + } + } + + /** + * To update an entity into the database + * @param id + * @param entity + */ + public void updateEntity(int id, T entity) throws Exception { + + T storedEntity = getEntity(id); + + try { + BeanUtils.copyProperties(storedEntity, entity); + } catch (IllegalAccessException|InvocationTargetException e) { + LOGGER.error("error in updateEntity: " + e); + throw e; + } + + Session session = HibernateUtil.getSession(); + Transaction tr = session.getTransaction(); + try { + tr.begin(); + session.update(entity); + tr.commit(); + } catch(Exception e) { + LOGGER.error("error in updateEntity: " + e); + if(tr != null) + tr.rollback(); + throw e; + } + } + + /** + * To remove an entity into the database + * @param id + */ + public void removeEntity(int id) throws Exception { + IEntity entity = getEntity(id); + + Session session = HibernateUtil.getSession(); + Transaction tr = session.getTransaction(); + try { + tr.begin(); + session.delete(entity); + tr.commit(); + } catch(Exception e) { + LOGGER.error("error in removeEntity: " + e); + if(tr != null) + tr.rollback(); + throw e; + } + } + + /** + * To get an entity from its id and class + * @param id + * @return + */ + @SuppressWarnings(value="unchecked") + public T getEntity(int id) throws Exception { + T entity = null; + + Session session = HibernateUtil.getSession(); + Transaction tr = session.getTransaction(); + try { + tr.begin(); + entity = (T) session.get(entityType.getCanonicalName(), id); + tr.commit(); + } catch(Exception e) { + LOGGER.error("error in getEntity: " + e); + if(tr != null) + tr.rollback(); + throw e; + } + + return entity; + } + + /** + * To get all entities + * @return + */ + public List getEntities() throws Exception { + List listEntities = null; + + Session session = HibernateUtil.getSession(); + try { + Query query = session.createQuery("from " + entityType.getCanonicalName()); + listEntities = query.list(); + }catch (HibernateException e) { + LOGGER.error("error in getEntities: " + e); + throw e; + } + return listEntities; + } + + + + +} diff --git a/src/main/java/com/lo53_mobile_localization/core/repository/LocationDAO.java b/src/main/java/com/lo53_mobile_localization/core/repository/LocationDAO.java new file mode 100644 index 0000000..b1129e0 --- /dev/null +++ b/src/main/java/com/lo53_mobile_localization/core/repository/LocationDAO.java @@ -0,0 +1,17 @@ +package com.lo53_mobile_localization.core.repository; + +import com.lo53_mobile_localization.core.entity.Location; + +import java.util.List; + +/** + * Created by Thomas on 10/05/2017. + */ +public class LocationDAO extends DefaultDAO { + + public LocationDAO() { + super(); + entityType = Location.class; + } + +} diff --git a/src/main/java/com/lo53_mobile_localization/core/repository/MapDAO.java b/src/main/java/com/lo53_mobile_localization/core/repository/MapDAO.java new file mode 100644 index 0000000..1315159 --- /dev/null +++ b/src/main/java/com/lo53_mobile_localization/core/repository/MapDAO.java @@ -0,0 +1,19 @@ +package com.lo53_mobile_localization.core.repository; + +import com.lo53_mobile_localization.core.entity.AccessPoint; +import com.lo53_mobile_localization.core.entity.IEntity; +import com.lo53_mobile_localization.core.entity.Map; + +import java.util.List; + +/** + * Created by Thomas on 10/05/2017. + */ +public class MapDAO extends DefaultDAO { + + + public MapDAO() { + super(); + entityType = Map.class; + } +} diff --git a/src/main/java/com/lo53_mobile_localization/core/repository/RSSIDAO.java b/src/main/java/com/lo53_mobile_localization/core/repository/RSSIDAO.java new file mode 100644 index 0000000..3f1efc8 --- /dev/null +++ b/src/main/java/com/lo53_mobile_localization/core/repository/RSSIDAO.java @@ -0,0 +1,156 @@ +package com.lo53_mobile_localization.core.repository; + +import com.lo53_mobile_localization.core.entity.Rssi; +import com.lo53_mobile_localization.core.entity.RssiID; +import com.lo53_mobile_localization.core.util.HibernateUtil; +import org.apache.commons.beanutils.BeanUtils; +import org.hibernate.HibernateException; +import org.hibernate.Session; +import org.hibernate.Transaction; +import org.hibernate.query.Query; +import org.slf4j.Logger; + +import javax.persistence.EntityManager; +import javax.persistence.EntityManagerFactory; +import javax.persistence.EntityTransaction; +import javax.persistence.Persistence; +import java.lang.reflect.InvocationTargetException; +import java.util.List; + + +/** + * Created by Thomas on 10/05/2017. + */ +public class RSSIDAO { + + protected Logger LOGGER; + protected EntityManagerFactory emf = Persistence.createEntityManagerFactory("rssi"); + protected EntityManager em = emf.createEntityManager(); + + public RSSIDAO() { + super(); + } + + /** + * To insert an entity into the database + * @param entity + */ + public void insertEntity(Rssi entity) { + Session session = HibernateUtil.getSession(); + EntityTransaction entr = em.getTransaction(); + try { + entr.begin(); + session.persist(entity); + entr.commit(); + } catch(Exception e) { + LOGGER.error("error in insertEntity: " + e); + if(entr != null) + entr.rollback(); + throw e; + } + } + + /** + * To update an entity into the database + * @param id + * @param entity + */ + public void updateEntity(RssiID id, Rssi entity) throws Exception { + + Rssi storedEntity = getEntity(id); + + try { + BeanUtils.copyProperties(storedEntity, entity); + } catch (IllegalAccessException|InvocationTargetException e) { + LOGGER.error("error in updateEntity: " + e); + throw e; + } + + Session session = HibernateUtil.getSession(); + Transaction tr = session.getTransaction(); + try { + tr.begin(); + session.update(entity); + tr.commit(); + } catch(Exception e) { + LOGGER.error("error in updateEntity: " + e); + if(tr != null) + tr.rollback(); + throw e; + } + } + + /** + * To remove an entity into the database + * @param id + */ + public void removeEntity(RssiID id) throws Exception { + + Rssi entity = getEntity(id); + + Session session = HibernateUtil.getSession(); + Transaction tr = session.getTransaction(); + try { + tr.begin(); + session.delete(entity); + tr.commit(); + } catch(Exception e) { + LOGGER.error("error in removeEntity: " + e); + if(tr != null) + tr.rollback(); + throw e; + } + } + + /** + * To get an entity from its id and class + * @param id + * @return + */ + @SuppressWarnings(value="unchecked") + public Rssi getEntity(RssiID id) throws Exception { + Rssi entity = null; + + Session session = HibernateUtil.getSession(); + Transaction tr = session.getTransaction(); + try { + tr.begin(); + String hql = "From Rssi r where r.id.locationId = :locationId AND r.id.accessPointId = :accessPointId"; + + + + String strLocId = Integer.toString(id.getLocationId()); + String strApId = Integer.toString(id.getAccessPointId()); + Query query = HibernateUtil.getSession().createQuery(hql); + query.setParameter("locationId",strApId); + query.setParameter("accessPointId", strApId); + entity = (Rssi)query.getSingleResult(); + tr.commit(); + } catch(Exception e) { + LOGGER.error("error in getEntity: " + e); + if(tr != null) + tr.rollback(); + throw e; + } + return entity; + } + + /** + * To get all entities + * @return + */ + public List getEntities() throws Exception { + List listEntities = null; + + Session session = HibernateUtil.getSession(); + try { + Query query = session.createQuery("from Rssi"); + listEntities = query.list(); + }catch (HibernateException e) { + LOGGER.error("error in getEntities: " + e); + throw e; + } + return listEntities; + } + +} diff --git a/src/main/java/com/lo53_mobile_localization/core/service/AccessPointService.java b/src/main/java/com/lo53_mobile_localization/core/service/AccessPointService.java new file mode 100644 index 0000000..bb41ebc --- /dev/null +++ b/src/main/java/com/lo53_mobile_localization/core/service/AccessPointService.java @@ -0,0 +1,40 @@ +package com.lo53_mobile_localization.core.service; + +import com.lo53_mobile_localization.core.entity.AccessPoint; +import com.lo53_mobile_localization.core.entity.IEntity; +import com.lo53_mobile_localization.core.repository.AccessPointDAO; + +import java.util.List; + +/** + * Created by Thomas on 10/05/2017. + */ +public class AccessPointService implements IService{ + + + protected AccessPointDAO accessPointDAO; + + public AccessPointService(){ + this.accessPointDAO = new AccessPointDAO(); + } + + public void storeEntity(IEntity entity) { + this.accessPointDAO.insertEntity((AccessPoint) entity); + } + + public void updateEntity(int id, IEntity entity) throws Exception { + this.accessPointDAO.updateEntity(id, (AccessPoint) entity); + } + + public void removeEntity(int id) throws Exception { + this.accessPointDAO.removeEntity(id); + } + + public IEntity getEntity(int id) throws Exception { + return this.accessPointDAO.getEntity(id); + } + + public List getEntities() throws Exception { + return this.accessPointDAO.getEntities(); + } +} diff --git a/src/main/java/com/lo53_mobile_localization/core/service/IService.java b/src/main/java/com/lo53_mobile_localization/core/service/IService.java new file mode 100644 index 0000000..503ff78 --- /dev/null +++ b/src/main/java/com/lo53_mobile_localization/core/service/IService.java @@ -0,0 +1,43 @@ +package com.lo53_mobile_localization.core.service; + +import com.lo53_mobile_localization.core.entity.IEntity; + +import java.util.List; + +/** + * Created by Thomas on 10/05/2017. + */ +public interface IService { + + /** + * To store an entity + * @param entity + */ + void storeEntity(IEntity entity); + + /** + * To update an entity + * @param id + * @param entity + */ + void updateEntity(int id, final IEntity entity) throws Exception; + + /** + * To remove an entity + * @param id + */ + void removeEntity(int id) throws Exception; + + /** + * To get an entity by his id + * @param id + * @return + */ + IEntity getEntity(int id) throws Exception; + + /** + * To get the list of entities + * @return + */ + List getEntities() throws Exception; +} diff --git a/src/main/java/com/lo53_mobile_localization/core/service/LocationService.java b/src/main/java/com/lo53_mobile_localization/core/service/LocationService.java new file mode 100644 index 0000000..ee04574 --- /dev/null +++ b/src/main/java/com/lo53_mobile_localization/core/service/LocationService.java @@ -0,0 +1,40 @@ +package com.lo53_mobile_localization.core.service; + +import com.lo53_mobile_localization.core.entity.IEntity; +import com.lo53_mobile_localization.core.entity.Location; +import com.lo53_mobile_localization.core.repository.LocationDAO; + +import java.util.List; + +/** + * Created by Thomas on 10/05/2017. + */ +public class LocationService implements IService { + + + protected LocationDAO locationDAO; + + public LocationService(){ + this.locationDAO = new LocationDAO(); + } + + public void storeEntity(IEntity entity) { + this.locationDAO.insertEntity((Location) entity); + } + + public void updateEntity(int id, IEntity entity) throws Exception { + this.locationDAO.updateEntity(id, (Location) entity); + } + + public void removeEntity(int id) throws Exception { + this.locationDAO.removeEntity(id); + } + + public IEntity getEntity(int id) throws Exception { + return this.locationDAO.getEntity(id); + } + + public List getEntities() throws Exception { + return this.locationDAO.getEntities(); + } +} diff --git a/src/main/java/com/lo53_mobile_localization/core/service/MapService.java b/src/main/java/com/lo53_mobile_localization/core/service/MapService.java new file mode 100644 index 0000000..e1eb0d3 --- /dev/null +++ b/src/main/java/com/lo53_mobile_localization/core/service/MapService.java @@ -0,0 +1,40 @@ +package com.lo53_mobile_localization.core.service; + + +import com.lo53_mobile_localization.core.entity.IEntity; +import com.lo53_mobile_localization.core.entity.Map; +import com.lo53_mobile_localization.core.repository.MapDAO; + +import java.util.List; + +/** + * Created by Thomas on 10/05/2017. + */ +public class MapService implements IService { + + protected MapDAO mapDAO; + + public MapService(){ + this.mapDAO = new MapDAO(); + } + + public void storeEntity(IEntity entity) { + this.mapDAO.insertEntity((Map) entity); + } + + public void updateEntity(int id, IEntity entity) throws Exception { + this.mapDAO.updateEntity(id, (Map) entity); + } + + public void removeEntity(int id) throws Exception { + this.mapDAO.removeEntity(id); + } + + public IEntity getEntity(int id) throws Exception { + return this.mapDAO.getEntity(id); + } + + public List getEntities() throws Exception { + return this.mapDAO.getEntities(); + } +} diff --git a/src/main/java/com/lo53_mobile_localization/core/service/RSSIService.java b/src/main/java/com/lo53_mobile_localization/core/service/RSSIService.java new file mode 100644 index 0000000..28ee969 --- /dev/null +++ b/src/main/java/com/lo53_mobile_localization/core/service/RSSIService.java @@ -0,0 +1,41 @@ +package com.lo53_mobile_localization.core.service; + +import com.lo53_mobile_localization.core.entity.IEntity; +import com.lo53_mobile_localization.core.entity.Rssi; +import com.lo53_mobile_localization.core.entity.RssiID; +import com.lo53_mobile_localization.core.repository.RSSIDAO; + +import java.util.List; + +/** + * Created by Thomas on 10/05/2017. + */ +public class RSSIService { + + + protected RSSIDAO rssi_recordDAO; + + public RSSIService(){ + this.rssi_recordDAO = new RSSIDAO(); + } + + public void storeEntity(Rssi entity) { + this.rssi_recordDAO.insertEntity((Rssi) entity); + } + + public void updateEntity(RssiID id, Rssi entity) throws Exception { + this.rssi_recordDAO.updateEntity(id, (Rssi) entity); + } + + public void removeEntity(RssiID id) throws Exception { + this.rssi_recordDAO.removeEntity(id); + } + + public Rssi getEntity(RssiID id) throws Exception { + return this.rssi_recordDAO.getEntity(id); + } + + public List getEntities() throws Exception { + return this.rssi_recordDAO.getEntities(); + } +} diff --git a/src/main/java/com/lo53_mobile_localization/core/servlet/CalibrationServlet.java b/src/main/java/com/lo53_mobile_localization/core/servlet/CalibrationServlet.java new file mode 100644 index 0000000..2932782 --- /dev/null +++ b/src/main/java/com/lo53_mobile_localization/core/servlet/CalibrationServlet.java @@ -0,0 +1,42 @@ +package com.lo53_mobile_localization.core.servlet; + +import javax.servlet.http.HttpServlet; +import java.io.BufferedReader; +import java.io.FileReader; +import java.io.IOException; + +/** + * Created by Thomas on 18/05/2017. + */ +public class CalibrationServlet extends HttpServlet { + + + + + + private String getMacAdressFromArpTable(String ip) throws IOException { + // Open the ARP table too look up for this IP + BufferedReader in = new BufferedReader(new FileReader("/proc/net/arp")); + String strLine; + String macAddr = null; + + // Read File Line By Line + while ((strLine = in.readLine()) != null) { + // Find the matching IP + System.out.println(strLine); + if (strLine.contains(ip)) { + // Split the line + String[] table = strLine.split(" "); + // Retrieve the MAC Address + //macAddr = table[24]; + for (int i = 0; i < table.length; i++) { + if (table[i].length() == 17) + macAddr = table[i]; + //System.out.println("Table["+i+"] : "+table[i]); + } + } + } + return macAddr; + } + +} diff --git a/src/main/java/com/lo53_mobile_localization/core/util/HibernateUtil.java b/src/main/java/com/lo53_mobile_localization/core/util/HibernateUtil.java new file mode 100644 index 0000000..7e6155a --- /dev/null +++ b/src/main/java/com/lo53_mobile_localization/core/util/HibernateUtil.java @@ -0,0 +1,46 @@ +package com.lo53_mobile_localization.core.util; + +import org.hibernate.Session; +import org.hibernate.SessionFactory; +import org.hibernate.cfg.Configuration; + +/** + * Hibernate Utility class with a convenient method to get an open session. + */ +public class HibernateUtil { + + private static SessionFactory sessionFactory; + private static Session session = null; + + public static SessionFactory getSessionFactory() { + if(sessionFactory == null) { + sessionFactory = buildSessionFactory(); + } + return sessionFactory; + } + + private static SessionFactory buildSessionFactory() { + try { + // Create the SessionFactory from hibernate.cfg.xml + return new Configuration().configure().buildSessionFactory(); + } catch (Throwable ex) { + System.err.println( "Initial SessionFactory creation failed." + ex ); + throw new ExceptionInInitializerError(ex); + } + } + + public static void setSessionFactory(SessionFactory _sessionFactory) { + sessionFactory = _sessionFactory; + } + + public static Session getSession(){ + if(session == null || !session.isOpen()) { + session = getSessionFactory().openSession(); + } + return session; + } + + public static void setSession(Session _session) { + session = _session; + } +} \ No newline at end of file diff --git a/src/main/resources/hibernate.cfg.xml b/src/main/resources/hibernate.cfg.xml new file mode 100644 index 0000000..b6e1320 --- /dev/null +++ b/src/main/resources/hibernate.cfg.xml @@ -0,0 +1,27 @@ + + + + + + org.hibernate.dialect.PostgreSQL82Dialect + org.postgresql.Driver + postgres + + jdbc:postgresql://localhost:5432/LO53 + + 1 + create + + true + + + + + + + + + + \ No newline at end of file diff --git a/src/test/java/com/lo53_mobile_localization/core/helpers/HibernateTestHelper.java b/src/test/java/com/lo53_mobile_localization/core/helpers/HibernateTestHelper.java new file mode 100644 index 0000000..3dc381d --- /dev/null +++ b/src/test/java/com/lo53_mobile_localization/core/helpers/HibernateTestHelper.java @@ -0,0 +1,43 @@ +package com.lo53_mobile_localization.core.helpers; + +import com.lo53_mobile_localization.core.util.HibernateUtil; +import org.hibernate.SessionFactory; +import org.hibernate.cfg.Configuration; +import org.junit.After; +import org.junit.Before; + +/** + * Created by Thomas on 10/05/2017. + */ +public class HibernateTestHelper { + + @Before + public void setUp() throws Exception { + Configuration configuration = createTestingConfiguration(); + + SessionFactory sessionFactory = configuration.buildSessionFactory(); + HibernateUtil.setSessionFactory(sessionFactory); + } + + + protected Configuration createTestingConfiguration() { + Configuration configuration = new Configuration(); + configuration.configure(); + + configuration.setProperty("hibernate.dialect", "org.hibernate.dialect.PostgreSQL82Dialect"); + configuration.setProperty("hibernate.connection.driver_class", "org.postgresql.Driver"); + configuration.setProperty("hibernate.connection.username", "postgres"); + configuration.setProperty("hibernate.connection.password", ""); + configuration.setProperty("hibernate.connection.url", "jdbc:postgresql://localhost:5432/LO53"); + configuration.setProperty("hibernate.hbm2ddl.auto", "create"); + + return configuration; + } + + @After + public void tearDown() throws Exception { + if(HibernateUtil.getSession().isOpen()) + HibernateUtil.getSession().close(); + } + +} diff --git a/src/test/java/com/lo53_mobile_localization/core/service/AccessPointServiceTest.java b/src/test/java/com/lo53_mobile_localization/core/service/AccessPointServiceTest.java new file mode 100644 index 0000000..db82c2b --- /dev/null +++ b/src/test/java/com/lo53_mobile_localization/core/service/AccessPointServiceTest.java @@ -0,0 +1,63 @@ +package com.lo53_mobile_localization.core.service; + +import com.lo53_mobile_localization.core.entity.AccessPoint; +import com.lo53_mobile_localization.core.entity.IEntity; +import com.lo53_mobile_localization.core.entity.Location; +import com.lo53_mobile_localization.core.repository.AccessPointDAO; +import com.lo53_mobile_localization.core.repository.LocationDAO; +import org.junit.Before; +import org.junit.Test; + +import java.util.ArrayList; + +import static org.junit.Assert.assertEquals; + +/** + * Created by Thomas on 10/05/2017. + */ +public class AccessPointServiceTest extends BaseServiceTest{ + + @Before + public void setUp() throws Exception { + super.setUp(); + service = new AccessPointService(); + + AccessPoint ap = new AccessPoint(); + + //ap.setMac_address("00:00:00:00:00:00"); + //ap.setLocation_id(genLocation()); + + AccessPointDAO accessPointDAO = new AccessPointDAO(); + accessPointDAO.insertEntity(ap); + + item = ap; + } + + protected ArrayList storeMultipleTestingItems(int nbItems) throws Exception { + ArrayList aps = new ArrayList<>(); + + int startingId = 1; + for(int i = startingId; i < nbItems + startingId; i++) { + AccessPoint testingAP = new AccessPoint(); + testingAP.setMac_address("AA:AA:AA:AA:AA:A" + i); + testingAP.setLocation_id(genLocation()); + + service.storeEntity(testingAP); + aps.add(testingAP); + } + + return aps; + } + + @Test + public void updateEntity() throws Exception { + AccessPoint ap = (AccessPoint) item; + ap.setMac_address("ZZ:ZZ:ZZ:ZZ:ZZ:ZZ"); + service.updateEntity(ap.getId(), ap); + + AccessPoint storedClient = (AccessPoint) service.getEntity(ap.getId()); + assertEquals(ap.getMac_address(), storedClient.getMac_address()); + } + + +} diff --git a/src/test/java/com/lo53_mobile_localization/core/service/BaseServiceTest.java b/src/test/java/com/lo53_mobile_localization/core/service/BaseServiceTest.java new file mode 100644 index 0000000..25efb18 --- /dev/null +++ b/src/test/java/com/lo53_mobile_localization/core/service/BaseServiceTest.java @@ -0,0 +1,104 @@ +package com.lo53_mobile_localization.core.service; + +import com.lo53_mobile_localization.core.entity.AccessPoint; +import com.lo53_mobile_localization.core.entity.IEntity; +import com.lo53_mobile_localization.core.entity.Location; +import com.lo53_mobile_localization.core.entity.Map; +import com.lo53_mobile_localization.core.helpers.HibernateTestHelper; + +import com.lo53_mobile_localization.core.repository.AccessPointDAO; +import com.lo53_mobile_localization.core.repository.LocationDAO; +import com.lo53_mobile_localization.core.repository.MapDAO; +import org.junit.Test; + +import java.util.ArrayList; + +import static org.junit.Assert.assertEquals; +import static org.junit.Assert.assertTrue; + +/** + * Created by Thomas on 10/05/2017. + */ +public abstract class BaseServiceTest extends HibernateTestHelper { + + protected IService service; + protected IEntity item; + + @Test + public void storeEntity() throws Exception { + IEntity testingItem = storeMultipleTestingItems(1).get(0); + + assertTrue(service.getEntities().contains(testingItem)); + } + + protected abstract ArrayList storeMultipleTestingItems(int nbItems) throws Exception; + + @Test + public void removeEntity() throws Exception { + service.removeEntity(item.getId()); + assertEquals(0, service.getEntities().size()); + } + + + @Test + public void getEntity() throws Exception { + IEntity storedItem = service.getEntity(item.getId()); + assertEquals(item, storedItem); + } + + @Test + public void getEntities() throws Exception { + ArrayList addedItems = storeMultipleTestingItems(10); + ArrayList storedItems = (ArrayList) service.getEntities(); + + assertEquals(1 + addedItems.size(), storedItems.size()); + assertTrue(storedItems.contains(item)); + assertTrue(storedItems.containsAll(addedItems)); + } + + protected Map genMap(){ + + MapDAO mapDAO = new MapDAO(); + + Map map = new Map(); + map.setM_width(5); + map.setM_height(5); + map.setPx_height(10); + map.setPx_width(10); + map.setDescription("DescriptionTest" + 0); + + try { + mapDAO.insertEntity(map); + } catch (Exception ignored) {} + return map; + } + + protected Location genLocation() { + LocationDAO locationDAO = new LocationDAO(); + + Location location = new Location(); + location.setX(5); + location.setY(8); + + try { + locationDAO.insertEntity(location); + } catch (Exception ignored) {} + return location; + } + + protected AccessPoint genAP(){ + + AccessPointDAO apDAO = new AccessPointDAO(); + + AccessPoint ap = new AccessPoint(); + ap.setLocation_id(genLocation()); + ap.setMac_address("BB:BB:BB:BB:BB:BB"); + + try { + apDAO.insertEntity(ap); + }catch (Exception ignored){} + + return ap; + } + +} diff --git a/src/test/java/com/lo53_mobile_localization/core/service/LocationServiceTest.java b/src/test/java/com/lo53_mobile_localization/core/service/LocationServiceTest.java new file mode 100644 index 0000000..1fb457c --- /dev/null +++ b/src/test/java/com/lo53_mobile_localization/core/service/LocationServiceTest.java @@ -0,0 +1,63 @@ +package com.lo53_mobile_localization.core.service; + +import com.lo53_mobile_localization.core.entity.IEntity; +import com.lo53_mobile_localization.core.entity.Location; +import com.lo53_mobile_localization.core.entity.Map; +import com.lo53_mobile_localization.core.repository.LocationDAO; +import com.lo53_mobile_localization.core.repository.MapDAO; +import org.junit.Before; +import org.junit.Test; + +import java.util.ArrayList; + +import static org.junit.Assert.assertEquals; + +/** + * Created by Thomas on 10/05/2017. + */ +public class LocationServiceTest extends BaseServiceTest { + + @Before + public void setUp() throws Exception { + super.setUp(); + service = new LocationService(); + + Location loc = new Location(); + loc.setMap(genMap()); + loc.setX(7); + loc.setY(7); + + LocationDAO locationDAO = new LocationDAO(); + locationDAO.insertEntity(loc); + + item = loc; + } + + protected ArrayList storeMultipleTestingItems(int nbItems) throws Exception { + ArrayList locs = new ArrayList<>(); + + int startingId = 1; + for(int i = startingId; i < nbItems + startingId; i++) { + Location testingLoc = new Location(); + testingLoc.setMap(genMap()); + testingLoc.setX(i); + testingLoc.setY(i); + + service.storeEntity(testingLoc); + locs.add(testingLoc); + } + + return locs; + } + + @SuppressWarnings("deprecation") + @Test + public void updateEntity() throws Exception { + Location loc = (Location) item; + loc.setY(100); + service.updateEntity(loc.getId(), loc); + + Location storedClient = (Location) service.getEntity(loc.getId()); + assertEquals((int)loc.getY(), (int)storedClient.getY()); + } +} diff --git a/src/test/java/com/lo53_mobile_localization/core/service/MapServiceTest.java b/src/test/java/com/lo53_mobile_localization/core/service/MapServiceTest.java new file mode 100644 index 0000000..4623e8d --- /dev/null +++ b/src/test/java/com/lo53_mobile_localization/core/service/MapServiceTest.java @@ -0,0 +1,59 @@ +package com.lo53_mobile_localization.core.service; + +import com.lo53_mobile_localization.core.entity.IEntity; +import com.lo53_mobile_localization.core.entity.Map; +import com.lo53_mobile_localization.core.repository.MapDAO; +import org.junit.Before; +import org.junit.Test; + +import java.util.ArrayList; + +import static org.junit.Assert.assertEquals; + +/** + * Created by Thomas on 10/05/2017. + */ +public class MapServiceTest extends BaseServiceTest { + + @Before + public void setUp() throws Exception { + super.setUp(); + service = new MapService(); + + Map map = new Map(); + + MapDAO mapDAO = new MapDAO(); + mapDAO.insertEntity(map); + + item = map; + } + + protected ArrayList storeMultipleTestingItems(int nbItems) throws Exception { + ArrayList maps = new ArrayList<>(); + + int startingId = 1; + for(int i = startingId; i < nbItems + startingId; i++) { + Map testingMap = new Map(); + testingMap.setDescription("Description" + i); + testingMap.setPx_height(i); + testingMap.setPx_width(i); + testingMap.setM_height(i); + testingMap.setM_width(i); + + service.storeEntity(testingMap); + maps.add(testingMap); + } + + return maps; + } + + @Test + public void updateEntity() throws Exception { + Map map = (Map) item; + map.setM_width(100); + service.updateEntity(map.getId(), map); + + Map storedClient = (Map) service.getEntity(map.getId()); + assertEquals((int)map.getM_width(), (int)storedClient.getM_width()); + } +} diff --git a/src/test/java/com/lo53_mobile_localization/core/service/RssiServiceTest.java b/src/test/java/com/lo53_mobile_localization/core/service/RssiServiceTest.java new file mode 100644 index 0000000..833d927 --- /dev/null +++ b/src/test/java/com/lo53_mobile_localization/core/service/RssiServiceTest.java @@ -0,0 +1,120 @@ +package com.lo53_mobile_localization.core.service; + +import com.lo53_mobile_localization.core.entity.*; +import com.lo53_mobile_localization.core.helpers.HibernateTestHelper; +import com.lo53_mobile_localization.core.repository.AccessPointDAO; +import com.lo53_mobile_localization.core.repository.LocationDAO; +import com.lo53_mobile_localization.core.repository.RSSIDAO; +import org.junit.Before; +import org.junit.Test; + +import java.util.ArrayList; + +import static org.junit.Assert.assertEquals; +import static org.junit.Assert.assertTrue; + +/** + * Created by Thomas on 10/05/2017. + */ +public class RssiServiceTest extends HibernateTestHelper{ + + Rssi item = null; + RSSIService service; + + @Before + public void setUp() throws Exception { + super.setUp(); + + service = new RSSIService(); + Rssi rssi = new Rssi(); + + Location loc = new Location(); + AccessPoint ap = new AccessPoint(); + + LocationDAO locationDAO = new LocationDAO(); + AccessPointDAO accessPointDAO = new AccessPointDAO(); + + locationDAO.insertEntity(loc); + accessPointDAO.insertEntity(ap); + + rssi.getId().setAccessPointId(ap.getId()); + rssi.getId().setLocationId(loc.getId()); + rssi.setValue(10); + rssi.setOccurences(6); + + RSSIDAO rssiDao = new RSSIDAO(); + rssiDao.insertEntity(rssi); + + item = rssi; + } + + protected ArrayList storeMultipleTestingItems(int nbItems) throws Exception { + + ArrayList rssis = new ArrayList<>(); + + int startingId = 1; + for(int i = startingId; i < nbItems + startingId; i++) { + Rssi testingRssi = new Rssi(); + + testingRssi.setOccurences(i); + testingRssi.setValue(i); + + Location loc = new Location(); + AccessPoint ap = new AccessPoint(); + + testingRssi.getId().setAccessPointId(ap.getId()); + testingRssi.getId().setLocationId(loc.getId()); + + service.storeEntity(testingRssi); + + rssis.add(testingRssi); + } + + return rssis; + } + + @Test + public void updateEntity() throws Exception { + Rssi rssi = item; + rssi.setValue(100); + + service.updateEntity(rssi.getId(), rssi); + + Rssi storedClient = (Rssi) service.getEntity(rssi.getId()); + + assertEquals((int)rssi.getValue(), (int)storedClient.getValue()); + } + + @Test + public void storeEntity() throws Exception { + Rssi testingItem = storeMultipleTestingItems(1).get(0); + + assertTrue(service.getEntities().contains(testingItem)); + } + + + @Test + public void removeEntity() throws Exception { + service.removeEntity(item.getId()); + assertEquals(0, service.getEntities().size()); + } + + + @Test + public void getEntity() throws Exception { + Rssi storedItem = service.getEntity(item.getId()); + assertEquals(item, storedItem); + } + + @Test + public void getEntities() throws Exception { + ArrayList addedItems = storeMultipleTestingItems(10); + ArrayList storedItems = (ArrayList) service.getEntities(); + + assertEquals(1 + addedItems.size(), storedItems.size()); + assertTrue(storedItems.contains(item)); + assertTrue(storedItems.containsAll(addedItems)); + } + + +} -- libgit2 0.21.4