Skip to content

Commit 7201d25

Browse files
author
Maria Farooq
committed
added schema and mapping scripts in main directory
1 parent ede8ddc commit 7201d25

7 files changed

Lines changed: 88 additions & 1 deletion

File tree

restcomm/restcomm.application/src/main/webapp/WEB-INF/conf/mybatis.xml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -53,5 +53,6 @@
5353
<mapper url="file://${sql}/extensions-configuration.xml"/>
5454
<mapper url="file://${sql}/geolocation.xml"/>
5555
<mapper url="file://${sql}/organization.xml"/>
56+
<mapper url="file://${sql}/profile-association.xml"/>
5657
</mappers>
5758
</configuration>

restcomm/restcomm.application/src/main/webapp/WEB-INF/data/hsql/restcomm.script

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,7 @@ CREATE MEMORY TABLE "restcomm_sand_boxes"("date_created" DATETIME NOT NULL,"date
2121
CREATE MEMORY TABLE "restcomm_gateways"("sid" VARCHAR(34) NOT NULL PRIMARY KEY,"date_created" DATETIME NOT NULL,"date_updated" DATETIME NOT NULL,"friendly_name" VARCHAR(255),"user_name" VARCHAR(255),"password" VARCHAR(255),"proxy" LONGVARCHAR NOT NULL,"register" BOOLEAN NOT NULL,"ttl" INT NOT NULL,"uri" LONGVARCHAR NOT NULL)
2222
CREATE MEMORY TABLE "restcomm_media_servers" ( "ms_id" INT GENERATED BY DEFAULT AS IDENTITY (START WITH 1, INCREMENT BY 1) NOT NULL, "local_ip" VARCHAR(34) NOT NULL, "local_port" INT NOT NULL, "remote_ip" VARCHAR(34) NOT NULL UNIQUE, "remote_port" INT NOT NULL, "compatibility" VARCHAR(34) DEFAULT 'rms', "response_timeout" VARCHAR(34), "external_address" VARCHAR(34))
2323
CREATE MEMORY TABLE "restcomm_media_resource_broker_entity" ("conference_sid" VARCHAR(34) NOT NULL, "slave_ms_id" VARCHAR(34) NOT NULL, "slave_ms_bridge_ep_id" VARCHAR(34),"slave_ms_cnf_ep_id" VARCHAR(34),"is_bridged_together" BOOLEAN DEFAULT FALSE,PRIMARY KEY ("conference_sid" , "slave_ms_id"))
24+
CREATE MEMORY TABLE "restcomm_profile_associations"("target_sid" LONGVARCHAR NOT NULL PRIMARY KEY, "profile_sid" LONGVARCHAR NOT NULL, "date_created" DATETIME NOT NULL, "date_updated" DATETIME NOT NULL)
2425
CREATE MEMORY TABLE PUBLIC."restcomm_extensions_configuration"("sid" VARCHAR(34) NOT NULL PRIMARY KEY,"extension" VARCHAR(255) NOT NULL,"configuration_data" VARCHAR(16777216),"configuration_type" VARCHAR(255) NOT NULL,"date_created" TIMESTAMP NOT NULL,"date_updated" TIMESTAMP, "enabled" BOOLEAN DEFAULT TRUE NOT NULL)
2526
CREATE MEMORY TABLE PUBLIC."restcomm_accounts_extensions" ("account_sid" VARCHAR(34) NOT NULL, "extension_sid" VARCHAR(34) NOT NULL, PRIMARY KEY("account_sid", "extension_sid"), "configuration_data" VARCHAR(16777216))
2627
CREATE MEMORY TABLE "restcomm_geolocation"("sid" VARCHAR(34) NOT NULL PRIMARY KEY, "date_created" DATETIME NOT NULL, "date_updated" DATETIME NOT NULL, "date_executed" DATETIME NOT NULL, "account_sid" VARCHAR(34) NOT NULL, "source" VARCHAR(30), "device_identifier" VARCHAR(30) NOT NULL, "geolocation_type" VARCHAR(15) NOT NULL, "response_status" VARCHAR(30), "cell_id" VARCHAR(10), "location_area_code" VARCHAR(10), "mobile_country_code" INTEGER, "mobile_network_code" VARCHAR(3), "network_entity_address" BIGINT, "age_of_location_info" INTEGER, "device_latitude" VARCHAR(15), "device_longitude" VARCHAR(15), "accuracy" BIGINT, "physical_address" VARCHAR(50), "internet_address" VARCHAR(50), "formatted_address" VARCHAR(200), "location_timestamp" DATETIME, "event_geofence_latitude" VARCHAR(15), "event_geofence_longitude" VARCHAR(15), "radius" BIGINT, "geolocation_positioning_type" VARCHAR(15), "last_geolocation_response" VARCHAR(10), "cause" VARCHAR(150), "api_version" VARCHAR(10) NOT NULL, "uri" LONGVARCHAR NOT NULL)

restcomm/restcomm.application/src/main/webapp/WEB-INF/scripts/mariadb/init.sql

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -393,6 +393,13 @@ date_updated DATETIME,
393393
enabled BOOLEAN NOT NULL DEFAULT TRUE
394394
);
395395

