Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
S
SMART
Project
Project
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
3
Issues
3
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Registry
Registry
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
UNI-KLU
SMART
Commits
f6840670
Commit
f6840670
authored
Oct 08, 2020
by
Bogdan
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Fixed Schema Mapping
parent
520f4749
Changes
7
Hide whitespace changes
Inline
Side-by-side
Showing
7 changed files
with
82 additions
and
321 deletions
+82
-321
add_carsharing_schema.py
...add_use_case_scripts/car_sharing/add_carsharing_schema.py
+7
-5
add_car.py
...e/app/_add_use_case_scripts/car_sharing/tables/add_car.py
+17
-134
add_hash.py
.../app/_add_use_case_scripts/car_sharing/tables/add_hash.py
+6
-34
add_offer.py
...app/_add_use_case_scripts/car_sharing/tables/add_offer.py
+13
-37
add_publication.py
...dd_use_case_scripts/car_sharing/tables/add_publication.py
+14
-60
add_travel.py
...pp/_add_use_case_scripts/car_sharing/tables/add_travel.py
+15
-41
add_user.py
.../app/_add_use_case_scripts/car_sharing/tables/add_user.py
+10
-10
No files found.
src/participation-hub/business-logic-microservice/app/_add_use_case_scripts/car_sharing/add_carsharing_schema.py
View file @
f6840670
...
@@ -11,7 +11,7 @@ for modules_path in modules_paths:
...
@@ -11,7 +11,7 @@ for modules_path in modules_paths:
# import _add_use_case_scripts.car_sharing.tables.add_user as user
# import _add_use_case_scripts.car_sharing.tables.add_user as user
from
_add_use_case_scripts.car_sharing.tables
import
add_user
,
add_car
,
add_hash
from
_add_use_case_scripts.car_sharing.tables
import
add_car
,
add_hash
,
add_offer
,
add_publication
,
add_travel
,
add_user
# import _add_use_case_scripts.car_sharing.tables.add_user as user
# import _add_use_case_scripts.car_sharing.tables.add_user as user
# from _add_use_case_scripts.car_sharing.tables import add_car
# from _add_use_case_scripts.car_sharing.tables import add_car
...
@@ -49,7 +49,9 @@ if __name__ == "__main__":
...
@@ -49,7 +49,9 @@ if __name__ == "__main__":
add_use_case
(
use_case
)
add_use_case
(
use_case
)
add_user
.
main
(
use_case
)
add_user
.
main
(
use_case
)
#car.main(use_case)
# add_car.main(use_case)
#offer.main(use_case)
# add_hash.main(use_case)
#travel.main(use_case)
# add_offer.main(use_case)
#add_hash.main(use_case)
# add_publication.main(use_case)
\ No newline at end of file
# add_travel.main(use_case)
\ No newline at end of file
src/participation-hub/business-logic-microservice/app/_add_use_case_scripts/car_sharing/tables/add_car.py
View file @
f6840670
# def add_car_layers():
from
_add_use_case_scripts.car_sharing.tables.requestPost
import
postLayersToSwagger
,
postTableToSwagger
# use_case = "car-sharing"
# layers = [
# {
# "use_case": use_case,
# "name": "doctype_layer",
# "properties": [
# "UniqueID",
# "doctype",
# ],
# "cluster_properties": [
# "doctype",
# ]
# },
# {
# "use_case": use_case,
# "name": "brand_layer",a
# "properties": [
# "UniqueID",
# "brand",
# ],
# "cluster_properties": [
# "brand",
# ]
# },
# {
# "use_case": use_case,
# "name": "model_layer",
# "properties": [
# "UniqueID",
# "model",
# ],
# "cluster_properties": [
# "model",
# ]
# },
# {
# "use_case": use_case,
# "name": "colour_layer",
# "properties": [
# "UniqueID",
# "colour",
# ],
# "cluster_properties": [
# "colour",
# ]
# },
# {
# "use_case": use_case,
# "name": "seats_layer",
# "properties": [
# "UniqueID",
# "seats",
# ],
# "cluster_properties": [
# "seats",
# ]
# },
# {
# "use_case": use_case,
# "name": "year_layer",
# "properties": [
# "UniqueID",
# "year",
# ],
# "cluster_properties": [
# "year",
# ]
# },
# ]
# jwt = TokenManager.getInstance().getToken()
# for layer in layers:
# url = f"https://articonf1.itec.aau.at:30420/api/layers"
# response = requests.post(
# url,
# verify=False,
# proxies = { "http":None, "https":None },
# headers = { "Authorization": f"Bearer {jwt}"},
# json = layer
# )
# if response.status_code == 200:
# print(f"Response: {response.status_code}")
# else:
# print(f"Response: {response.status_code}: {response.text}")
import
network_constants
as
nc
from
security.token_manager
import
TokenManager
import
requests
def
add_table
(
use_case
:
str
,
table_name
:
str
):
def
add_table
(
use_case
:
str
,
table_name
:
str
):
'''
'''
take the columns and add the mappings at the server
take the columns and add the mappings at the server
replace all "/"'s in the internal representation with a "_"
replace all "/"'s in the internal representation with a "_"
'''
'''
jwt
=
TokenManager
.
getInstance
()
.
getToken
()
use_case
=
"car-sharing"
use_case
=
"car-sharing"
columns
=
[
columns
=
[
...
@@ -109,7 +15,7 @@ def add_table(use_case: str, table_name:str):
...
@@ -109,7 +15,7 @@ def add_table(use_case: str, table_name:str):
"colour"
,
"colour"
,
"seats"
,
"seats"
,
"year"
,
"year"
,
"ownerI
d
"
,
"ownerI
D
"
,
"deleted"
,
"deleted"
,
"state"
,
"state"
,
"observations"
"observations"
...
@@ -118,23 +24,13 @@ def add_table(use_case: str, table_name:str):
...
@@ -118,23 +24,13 @@ def add_table(use_case: str, table_name:str):
columns
=
{
c
:
c
for
c
in
columns
}
columns
=
{
c
:
c
for
c
in
columns
}
columns
[
"UniqueID"
]
=
"carLicensePlate"
columns
[
"UniqueID"
]
=
"carLicensePlate"
url
=
f
"https://articonf1.itec.aau.at:30420/api/use-cases/{use_case}/tables"
table
=
{
table
=
{
"name"
:
table_name
,
"name"
:
table_name
,
"mappings"
:
columns
"mappings"
:
columns
}
}
response
=
requests
.
post
(
postTableToSwagger
(
use_case
,
table
)
url
,
verify
=
False
,
proxies
=
{
"http"
:
None
,
"https"
:
None
},
headers
=
{
"Authorization"
:
f
"Bearer {jwt}"
},
json
=
table
)
print
(
url
+
": "
+
str
(
response
.
status_code
))
def
add_layers
(
use_case
:
str
,
table_name
:
str
):
def
add_layers
(
use_case
:
str
,
table_name
:
str
):
layers
=
[
layers
=
[
...
@@ -143,13 +39,13 @@ def add_layers(use_case:str, table_name: str):
...
@@ -143,13 +39,13 @@ def add_layers(use_case:str, table_name: str):
"table"
:
table_name
,
"table"
:
table_name
,
"name"
:
"GeneralCar_layer"
,
"name"
:
"GeneralCar_layer"
,
"properties"
:
[
"properties"
:
[
"UniqueI
d
"
,
"UniqueI
D
"
,
"brand"
,
"brand"
,
"model"
,
"model"
,
"colour"
,
"colour"
,
"seats"
,
"seats"
,
"year"
,
"year"
,
"ownerI
d
"
,
"ownerI
D
"
,
"deleted"
,
"deleted"
,
"state"
"state"
],
],
...
@@ -159,7 +55,7 @@ def add_layers(use_case:str, table_name: str):
...
@@ -159,7 +55,7 @@ def add_layers(use_case:str, table_name: str):
"model"
,
"model"
,
"seats"
,
"seats"
,
"year"
,
"year"
,
"ownerI
d
"
,
"ownerI
D
"
,
"state"
"state"
]
]
},
},
...
@@ -168,19 +64,19 @@ def add_layers(use_case:str, table_name: str):
...
@@ -168,19 +64,19 @@ def add_layers(use_case:str, table_name: str):
"table"
:
table_name
,
"table"
:
table_name
,
"name"
:
"Owner_layer"
,
"name"
:
"Owner_layer"
,
"properties"
:
[
"properties"
:
[
"UniqueI
d
"
,
"UniqueI
D
"
,
"brand"
,
"brand"
,
"model"
,
"model"
,
"colour"
,
"colour"
,
"seats"
,
"seats"
,
"year"
,
"year"
,
"ownerI
d
"
,
"ownerI
D
"
,
"deleted"
,
"deleted"
,
"state"
"state"
],
],
"cluster_properties"
:
[
"cluster_properties"
:
[
"OwnerI
d
"
,
"OwnerI
D
"
,
"UniqueI
d
"
"UniqueI
D
"
]
]
},
},
{
{
...
@@ -188,13 +84,13 @@ def add_layers(use_case:str, table_name: str):
...
@@ -188,13 +84,13 @@ def add_layers(use_case:str, table_name: str):
"table"
:
table_name
,
"table"
:
table_name
,
"name"
:
"CarAge_layer"
,
"name"
:
"CarAge_layer"
,
"properties"
:
[
"properties"
:
[
"UniqueI
d
"
,
"UniqueI
D
"
,
"brand"
,
"brand"
,
"model"
,
"model"
,
"colour"
,
"colour"
,
"seats"
,
"seats"
,
"year"
,
"year"
,
"ownerI
d
"
,
"ownerI
D
"
,
"deleted"
,
"deleted"
,
"state"
"state"
],
],
...
@@ -209,13 +105,13 @@ def add_layers(use_case:str, table_name: str):
...
@@ -209,13 +105,13 @@ def add_layers(use_case:str, table_name: str):
"table"
:
table_name
,
"table"
:
table_name
,
"name"
:
"Model_layer"
,
"name"
:
"Model_layer"
,
"properties"
:
[
"properties"
:
[
"UniqueI
d
"
,
"UniqueI
D
"
,
"brand"
,
"brand"
,
"model"
,
"model"
,
"colour"
,
"colour"
,
"seats"
,
"seats"
,
"year"
,
"year"
,
"ownerI
d
"
,
"ownerI
D
"
,
"deleted"
,
"deleted"
,
"state"
"state"
],
],
...
@@ -231,8 +127,8 @@ def add_layers(use_case:str, table_name: str):
...
@@ -231,8 +127,8 @@ def add_layers(use_case:str, table_name: str):
"table"
:
table_name
,
"table"
:
table_name
,
"name"
:
"CarState_layer"
,
"name"
:
"CarState_layer"
,
"properties"
:
[
"properties"
:
[
"UniqueI
d
"
,
"UniqueI
D
"
,
"ownerI
d
"
,
"ownerI
D
"
,
"deleted"
,
"deleted"
,
"state"
"state"
],
],
...
@@ -243,20 +139,7 @@ def add_layers(use_case:str, table_name: str):
...
@@ -243,20 +139,7 @@ def add_layers(use_case:str, table_name: str):
}
}
]
]
jwt
=
TokenManager
.
getInstance
()
.
getToken
()
postLayersToSwagger
(
use_case
,
layers
)
for
layer
in
layers
:
url
=
f
"https://articonf1.itec.aau.at:30420/api/layers"
response
=
requests
.
post
(
url
,
verify
=
False
,
proxies
=
{
"http"
:
None
,
"https"
:
None
},
headers
=
{
"Authorization"
:
f
"Bearer {jwt}"
},
json
=
layer
)
print
(
url
+
": "
+
str
(
response
.
status_code
))
def
main
(
use_case
:
str
):
def
main
(
use_case
:
str
):
print
(
"CAR"
)
print
(
"CAR"
)
...
...
src/participation-hub/business-logic-microservice/app/_add_use_case_scripts/car_sharing/tables/add_hash.py
View file @
f6840670
import
network_constants
as
nc
from
_add_use_case_scripts.car_sharing.tables.requestPost
import
postLayersToSwagger
,
postTableToSwagger
from
security.token_manager
import
TokenManager
import
requests
def
add_table
(
use_case
:
str
,
table_name
:
str
):
def
add_table
(
use_case
:
str
,
table_name
:
str
):
'''
'''
take the columns and add the mappings at the server
take the columns and add the mappings at the server
replace all "/"'s in the internal representation with a "_"
replace all "/"'s in the internal representation with a "_"
'''
'''
jwt
=
TokenManager
.
getInstance
()
.
getToken
()
# TODO Manuel: check back with alex
# TODO Manuel: check back with alex
...
@@ -33,23 +29,12 @@ def add_table(use_case: str, table_name: str):
...
@@ -33,23 +29,12 @@ def add_table(use_case: str, table_name: str):
columns
[
"username"
]
=
"connection//username"
columns
[
"username"
]
=
"connection//username"
columns
[
"password"
]
=
"connection//password"
columns
[
"password"
]
=
"connection//password"
url
=
f
"https://articonf1.itec.aau.at:30420/api/use-cases/{use_case}/tables"
table
=
{
table
=
{
"name"
:
table_name
,
"name"
:
table_name
,
"mappings"
:
columns
"mappings"
:
columns
}
}
response
=
requests
.
post
(
postTableToSwagger
(
use_case
,
table
)
url
,
verify
=
False
,
proxies
=
{
"http"
:
None
,
"https"
:
None
},
headers
=
{
"Authorization"
:
f
"Bearer {jwt}"
},
json
=
table
)
print
(
url
+
": "
+
str
(
response
.
status_code
))
def
add_layers
(
use_case
:
str
,
table_name
:
str
):
def
add_layers
(
use_case
:
str
,
table_name
:
str
):
layers
=
[
layers
=
[
...
@@ -58,7 +43,7 @@ def add_layers(use_case:str, table_name: str):
...
@@ -58,7 +43,7 @@ def add_layers(use_case:str, table_name: str):
"table"
:
table_name
,
"table"
:
table_name
,
"name"
:
"document_layer"
,
"name"
:
"document_layer"
,
"properties"
:
[
"properties"
:
[
"UniqueI
d
"
,
"UniqueI
D
"
,
"document1id"
,
"document1id"
,
"document1collection"
,
"document1collection"
,
"document1hash"
"document1hash"
...
@@ -76,7 +61,7 @@ def add_layers(use_case:str, table_name: str):
...
@@ -76,7 +61,7 @@ def add_layers(use_case:str, table_name: str):
"table"
:
table_name
,
"table"
:
table_name
,
"name"
:
"connection_layer"
,
"name"
:
"connection_layer"
,
"properties"
:
[
"properties"
:
[
"UniqueI
d
"
,
"UniqueI
D
"
,
"database"
,
"database"
,
"databaseType"
,
"databaseType"
,
"host"
,
"host"
,
...
@@ -95,7 +80,7 @@ def add_layers(use_case:str, table_name: str):
...
@@ -95,7 +80,7 @@ def add_layers(use_case:str, table_name: str):
"table"
:
table_name
,
"table"
:
table_name
,
"name"
:
"connection_layer"
,
"name"
:
"connection_layer"
,
"properties"
:
[
"properties"
:
[
"UniqueI
d
"
,
"UniqueI
D
"
,
"username"
,
"username"
,
"password"
"password"
...
@@ -108,20 +93,7 @@ def add_layers(use_case:str, table_name: str):
...
@@ -108,20 +93,7 @@ def add_layers(use_case:str, table_name: str):
}
}
]
]
jwt
=
TokenManager
.
getInstance
()
.
getToken
()
postLayersToSwagger
(
use_case
,
layers
)
for
layer
in
layers
:
url
=
f
"https://articonf1.itec.aau.at:30420/api/layers"
response
=
requests
.
post
(
url
,
verify
=
False
,
proxies
=
{
"http"
:
None
,
"https"
:
None
},
headers
=
{
"Authorization"
:
f
"Bearer {jwt}"
},
json
=
layer
)
print
(
url
+
": "
+
str
(
response
.
status_code
))
def
main
(
use_case
:
str
):
def
main
(
use_case
:
str
):
print
(
"HASH"
)
print
(
"HASH"
)
...
...
src/participation-hub/business-logic-microservice/app/_add_use_case_scripts/car_sharing/tables/add_offer.py
View file @
f6840670
import
network_constants
as
nc
from
_add_use_case_scripts.car_sharing.tables.requestPost
import
postLayersToSwagger
,
postTableToSwagger
from
security.token_manager
import
TokenManager
import
requests
def
add_table
(
use_case
:
str
,
table_name
:
str
):
def
add_table
(
use_case
:
str
,
table_name
:
str
):
'''
'''
take the columns and add the mappings at the server
take the columns and add the mappings at the server
replace all "/"'s in the internal representation with a "_"
replace all "/"'s in the internal representation with a "_"
'''
'''
jwt
=
TokenManager
.
getInstance
()
.
getToken
()
# TODO check back with alex
# TODO check back with alex
...
@@ -33,31 +29,21 @@ def add_table(use_case: str, table_name: str):
...
@@ -33,31 +29,21 @@ def add_table(use_case: str, table_name: str):
columns
=
{
c
:
c
for
c
in
columns
}
columns
=
{
c
:
c
for
c
in
columns
}
columns
[
"UniqueID"
]
=
"id"
columns
[
"UniqueID"
]
=
"id"
columns
[
"carI
d
"
]
=
"car//_id"
columns
[
"carI
D
"
]
=
"car//_id"
columns
[
"carOwner"
]
=
"car//ownerID"
columns
[
"carOwner"
]
=
"car//ownerID"
##TODO Question: should i get all the data from the car field? or just the car id/owner?
##TODO Question: should i get all the data from the car field? or just the car id/owner?
columns
[
"startLatitude"
]
=
"startPlace//latitude"
columns
[
"startLatitude"
]
=
"startPlace//latitude"
columns
[
"startLongitude"
]
=
"startPlace//longitude"
columns
[
"startLongitude"
]
=
"startPlace//longitude"
#TODO what if there are more end places? how can i define them? i can only get the first index of the array
#TODO what if there are more end places? how can i define them? i can only get the first index of the array
columns
[
"endLatitudeFirst"
]
=
"endPlace[0]//latitude"
columns
[
"endFirstLatitude"
]
=
"endPlace[0]//latitude"
columns
[
"endLongitudeFirst"
]
=
"endPlace[0]//longitude"
columns
[
"endFirstLongitude"
]
=
"endPlace[0]//longitude"
url
=
f
"https://articonf1.itec.aau.at:30420/api/use-cases/{use_case}/tables"
table
=
{
table
=
{
"name"
:
table_name
,
"name"
:
table_name
,
"mappings"
:
columns
"mappings"
:
columns
}
}
response
=
requests
.
post
(
postTableToSwagger
(
use_case
,
table
)
url
,
verify
=
False
,
proxies
=
{
"http"
:
None
,
"https"
:
None
},
headers
=
{
"Authorization"
:
f
"Bearer {jwt}"
},
json
=
table
)
print
(
url
+
": "
+
str
(
response
.
status_code
))
def
add_layers
(
use_case
:
str
,
table_name
:
str
):
def
add_layers
(
use_case
:
str
,
table_name
:
str
):
layers
=
[
layers
=
[
...
@@ -67,7 +53,7 @@ def add_layers(use_case:str, table_name: str):
...
@@ -67,7 +53,7 @@ def add_layers(use_case:str, table_name: str):
"name"
:
"OfferStartLocation_layer"
,
"name"
:
"OfferStartLocation_layer"
,
"properties"
:
[
"properties"
:
[
"UniqueID"
,
"UniqueID"
,
"carI
d
"
,
"carI
D
"
,
"carOwner"
,
"carOwner"
,
"startLatitude"
,
"startLatitude"
,
"startLongitude"
,
"startLongitude"
,
...
@@ -88,7 +74,7 @@ def add_layers(use_case:str, table_name: str):
...
@@ -88,7 +74,7 @@ def add_layers(use_case:str, table_name: str):
"name"
:
"OfferEndLocation_layer"
,
"name"
:
"OfferEndLocation_layer"
,
"properties"
:
[
"properties"
:
[
"UniqueID"
,
"UniqueID"
,
"carI
d
"
,
"carI
D
"
,
"carOwner"
,
"carOwner"
,
"startLatitude"
,
"startLatitude"
,
"startLongitude"
,
"startLongitude"
,
...
@@ -109,12 +95,12 @@ def add_layers(use_case:str, table_name: str):
...
@@ -109,12 +95,12 @@ def add_layers(use_case:str, table_name: str):
"name"
:
"OfferedCar_layer"
,
"name"
:
"OfferedCar_layer"
,
"properties"
:
[
"properties"
:
[
"UniqueID"
,
"UniqueID"
,
"carI
d
"
,
"carI
D
"
,
"carOwner"
"carOwner"
],
],
"cluster_properties"
:
[
"cluster_properties"
:
[
"carI
d
"
,
"carI
D
"
,
"carOwner"
"carOwner"
]
]
},
},
...
@@ -124,6 +110,7 @@ def add_layers(use_case:str, table_name: str):
...
@@ -124,6 +110,7 @@ def add_layers(use_case:str, table_name: str):
"name"
:
"OfferPrice_layer"
,
"name"
:
"OfferPrice_layer"
,
"properties"
:
[
"properties"
:
[
"UniqueID"
,
"UniqueID"
,
"carOwner"
,
"priceForKm"
,
"priceForKm"
,
"priceForTime"
,
"priceForTime"
,
"deposit"
"deposit"
...
@@ -142,6 +129,7 @@ def add_layers(use_case:str, table_name: str):
...
@@ -142,6 +129,7 @@ def add_layers(use_case:str, table_name: str):
"name"
:
"OfferTime_layer"
,
"name"
:
"OfferTime_layer"
,
"properties"
:
[
"properties"
:
[
"UniqueID"
,
"UniqueID"
,
"carOwner"
,
"startDate"
,
"startDate"
,
"endDate"
"endDate"
...
@@ -158,6 +146,7 @@ def add_layers(use_case:str, table_name: str):
...
@@ -158,6 +146,7 @@ def add_layers(use_case:str, table_name: str):
"name"
:
"OfferStatus_layer"
,
"name"
:
"OfferStatus_layer"
,
"properties"
:
[
"properties"
:
[
"UniqueID"
,
"UniqueID"
,
"carOwner"
,
"available"
,
"available"
,
"deleted"
"deleted"
...
@@ -170,20 +159,7 @@ def add_layers(use_case:str, table_name: str):
...
@@ -170,20 +159,7 @@ def add_layers(use_case:str, table_name: str):
}
}
]
]
jwt
=
TokenManager
.
getInstance
()
.
getToken
()
postLayersToSwagger
(
use_case
,
layers
)
for
layer
in
layers
:
url
=
f
"https://articonf1.itec.aau.at:30420/api/layers"
response
=
requests
.
post
(
url
,
verify
=
False
,
proxies
=
{
"http"
:
None
,
"https"
:
None
},
headers
=
{
"Authorization"
:
f
"Bearer {jwt}"
},
json
=
layer
)
print
(
url
+
": "
+
str
(
response
.
status_code
))
def
main
(
use_case
:
str
):
def
main
(
use_case
:
str
):
print
(
"OFFER"
)
print
(
"OFFER"
)
...
...
src/participation-hub/business-logic-microservice/app/_add_use_case_scripts/car_sharing/tables/add_publication.py
View file @
f6840670
import
network_constants
as
nc
from
_add_use_case_scripts.car_sharing.tables.requestPost
import
postLayersToSwagger
,
postTableToSwagger
from
security.token_manager
import
TokenManager
import
requests
def
add_table
(
use_case
:
str
,
table_name
:
str
):
def
add_table
(
use_case
:
str
,
table_name
:
str
):
'''
'''
take the columns and add the mappings at the server
take the columns and add the mappings at the server
replace all "/"'s in the internal representation with a "_"
replace all "/"'s in the internal representation with a "_"
'''
'''
jwt
=
TokenManager
.
getInstance
()
.
getToken
()
use_case
=
"car-sharing"
use_case
=
"car-sharing"
columns
=
[
columns
=
[
# "doctype",
# "doctype",
"id"
"id"
,
"text"
"text"
,
#"media"
#"media"
#"location"
#"location"
"user"
"user"
,
"date"
"date"
,
#"likesUsers"
#"likesUsers"
#"reportedBy"
#"reportedBy"
"deleted"
"deleted"
,
"answerTo"
"answerTo"
]
]
...
@@ -34,51 +30,22 @@ def add_table(use_case: str, table_name: str):
...
@@ -34,51 +30,22 @@ def add_table(use_case: str, table_name: str):
columns
[
"latitude"
]
=
"location//latitude"
columns
[
"latitude"
]
=
"location//latitude"
columns
[
"longitude"
]
=
"location//longitude"
columns
[
"longitude"
]
=
"location//longitude"
#TODO get Likes/reportedBy?
#TODO get Likes/reportedBy?
url
=
f
"https://articonf1.itec.aau.at:30420/api/use-cases/{use_case}/tables"
table
=
{
table
=
{
"name"
:
table_name
,
"name"
:
table_name
,
"mappings"
:
columns
"mappings"
:
columns
}
}
response
=
requests
.
post
(
postTableToSwagger
(
use_case
,
table
)
url
,
verify
=
False
,
proxies
=
{
"http"
:
None
,
"https"
:
None
},
headers
=
{
"Authorization"
:
f
"Bearer {jwt}"
},
json
=
table
)
print
(
url
+
": "
+
str
(
response
.
status_code
))
def
add_layers
(
use_case
:
str
,
table_name
:
str
):
def
add_layers
(
use_case
:
str
,
table_name
:
str
):
layers
=
[
layers
=
[
{
"use_case"
:
use_case
,
"table"
:
table_name
,
"name"
:
"PublicationGeneral_layer"
,
"properties"
:
[
"UniqueId"
,
"text"
,
"user"
,
"mediaUrlFirst"
,
"mediaTypeFirst"
,
"mediaLabelsFirst"
,
"latitude"
,
"longitude"
],
"cluster_properties"
:
[
#TODO What to add?
]
},
{
{
"use_case"
:
use_case
,
"use_case"
:
use_case
,
"table"
:
table_name
,
"table"
:
table_name
,
"name"
:
"PublicationLocation_layer"
,
"name"
:
"PublicationLocation_layer"
,
"properties"
:
[
"properties"
:
[
"UniqueI
d
"
,
"UniqueI
D
"
,
"user"
,
"user"
,
"latitude"
,
"latitude"
,
"longitude"
"longitude"
...
@@ -94,7 +61,7 @@ def add_layers(use_case:str, table_name: str):
...
@@ -94,7 +61,7 @@ def add_layers(use_case:str, table_name: str):
"table"
:
table_name
,
"table"
:
table_name
,
"name"
:
"PublicationTime_layer"
,
"name"
:
"PublicationTime_layer"
,
"properties"
:
[
"properties"
:
[
"UniqueI
d
"
,
"UniqueI
D
"
,
"user"
,
"user"
,
"latitude"
,
"latitude"
,
"longitude"
"longitude"
...
@@ -109,7 +76,7 @@ def add_layers(use_case:str, table_name: str):
...
@@ -109,7 +76,7 @@ def add_layers(use_case:str, table_name: str):
"table"
:
table_name
,
"table"
:
table_name
,
"name"
:
"PublicationUser_layer"
,
"name"
:
"PublicationUser_layer"
,
"properties"
:
[
"properties"
:
[
"UniqueI
d
"
,
"UniqueI
D
"
,
"text"
,
"text"
,
"user"
,
"user"
,
"mediaUrlFirst"
,
"mediaUrlFirst"
,
...
@@ -126,34 +93,21 @@ def add_layers(use_case:str, table_name: str):
...
@@ -126,34 +93,21 @@ def add_layers(use_case:str, table_name: str):
"table"
:
table_name
,
"table"
:
table_name
,
"name"
:
"PublicationStatus_layer"
,
"name"
:
"PublicationStatus_layer"
,
"properties"
:
[
"properties"
:
[
"UniqueI
d
"
,
"UniqueI
D
"
,
"text"
,
"text"
,
"user"
,
"user"
,
"
status
"
,
"
deleted
"
,
"answerTo"
"answerTo"
],
],
"cluster_properties"
:
[
"cluster_properties"
:
[
"
status
"
,
"
deleted
"
,
"answerTo"
"answerTo"
]
]
}
}
]
]
jwt
=
TokenManager
.
getInstance
()
.
getToken
()
postLayersToSwagger
(
use_case
,
layers
)
for
layer
in
layers
:
url
=
f
"https://articonf1.itec.aau.at:30420/api/layers"
response
=
requests
.
post
(
url
,
verify
=
False
,
proxies
=
{
"http"
:
None
,
"https"
:
None
},
headers
=
{
"Authorization"
:
f
"Bearer {jwt}"
},
json
=
layer
)
print
(
url
+
": "
+
str
(
response
.
status_code
))
def
main
(
use_case
:
str
):
def
main
(
use_case
:
str
):
print
(
"PUBLICATION"
)
print
(
"PUBLICATION"
)
...
...
src/participation-hub/business-logic-microservice/app/_add_use_case_scripts/car_sharing/tables/add_travel.py
View file @
f6840670
import
network_constants
as
nc
from
_add_use_case_scripts.car_sharing.tables.requestPost
import
postLayersToSwagger
,
postTableToSwagger
from
security.token_manager
import
TokenManager
import
requests
def
add_table
(
use_case
:
str
,
table_name
:
str
):
def
add_table
(
use_case
:
str
,
table_name
:
str
):
'''
'''
take the columns and add the mappings at the server
take the columns and add the mappings at the server
replace all "/"'s in the internal representation with a "_"
replace all "/"'s in the internal representation with a "_"
'''
'''
jwt
=
TokenManager
.
getInstance
()
.
getToken
()
# TODO disscuss with others if it looks ok
# TODO disscuss with others if it looks ok
...
@@ -42,7 +38,7 @@ def add_table(use_case: str, table_name: str):
...
@@ -42,7 +38,7 @@ def add_table(use_case: str, table_name: str):
columns
=
{
c
:
c
for
c
in
columns
}
columns
=
{
c
:
c
for
c
in
columns
}
columns
[
"UniqueID"
]
=
"id"
columns
[
"UniqueID"
]
=
"id"
columns
[
"user1I
d
"
]
=
"users[0]//userId"
columns
[
"user1I
D
"
]
=
"users[0]//userId"
columns
[
"user1PassengersNr"
]
=
"users[0]//passengers"
columns
[
"user1PassengersNr"
]
=
"users[0]//passengers"
columns
[
"isDriver"
]
=
"users[0]//isDriver"
columns
[
"isDriver"
]
=
"users[0]//isDriver"
columns
[
"startPlaceLatitude"
]
=
"startPlace//Latitude"
columns
[
"startPlaceLatitude"
]
=
"startPlace//Latitude"
...
@@ -63,40 +59,30 @@ def add_table(use_case: str, table_name: str):
...
@@ -63,40 +59,30 @@ def add_table(use_case: str, table_name: str):
columns
[
"startedBy1Moment"
]
=
"startedBy[0]//moment"
columns
[
"startedBy1Moment"
]
=
"startedBy[0]//moment"
columns
[
"startedBy1User"
]
=
"startedBy[0]//user"
columns
[
"startedBy1User"
]
=
"startedBy[0]//user"
#TODO CheckedBy,CanceledBy usefull?
#TODO CheckedBy,CanceledBy usefull?
url
=
f
"https://articonf1.itec.aau.at:30420/api/use-cases/{use_case}/tables"
table
=
{
table
=
{
"name"
:
table_name
,
"name"
:
table_name
,
"mappings"
:
columns
"mappings"
:
columns
}
}
response
=
requests
.
post
(
postTableToSwagger
(
use_case
,
table
)
url
,
verify
=
False
,
proxies
=
{
"http"
:
None
,
"https"
:
None
},
headers
=
{
"Authorization"
:
f
"Bearer {jwt}"
},
json
=
table
)
print
(
url
+
": "
+
str
(
response
.
status_code
))
def
add_layers
(
use_case
:
str
,
table_name
:
str
):
def
add_layers
(
use_case
:
str
,
table_name
:
str
):
layers
=
[
layers
=
[
{
{
"use_case"
:
use_case
,
"use_case"
:
use_case
,
"table"
:
table_name
,
"table"
:
table_name
,
"name"
:
"User_Layer"
,
"name"
:
"
Travel
User_Layer"
,
"properties"
:
[
"properties"
:
[
'UniqueID'
,
'UniqueID'
,
'user1I
d
'
,
'user1I
D
'
,
'isDriver'
,
'isDriver'
,
'score1User'
,
'score1User'
,
'score1Rating'
,
'score1Rating'
,
'startedBy1User'
'startedBy1User'
],
],
"cluster_properties"
:
[
"cluster_properties"
:
[
'user1I
d
'
'user1I
D
'
]
]
},
},
{
{
...
@@ -104,7 +90,7 @@ def add_layers(use_case:str, table_name: str):
...
@@ -104,7 +90,7 @@ def add_layers(use_case:str, table_name: str):
"table"
:
table_name
,
"table"
:
table_name
,
"name"
:
"StartingPoint_Layer"
,
"name"
:
"StartingPoint_Layer"
,
"properties"
:
[
"properties"
:
[
'user1I
d
'
,
'user1I
D
'
,
'UniqueID'
,
'UniqueID'
,
'startPlaceLatitude'
,
'startPlaceLatitude'
,
'startPlaceLongitude'
,
'startPlaceLongitude'
,
...
@@ -120,7 +106,7 @@ def add_layers(use_case:str, table_name: str):
...
@@ -120,7 +106,7 @@ def add_layers(use_case:str, table_name: str):
"table"
:
table_name
,
"table"
:
table_name
,
"name"
:
"StartingTime_Layer"
,
"name"
:
"StartingTime_Layer"
,
"properties"
:
[
"properties"
:
[
'user1I
d
'
,
'user1I
D
'
,
'UniqueID'
,
'UniqueID'
,
'startDate'
,
'startDate'
,
'endDate'
,
'endDate'
,
...
@@ -136,7 +122,7 @@ def add_layers(use_case:str, table_name: str):
...
@@ -136,7 +122,7 @@ def add_layers(use_case:str, table_name: str):
"table"
:
table_name
,
"table"
:
table_name
,
"name"
:
"Destination_Layer"
,
"name"
:
"Destination_Layer"
,
"properties"
:
[
"properties"
:
[
'user1I
d
'
,
'user1I
D
'
,
'UniqueID'
,
'UniqueID'
,
'endPlace1Latitude'
,
'endPlace1Latitude'
,
'endPlace1Longitude'
,
'endPlace1Longitude'
,
...
@@ -153,7 +139,7 @@ def add_layers(use_case:str, table_name: str):
...
@@ -153,7 +139,7 @@ def add_layers(use_case:str, table_name: str):
"table"
:
table_name
,
"table"
:
table_name
,
"name"
:
"FinishedTime_Layer"
,
"name"
:
"FinishedTime_Layer"
,
"properties"
:
[
"properties"
:
[
'user1I
d
'
,
'user1I
D
'
,
'UniqueID'
,
'UniqueID'
,
'startDate'
,
'startDate'
,
'endDate'
,
'endDate'
,
...
@@ -169,7 +155,7 @@ def add_layers(use_case:str, table_name: str):
...
@@ -169,7 +155,7 @@ def add_layers(use_case:str, table_name: str):
"table"
:
table_name
,
"table"
:
table_name
,
"name"
:
"Price_Layer"
,
"name"
:
"Price_Layer"
,
"properties"
:
[
"properties"
:
[
'user1I
d
'
,
'user1I
D
'
,
'UniqueID'
,
'UniqueID'
,
'totalPrice'
,
'totalPrice'
,
'kmTraveled'
,
'kmTraveled'
,
...
@@ -191,10 +177,11 @@ def add_layers(use_case:str, table_name: str):
...
@@ -191,10 +177,11 @@ def add_layers(use_case:str, table_name: str):
"name"
:
"Status_Layer"
,
"name"
:
"Status_Layer"
,
"properties"
:
[
"properties"
:
[
'UniqueID'
,
'UniqueID'
,
'user1I
d
'
,
'user1I
D
'
,
'status'
,
'status'
,
'score1User'
,
'score1User'
,
'score1Rating'
'score1Rating'
,
'rentForTime'
],
],
"cluster_properties"
:
[
"cluster_properties"
:
[
'status'
,
'status'
,
...
@@ -204,20 +191,7 @@ def add_layers(use_case:str, table_name: str):
...
@@ -204,20 +191,7 @@ def add_layers(use_case:str, table_name: str):
}
}
]
]
jwt
=
TokenManager
.
getInstance
()
.
getToken
()
postLayersToSwagger
(
use_case
,
layers
)
for
layer
in
layers
:
url
=
f
"https://articonf1.itec.aau.at:30420/api/layers"
response
=
requests
.
post
(
url
,
verify
=
False
,
proxies
=
{
"http"
:
None
,
"https"
:
None
},
headers
=
{
"Authorization"
:
f
"Bearer {jwt}"
},
json
=
layer
)
print
(
url
+
": "
+
str
(
response
.
status_code
))
def
main
(
use_case
:
str
):
def
main
(
use_case
:
str
):
print
(
"TRAVEL"
)
print
(
"TRAVEL"
)
...
...
src/participation-hub/business-logic-microservice/app/_add_use_case_scripts/car_sharing/tables/add_user.py
View file @
f6840670
...
@@ -15,12 +15,12 @@ def add_table(use_case: str, table_name: str):
...
@@ -15,12 +15,12 @@ def add_table(use_case: str, table_name: str):
"id"
,
# pk
"id"
,
# pk
"balance"
,
"balance"
,
"payerId"
,
"payerId"
,
"numberOfTrips"
,
"numberOfTrips
Done
"
,
"sumOfTripsScores"
"sumOfTripsScores"
]
]
columns
=
{
c
:
c
for
c
in
columns
}
columns
=
{
c
:
c
for
c
in
columns
}
columns
[
"UniqueI
d
"
]
=
"id"
columns
[
"UniqueI
D
"
]
=
"id"
table
=
{
table
=
{
"name"
:
table_name
,
"name"
:
table_name
,
...
@@ -37,16 +37,16 @@ def add_layers(use_case:str, table_name: str):
...
@@ -37,16 +37,16 @@ def add_layers(use_case:str, table_name: str):
"table"
:
table_name
,
"table"
:
table_name
,
"name"
:
"User_layer"
,
"name"
:
"User_layer"
,
"properties"
:
[
"properties"
:
[
"UniqueI
d
"
,
"UniqueI
D
"
,
"balance"
,
"balance"
,
"payerId"
,
"payerId"
,
"numberOfTrips"
,
"numberOfTrips
Done
"
,
"sumOfTripsScores"
"sumOfTripsScores"
],
],
"cluster_properties"
:
[
"cluster_properties"
:
[
"balance"
,
"balance"
,
"numberOfTrips"
,
"numberOfTrips
Done
"
,
"sumOfTripsScores"
"sumOfTripsScores"
]
]
},
},
...
@@ -55,10 +55,10 @@ def add_layers(use_case:str, table_name: str):
...
@@ -55,10 +55,10 @@ def add_layers(use_case:str, table_name: str):
"table"
:
table_name
,
"table"
:
table_name
,
"name"
:
"UserBalance_layer"
,
"name"
:
"UserBalance_layer"
,
"properties"
:
[
"properties"
:
[
"UniqueI
d
"
,
"UniqueI
D
"
,
"balance"
,
"balance"
,
"payerId"
,
"payerId"
,
"numberOfTrips"
,
"numberOfTrips
Done
"
,
"sumOfTripsScores"
"sumOfTripsScores"
],
],
...
@@ -72,15 +72,15 @@ def add_layers(use_case:str, table_name: str):
...
@@ -72,15 +72,15 @@ def add_layers(use_case:str, table_name: str):
"table"
:
table_name
,
"table"
:
table_name
,
"name"
:
"UserVeterancy_layer"
,
"name"
:
"UserVeterancy_layer"
,
"properties"
:
[
"properties"
:
[
"UniqueI
d
"
,
"UniqueI
D
"
,
"balance"
,
"balance"
,
"payerId"
,
"payerId"
,
"numberOfTrips"
,
"numberOfTrips
Done
"
,
"sumOfTripsScores"
"sumOfTripsScores"
],
],
"cluster_properties"
:
[
"cluster_properties"
:
[
"numberOfTrips"
,
"numberOfTrips
Done
"
,
"sumOfTripsScores"
"sumOfTripsScores"
]
]
}
}
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment