Add traccar configuration on p2.inf and updated mysql.sql

feature/traccar-sync
Rushdi Mohamed 2 years ago
parent f61ab0ae69
commit e88d5e9c3b

@ -158,13 +158,16 @@ public class TraccarClientImpl implements TraccarClient {
String allUsers = fetchAllUsers(); //get all users
JSONArray fetchAllUsers = new JSONArray(allUsers); //loop users
for(int i=0; i<fetchAllUsers.length();i++){
//if login is null then check the name or if login is not null then check the login
if((!fetchAllUsers.getJSONObject(i).isNull("login") &&
fetchAllUsers.getJSONObject(i).getString("login").equals(userName)) ||
(fetchAllUsers.getJSONObject(i).isNull("login") &&
fetchAllUsers.getJSONObject(i).getString("name").equals(userName)) ){
return fetchAllUsers.getJSONObject(i).toString();
// if login is null then check the name or if login is not null then check the login
if(fetchAllUsers.getJSONObject(i).isNull("login")){
if(Objects.equals(fetchAllUsers.getJSONObject(i).getString("name"), userName)){
return fetchAllUsers.getJSONObject(i).toString();
}
}else{
if(Objects.equals(fetchAllUsers.getJSONObject(i).getString("login"), userName) ||
Objects.equals(fetchAllUsers.getJSONObject(i).getString("name"), userName)){
return fetchAllUsers.getJSONObject(i).toString();
}
}
}
@ -183,6 +186,7 @@ public class TraccarClientImpl implements TraccarClient {
if(Objects.equals(result, TraccarHandlerConstants.Types.USER_NOT_FOUND)){
//create user
log.info("Creating a user");
traccarUser.setName(userName);
traccarUser.setLogin(userName);
traccarUser.setEmail(userName);
@ -193,6 +197,7 @@ public class TraccarClientImpl implements TraccarClient {
DeviceAPIClientServiceImpl.createUser(traccarUser);
}else{
//update user
log.info("Updating the user");
JSONObject obj = new JSONObject(result);
traccarUser.setId(obj.getInt("id"));

@ -812,3 +812,32 @@ CREATE TABLE IF NOT EXISTS DM_GEOFENCE_EVENT_MAPPING (
) ENGINE=InnoDB;
-- END OF DM_GEOFENCE_GROUP_MAPPING TABLE--
-- DM_EXT_GROUP_MAPPING TABLE--
CREATE TABLE IF NOT EXISTS DM_EXT_GROUP_MAPPING (
ID INT NOT NULL AUTO_INCREMENT,
TRACCAR_GROUP_ID INT DEFAULT 0,
GROUP_ID INT NOT NULL,
TENANT_ID INT NOT NULL,
STATUS INT DEFAULT 0,
PRIMARY KEY (ID)
);
-- END OF DM_EXT_GROUP_MAPPING TABLE--
-- END OF DM_EXT_DEVICE_MAPPING TABLE--
CREATE TABLE IF NOT EXISTS DM_EXT_DEVICE_MAPPING (
ID INT NOT NULL AUTO_INCREMENT,
TRACCAR_DEVICE_ID INT DEFAULT 0,
DEVICE_ID INT NOT NULL,
TENANT_ID INT NOT NULL,
STATUS INT DEFAULT 0,
PRIMARY KEY (ID)
);
-- END OF DM_EXT_DEVICE_MAPPING TABLE--
-- END OF DM_EXT_PERMISSION_MAPPING TABLE--
CREATE TABLE IF NOT EXISTS DM_EXT_PERMISSION_MAPPING (
TRACCAR_DEVICE_ID INT DEFAULT 0,
TRACCAR_USER_ID INT DEFAULT 0
);
-- END OF DM_EXT_PERMISSION_MAPPING TABLE--

@ -11,3 +11,4 @@ org.eclipse.equinox.p2.touchpoint.natives.copy(source:${installFolder}/../featur
org.eclipse.equinox.p2.touchpoint.natives.mkdir(path:${installFolder}/../../../repository/resources/email-templates);\
org.eclipse.equinox.p2.touchpoint.natives.copy(source:${installFolder}/../features/org.wso2.carbon.device.mgt.basics_${feature.version}/email/templates,target:${installFolder}/../../../repository/resources/email-templates,overwrite:true);\
org.eclipse.equinox.p2.touchpoint.natives.copy(source:${installFolder}/../features/org.wso2.carbon.device.mgt.basics_${feature.version}/conf_templates/,target:${installFolder}/../../resources/conf/,overwrite:true);\
org.eclipse.equinox.p2.touchpoint.natives.copy(source:${installFolder}/../features/org.wso2.carbon.device.mgt.basics_${feature.version}/conf/traccar-config.xml,target:${installFolder}/../../conf/traccar-config.xml,overwrite:true);\

Loading…
Cancel
Save