396+
CREATE TABLE restcomm_profile_associations(
397+
target_sid TEXT NOT NULL PRIMARY KEY,
398+
profile_sid TEXT NOT NULL,
399+
date_created DATETIME NOT NULL,
400+
date_updated DATETIME NOT NULL
401+
);
402+
396403
CREATE TABLE restcomm_accounts_extensions (
397404
account_sid VARCHAR(34) NOT NULL,
398405
extension_sid VARCHAR(34) NOT NULL,
Lines changed: 39 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,39 @@
1+
<?xml version="1.0" encoding="UTF-8"?>
2+
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
3+
<!-- @author maria farooq -->
4+
<mapper namespace="org.mobicents.servlet.sip.restcomm.dao.ProfileAssociationsDao">
5+
<insert id="addProfileAssociation" parameterType="map">
6+
INSERT INTO restcomm_profile_associations (profile_sid, target_sid, date_created, date_updated)
7+
VALUES(#{profile_sid}, #{target_sid}, #{date_created}, #{date_updated});
8+
</insert>
9+
10+
<select id="getProfileAssociationByTargetSid" parameterType="string" resultType="hashmap">
11+
SELECT * FROM restcomm_profile_associations WHERE target_sid=#{target_sid};
12+
</select>
13+
14+
<select id="getProfileAssociationsByProfileSid" parameterType="string" resultType="hashmap">
15+
SELECT * FROM restcomm_profile_associations WHERE profile_sid=#{profile_sid};
16+
</select>
17+
18+
<update id="updateProfileAssociationOfTargetSid" parameterType="map">
19+
UPDATE restcomm_profile_associations SET date_updated=NOW(),
20+
profile_sid=#{profile_sid}
21+
WHERE target_sid=#{target_sid};
22+
</update>
23+
24+
<update id="updateAssociatedProfileOfAllSuchProfileSid" parameterType="map">
25+
UPDATE restcomm_profile_associations SET date_updated=NOW(),
26+
profile_sid=#{profile_sid}
27+
WHERE profile_sid=#{old_profile_sid};
28+
</update>
29+
30+
<delete id="deleteProfileAssociationByProfileSid" parameterType="map">
31+
DELETE from restcomm_profile_associations
32+
WHERE profile_sid=#{profile_sid};
33+
</delete>
34+
35+
<delete id="deleteProfileAssociationByTargetSid" parameterType="map">
36+
DELETE from restcomm_profile_associations
37+
WHERE target_sid=#{target_sid};
38+
</delete>
39+
</mapper>

restcomm/restcomm.dao/src/test/resources/organizationsDao/profileassociation.xml renamed to restcomm/restcomm.application/src/main/webapp/WEB-INF/sql/profile-association.xml

File renamed without changes.

restcomm/restcomm.dao/src/test/resources/organizationsDao/mybatis.xml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -39,6 +39,6 @@
3939

4040
<mappers>
4141
<mapper url="file:MYBATIS_SANDBOX_PATH/organization.xml"/>
42-
<mapper url="file:MYBATIS_SANDBOX_PATH/profileassociation.xml"/>
42+
<mapper url="file:MYBATIS_SANDBOX_PATH/profile-association.xml"/>
4343
</mappers>
4444
</configuration>
Lines changed: 39 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,39 @@
1+
<?xml version="1.0" encoding="UTF-8"?>
2+
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
3+
<!-- @author maria farooq -->
4+
<mapper namespace="org.mobicents.servlet.sip.restcomm.dao.ProfileAssociationsDao">
5+
<insert id="addProfileAssociation" parameterType="map">
6+
INSERT INTO "restcomm_profile_associations" ("profile_sid", "target_sid", "date_created", "date_updated")
7+
VALUES(#{profile_sid}, #{target_sid}, #{date_created}, #{date_updated});
8+
</insert>
9+
10+
<select id="getProfileAssociationByTargetSid" parameterType="string" resultType="hashmap">
11+
SELECT * FROM "restcomm_profile_associations" WHERE "target_sid"=#{target_sid};
12+
</select>
13+
14+
<select id="getProfileAssociationsByProfileSid" parameterType="string" resultType="hashmap">
15+
SELECT * FROM "restcomm_profile_associations" WHERE "profile_sid"=#{profile_sid};
16+
</select>
17+
18+
<update id="updateProfileAssociationOfTargetSid" parameterType="map">
19+
UPDATE "restcomm_profile_associations" SET "date_updated"=NOW(),
20+
"profile_sid"=#{profile_sid}
21+
WHERE "target_sid"=#{target_sid};
22+
</update>
23+
24+
<update id="updateAssociatedProfileOfAllSuchProfileSid" parameterType="map">
25+
UPDATE "restcomm_profile_associations" SET "date_updated"=NOW(),
26+
"profile_sid"=#{profile_sid}
27+
WHERE "profile_sid"=#{old_profile_sid};
28+
</update>
29+
30+
<delete id="deleteProfileAssociationByProfileSid" parameterType="map">
31+
DELETE from "restcomm_profile_associations"
32+
WHERE "profile_sid"=#{profile_sid};
33+
</delete>
34+
35+
<delete id="deleteProfileAssociationByTargetSid" parameterType="map">
36+
DELETE from "restcomm_profile_associations"
37+
WHERE "target_sid"=#{target_sid};
38+
</delete>
39+
</mapper>

0 commit comments

Comments
 (0)