2.2.x to 2.3.0 Migration
This module requires at least Broadleaf 5.3.0-GA
What's changed?
- Added in new EmailTemplate and SMSTemplate domain to provide support for content-managed notifications.
- Added support for using content targeters to swap EmailTemplate's and SMSTemplate's based on rules.
Migration
In your application's pom.xml, change the version for broadleaf-advanced-cms
to 2.3.0-GA
.
If you are looking to leverage the new Email and SMS templates, see the Email and SMS Templates document.
Database Changes
There are three new tables to add to the schema:
CREATE TABLE BLC_EMAIL_TEMPLATE
(
EMAIL_TEMPLATE_ID bigint PRIMARY KEY NOT NULL,
ACTIVE_END_DATE timestamp,
ACTIVE_START_DATE timestamp,
ARCHIVED char(255),
CREATED_BY bigint,
DATE_CREATED timestamp,
DATE_UPDATED timestamp,
UPDATED_BY bigint,
BODY longvarchar,
CONTENT_TARGETABLE boolean,
ADMIN_ADDITION_STATUS varchar(255),
SNDBX_CATALOG_FLAG bigint,
SNDBX_ORIG_ITEM_ID bigint,
SNDBX_ORIG_RECORD_ID bigint,
SNDBX_ID bigint,
SNDBX_ARCHIVED_FLAG char(255),
SNDBX_DELETED_FLAG char(255),
SNDBX_TMPLT_RECORD_ID bigint,
SNDBX_TIER bigint,
SITE_DISC bigint,
EMAIL_FROM varchar(255),
NAME varchar(255),
OVERRIDE_TO boolean,
PRIORITY integer,
SUBJECT_TEMPLATE varchar(255),
EMAIL_TO varchar(255),
TYPE varchar(255)
);
CREATE INDEX EMAIL_ACTIVE_END_INDEX ON BLC_EMAIL_TEMPLATE (ACTIVE_END_DATE);
CREATE INDEX EMAIL_ACTIVE_START_INDEX ON BLC_EMAIL_TEMPLATE (ACTIVE_START_DATE);
CREATE INDEX IDX_BLEMTE_SNDBX_TEM_ID ON BLC_EMAIL_TEMPLATE (SNDBX_ORIG_ITEM_ID);
CREATE INDEX IDX_BLEMTE_SNDBX_ORD_ID ON BLC_EMAIL_TEMPLATE (SNDBX_ORIG_RECORD_ID);
CREATE INDEX IDX_BLEMTE_SNDBX_ID ON BLC_EMAIL_TEMPLATE (SNDBX_ID);
CREATE TABLE BLC_EMAIL_HEADER
(
EMAIL_HEADER_ID bigint PRIMARY KEY NOT NULL,
ARCHIVED char(255),
CREATED_BY bigint,
DATE_CREATED timestamp,
DATE_UPDATED timestamp,
UPDATED_BY bigint,
ADMIN_ADDITION_STATUS varchar(255),
SNDBX_CATALOG_FLAG bigint,
SNDBX_ORIG_ITEM_ID bigint,
SNDBX_ORIG_RECORD_ID bigint,
SNDBX_ID bigint,
SNDBX_ARCHIVED_FLAG char(255),
SNDBX_DELETED_FLAG char(255),
SNDBX_TMPLT_RECORD_ID bigint,
SNDBX_TIER bigint,
SITE_DISC bigint,
MAP_KEY varchar(255),
VALUE varchar(255),
EMAIL_TEMPLATE_ID bigint NOT NULL,
CONSTRAINT FK954FC9F629D27305 FOREIGN KEY (EMAIL_TEMPLATE_ID) REFERENCES BLC_EMAIL_TEMPLATE (EMAIL_TEMPLATE_ID)
);
CREATE INDEX IDX_BLEMHE_SNDBX_TEM_ID ON BLC_EMAIL_HEADER (SNDBX_ORIG_ITEM_ID);
CREATE INDEX IDX_BLEMHE_SNDBX_ORD_ID ON BLC_EMAIL_HEADER (SNDBX_ORIG_RECORD_ID);
CREATE INDEX IDX_BLEMHE_SNDBX_ID ON BLC_EMAIL_HEADER (SNDBX_ID);
CREATE TABLE BLC_SMS_TEMPLATE
(
SMS_TEMPLATE_ID bigint PRIMARY KEY NOT NULL,
ACTIVE_END_DATE timestamp,
ACTIVE_START_DATE timestamp,
ARCHIVED char(255),
CREATED_BY bigint,
DATE_CREATED timestamp,
DATE_UPDATED timestamp,
UPDATED_BY bigint,
BODY longvarchar,
CONTENT_TARGETABLE boolean,
ADMIN_ADDITION_STATUS varchar(255),
SNDBX_CATALOG_FLAG bigint,
SNDBX_ORIG_ITEM_ID bigint,
SNDBX_ORIG_RECORD_ID bigint,
SNDBX_ID bigint,
SNDBX_ARCHIVED_FLAG char(255),
SNDBX_DELETED_FLAG char(255),
SNDBX_TMPLT_RECORD_ID bigint,
SNDBX_TIER bigint,
SITE_DISC bigint,
SMS_FROM varchar(255),
MEDIA_URL varchar(255),
NAME varchar(255),
OVERRIDE_TO boolean,
PRIORITY integer,
SMS_TO varchar(255),
TYPE varchar(255)
);
CREATE INDEX SMS_ACTIVE_END_INDEX ON BLC_SMS_TEMPLATE (ACTIVE_END_DATE);
CREATE INDEX SMS_ACTIVE_START_INDEX ON BLC_SMS_TEMPLATE (ACTIVE_START_DATE);
CREATE INDEX IDX_BLSMTE_SNDBX_TEM_ID ON BLC_SMS_TEMPLATE (SNDBX_ORIG_ITEM_ID);
CREATE INDEX IDX_BLSMTE_SNDBX_ORD_ID ON BLC_SMS_TEMPLATE (SNDBX_ORIG_RECORD_ID);
CREATE INDEX IDX_BLSMTE_SNDBX_ID ON BLC_SMS_TEMPLATE (SNDBX_ID);
CREATE INDEX SMS_MEDIA_URL_INDEX ON BLC_SMS_TEMPLATE (MEDIA_URL);
There are also four new columns to add to BLC_CONTENT_TARGETING_ACTION
:
ALTER TABLE BLC_CONTENT_TARGETING_ACTION ADD EMAIL_TEMPLATE_ID bigint;
ALTER TABLE BLC_CONTENT_TARGETING_ACTION ADD FOREIGN KEY (EMAIL_TEMPLATE_ID) REFERENCES BLC_EMAIL_TEMPLATE (EMAIL_TEMPLATE_ID);
ALTER TABLE BLC_CONTENT_TARGETING_ACTION ADD NEW_EMAIL_TEMPLATE_ID bigint;
ALTER TABLE BLC_CONTENT_TARGETING_ACTION ADD FOREIGN KEY (NEW_EMAIL_TEMPLATE_ID) REFERENCES BLC_EMAIL_TEMPLATE (EMAIL_TEMPLATE_ID);
ALTER TABLE BLC_CONTENT_TARGETING_ACTION ADD SMS_TEMPLATE_ID bigint;
ALTER TABLE BLC_CONTENT_TARGETING_ACTION ADD FOREIGN KEY (SMS_TEMPLATE_ID) REFERENCES BLC_SMS_TEMPLATE (SMS_TEMPLATE_ID);
ALTER TABLE BLC_CONTENT_TARGETING_ACTION ADD NEW_SMS_TEMPLATE_ID bigint;
ALTER TABLE BLC_CONTENT_TARGETING_ACTION ADD FOREIGN KEY (NEW_SMS_TEMPLATE_ID) REFERENCES BLC_SMS_TEMPLATE (SMS_TEMPLATE_ID);
In addition, be sure to add in the addition admin security entries from load_advanced_cms_admin_security.sql
:
-- Notification Entity Permissions
insert into BLC_ADMIN_PERMISSION (ADMIN_PERMISSION_ID, DESCRIPTION, NAME, PERMISSION_TYPE, IS_FRIENDLY) values (-22031, 'All Notification Templates', 'PERMISSION_ALL_NOTIFICATION_TEMPLATES', 'ALL', FALSE);
insert into BLC_ADMIN_PERMISSION (ADMIN_PERMISSION_ID, DESCRIPTION, NAME, PERMISSION_TYPE, IS_FRIENDLY) values (-22032, 'Read Notification Templates', 'PERMISSION_READ_NOTIFICATION_TEMPLATES', 'READ', FALSE);
insert into BLC_ADMIN_PERMISSION_ENTITY (ADMIN_PERMISSION_ENTITY_ID, CEILING_ENTITY, ADMIN_PERMISSION_ID) values (-22054, 'com.broadleafcommerce.advancedcms.notification.domain.EmailTemplate', -22031);
insert into BLC_ADMIN_PERMISSION_ENTITY (ADMIN_PERMISSION_ENTITY_ID, CEILING_ENTITY, ADMIN_PERMISSION_ID) values (-22055, 'com.broadleafcommerce.advancedcms.notification.domain.EmailHeader', -22031);
insert into BLC_ADMIN_PERMISSION_ENTITY (ADMIN_PERMISSION_ENTITY_ID, CEILING_ENTITY, ADMIN_PERMISSION_ID) values (-22056, 'com.broadleafcommerce.advancedcms.notification.domain.SMSTemplate', -22031);
insert into BLC_ADMIN_PERMISSION_ENTITY (ADMIN_PERMISSION_ENTITY_ID, CEILING_ENTITY, ADMIN_PERMISSION_ID) values (-22057, 'com.broadleafcommerce.advancedcms.notification.domain.EmailTemplate', -22032);
insert into BLC_ADMIN_PERMISSION_ENTITY (ADMIN_PERMISSION_ENTITY_ID, CEILING_ENTITY, ADMIN_PERMISSION_ID) values (-22058, 'com.broadleafcommerce.advancedcms.notification.domain.EmailHeader', -22032);
insert into BLC_ADMIN_PERMISSION_ENTITY (ADMIN_PERMISSION_ENTITY_ID, CEILING_ENTITY, ADMIN_PERMISSION_ID) values (-22059, 'com.broadleafcommerce.advancedcms.notification.domain.SMSTemplate', -22032);
INSERT INTO BLC_ADMIN_PERMISSION (ADMIN_PERMISSION_ID, DESCRIPTION, NAME, PERMISSION_TYPE, IS_FRIENDLY) VALUES (-22919,'Maintain Notification Templates','PERMISSION_NOTIFICATION_TEMPLATE', 'ALL', TRUE);
INSERT INTO BLC_ADMIN_PERMISSION (ADMIN_PERMISSION_ID, DESCRIPTION, NAME, PERMISSION_TYPE, IS_FRIENDLY) VALUES (-22920,'View Notification Templates','PERMISSION_NOTIFICATION_TEMPLATE', 'READ', TRUE);
-- Create child permission relationship
INSERT INTO BLC_ADMIN_PERMISSION_XREF (ADMIN_PERMISSION_ID, CHILD_PERMISSION_ID) VALUES (-22919, -22031);
INSERT INTO BLC_ADMIN_PERMISSION_XREF (ADMIN_PERMISSION_ID, CHILD_PERMISSION_ID) VALUES (-22920, -22032);
-- Tie the permission to a role
INSERT INTO BLC_ADMIN_ROLE_PERMISSION_XREF (ADMIN_ROLE_ID, ADMIN_PERMISSION_ID) VALUES (-1,-22919);
-- Create admin sections
INSERT INTO BLC_ADMIN_SECTION (ADMIN_SECTION_ID, CEILING_ENTITY, ADMIN_MODULE_ID, NAME, SECTION_KEY, URL, USE_DEFAULT_HANDLER, DISPLAY_ORDER) VALUES (-22010, 'com.broadleafcommerce.advancedcms.notification.domain.EmailTemplate', -2, 'Email Template', 'EmailTemplate', '/email-template', TRUE, 9000);
INSERT INTO BLC_ADMIN_SECTION (ADMIN_SECTION_ID, CEILING_ENTITY, ADMIN_MODULE_ID, NAME, SECTION_KEY, URL, USE_DEFAULT_HANDLER, DISPLAY_ORDER) VALUES (-22011, 'com.broadleafcommerce.advancedcms.notification.domain.SMSTemplate', -2, 'SMS Template', 'SMSTemplate', '/sms-template', TRUE, 10000);
-- Tie permissions to admin sections
INSERT INTO BLC_ADMIN_SEC_PERM_XREF (ADMIN_SECTION_ID, ADMIN_PERMISSION_ID) VALUES (-22010,-22919);
INSERT INTO BLC_ADMIN_SEC_PERM_XREF (ADMIN_SECTION_ID, ADMIN_PERMISSION_ID) VALUES (-22010,-22920);
INSERT INTO BLC_ADMIN_SEC_PERM_XREF (ADMIN_SECTION_ID, ADMIN_PERMISSION_ID) VALUES (-22011,-22919);
INSERT INTO BLC_ADMIN_SEC_PERM_XREF (ADMIN_SECTION_ID, ADMIN_PERMISSION_ID) VALUES (-22011,-22920);