You are on page 1of 8

ONBOARDING A NEW DESIGN INTO NEXUS VIA SQL SCRIPT

Summary:

When we are going to introduce a new design into nexus, we must configure few things which is going to explain in
this document.

Database access required:

CICDCommon (mandatory)

Nexus (optional)

FileFunCom (optional)

Code repo access required:

ja-nexus (mandatory)

ja-pagecontentservice (optional)

SQL code changes:

1) Landing Page Type


It handles all the page type like Javatar, SIP etc.

If you are going to introduce new page type, then you must add new page type into
PAGECONTENTSERVICE.LANDINGPAGETYPE.

Required Column Description


LandingPageTypeId Id column of the table
Name Name of the page type
Description Page type description
IsActive Active status of the page type
PartnerId Partner id of the table
(PAGECONTENTSERVICE.PARTNER)

Example: Following script insert a new page type “SIP” in the table

insert into pagecontentservice.landingpagetype(


[landingpagetypeid], [name], [description], [isactive], [partnerid])
values(1,'sip','landing pages are of sip type',1, 1);
2) Landing Page Design
Under a page type there can be multiple type of design like “SIP” page type contain design “BTC”. To add
a new page design, you have to add entry in PAGECONTENTSERVICE.LANDINGPAGEDESIGN table.

Required Column Description


LandingPageDesignId Id column of the table
Name Name of the design
Description Design description
IsActive Active status of the page design
LandingPageTypeId Page type id under which design will be
(PAGECONTENTSERVICE.LANDINGPAGETYPE)

Example: following script insert a new design named “BTC” in the under-page type “SIP”

insert into pagecontentservice.landingpagedesign(


[landingpagedesignid],
[name],
[description],
[isactive],
[landingpagetypeid])
values(1,'btc','landing pages design type of sip pages',1,(select landingpagetypeid from
pagecontentservice.landingpagetype where name = 'sip'));

3) Content Level
This has all content level for a page like category, page, domain etc, which has to be inserted in the table
PAGECONTENTSERVICE.CONTENTLEVEL.

Required Column Description


ContentLevelId Id column of the table
Name Name of the design
Description Design description

Example: Following script add two level named “Page” & “Category”

insert into [pagecontentservice].[contentlevel]


([contentlevelid] ,[name],[description])
values
(1,'page','content at page level'),
(2,'category','content at category level');

4) Content Level – Device Category


Next you have map content level with the device. Currently nexus support three type of device (desktop,
mobile & table).

Required Column Description


ContentLevelId Id of the content level (Not null)
(PAGECONTENTSERVICE.CONTENTLEVEL)
DeviceCategoryId Id of the device category (Nullable)
(PAGECONTENTSERVICE.DEVICECATEGORY)

Example: Following script is going to map content level (page, category) with device category (desktop, mobile &
laptop)

declare @pagelevelid int = (select contentlevelid


from [pagecontentservice].contentlevel
where name = 'page')
declare @categorylevelid int = (select contentlevelid
from [pagecontentservice].contentlevel
where name = 'category')
declare @desktopcategoryid int = (select devicecategoryid
from [pagecontentservice].devicecategory
where name = 'desktop')
declare @mobilecategoryid int = (select devicecategoryid
from [pagecontentservice].devicecategory
where name = 'mobile')
declare @tabletcategoryid int = (select devicecategoryid
from [pagecontentservice].devicecategory
where name = 'tablet')

if not exists (select * from pagecontentservice.contentleveldevicecategory)


begin
insert into [pagecontentservice].contentleveldevicecategory
([contentlevelid]
,[devicecategoryid])
values
(@pagelevelid,null)
(@pagelevelid,@desktopcategoryid),
(@pagelevelid,@mobilecategoryid),
(@pagelevelid,@tabletcategoryid),
(@categorylevelid,null),
(@categorylevelid,@desktopcategoryid),
(@categorylevelid,@mobilecategoryid),
(@categorylevelid,@tabletcategoryid)

End

5) Page Attribute
It has all the attributes which can be seen and edited in Nexus.
To understand what attribute is let check below image. In the below image each section(this portion is
taken from expert section of a javatar page) which some data can be identified as separate attribute.
Attributes are normally uniquely idenfied their name.

Required Column Description


PageAttributeId Id of the attribute
PageAttributeName Name of the attribute
PageAttributeDisplayName Display name
PageAttributeType Type of the attribute like number, text, Boolean,
URL etc.
PageAttributeDescription Description for the attribute

Example: Below script is for how to add page attribute in the table PAGECONTENTSERVICE.PAGEATTRIBUTE

insert into pagecontentservice.pageattribute(pageattributename, pageattributetype, pageattributedisplayname, pageattributedescription)


values
--askalawyeroncall.com domain attributes at domain level
('domain.settings.head.domainname', 'domain name', 'text', 'domain name'),
('domain.landingpageid', 'id', 'number', 'landing page id'),
('domain.isactive', 'isactive', 'bool', 'isactive'),
('domain.tags', 'tags', 'text', 'tags');

6) Page Attribute Validator


It contains all the client validation required for an attribute like maximum length validation, required field
validation etc.

Required Column Description


PageAttributeId Id of the attribute
(PAGECONTENTSERVICE.PAGEATTRIBUTE)
ValidatorData Validator data in json format

Example: Below script is for how to add page attribute in the table PAGECONTENTSERVICE.ATTRIBUTEVALIDATORS
table

insert into pagecontentservice.attributevalidators(pageattributeid, validatordata)


values((select pageattributeid from [pagecontentservice].pageattribute where pageattributename =
'page.domainname'), '{"ismandatory": true}');

7) Page Design – Conte Level – Device Category

It maps design and ContentLevelDeviceCategory. Forex: BTC design has 3 content level Page, category, and
vertical.

Required Column Description


LandingPageDesignId Id of the attribute
(PAGECONTENTSERVICE.PAGEATTRIBUTE)
ContentLevelDeviceCategoryId Id of the contentleveldevicecategory
UniquePageAttributeId Attribute id which is unique for design
DisplayNamePageAttributeId Attribute id which is used as display field
TagNamePageAttributeId Attribute id for tag
ParentId Parent Id for hierarchy
DataSource Data provide source URL
ComponentService Component service

Example:
declare @pagedesignid int = (select landingpagedesignid
from [pagecontentservice].landingpagedesign where name = 'javatardesignv1');

declare @pagelevelid int = (select contentlevelid


from [pagecontentservice].contentlevel where name = 'page');

declare @desktopcategoryid int = (select devicecategoryid


from [pagecontentservice].devicecategory where name = 'desktop');

declare @contentleveldevicecategoryid int = (select contentleveldevicecategoryid


from [pagecontentservice].contentleveldevicecategory
where contentlevelid = @pagelevelid
and devicecategoryid = @desktopcategoryid);
declare @domainid int = (select domainid
from [pagecontentservice].domain where domainname = 'www.testdomain.com');

declare @pageattributeid int = (select pageattributeid


from [pagecontentservice].pageattribute where pageattributename = 'name');

if not exists (select * from pagecontentservice.pagedesigncontentleveldevicecategory)


begin
insert into [pagecontentservice].pagedesigncontentleveldevicecategory
([landingpagedesignid]
,[contentleveldevicecategoryid]
,[domainid]
,[uniquepageattributeid]
,[displaynamepageattributeid]
,[datasource]
,[Componentservice])
values

(@pagedesignid,@contentleveldevicecategoryid,@domainid,@pageattributeid,@pageattributeid,@datasourceifany,
@componentservviceifany)

end

8) Page Design – Conte Level – Device Category - Attribute

It maps PageAttribute metaData per design content level like Headline.


Also, it provides some additional information about attribute like read-only, sequence in the screen, is
always displays in the screen etc.

Required Column Description


LIsAlwaysDisplayed Is attribute field is always going to be display in nexus

SequenceOrder Sequence of field in nexus


IsReadOnly Is field is readonly in nexus
PageAttributeId Id of the attribute
(PAGECONTENTSERVICE.PAGEATTRIBUTE)
PageDesignContentLevelDeviceCategoryId Id of PageDesignContentLevelDeviceCategory
PAGECONTENTSERVICE.
PAGEDESIGNCONTENTLEVELDEVICECATEGORY)
PageAttributeSourceId Source of the attribute
(PAGECONTENTSERVICE.PAGEATTRIBUTESOURCE)

Example: Below script is going to insert data in PAGECONTENTSERVICE.


PAGEDESIGNCONTENTLEVELDEVICECATEGORYATTRIBUTE

DECLARE @PreUrlAttributeId SMALLINT = (SELECT PageAttributeId


FROM [pagecontentservice].PageAttribute WHERE PageAttributeName = 'PreUrl');

DECLARE @PageContentLevelId TINYINT = (SELECT ContentLevelID

FROM [pagecontentservice].ContentLevel WHERE Name = 'Page');


DECLARE @BTCLandingPageDesignId SMALLINT = (SELECT LandingPageDesignId
FROM [pagecontentservice].LandingPageDesign WHERE Name = 'BTC');

DECLARE @PageContentLevelDeviceCategoryId int = (SELECT ContentLevelDeviceCategoryId


FROM [pagecontentservice].ContentLevelDeviceCategory
WHERE ContentLevelId = @PageContentLevelId
AND DeviceCategoryId is null);

DECLARE @SIPPage_PageDesignContentLevelDeviceCategoryId SMALLINT = (


SELECT PageDesignContentLevelDeviceCategoryId
FROM [pagecontentservice].PageDesignContentLevelDeviceCategory
WHERE LandingPageDesignId = @BTCLandingPageDesignId
AND ContentLevelDeviceCategoryId = @PageContentLevelDeviceCategoryId)

DECLARE @CategoryHierarchyNodePageSourceId SMALLINT = (


SELECT PageAttributeSourceId
FROM [pagecontentservice].PageAttributeSource
WHERE PageAttributeSourceTable = 'CategoryHierarchyNode'
AND PageAttributeSourceLevel = 'page')
INSERT INTO pagecontentservice.PageDesignContentLevelDeviceCategoryAttribute(IsAlwaysDisplayed, SequenceOrder,
PageAttributeId, PageDesignContentLevelDeviceCategoryId,PageAttributeSourceId,IsReadOnly)
VALUES
-- SIP Page Values
(1, 1, @PreUrlAttributeId, @SIPPage_PageDesignContentLevelDeviceCategoryId,
@CategoryHierarchyNodePageSourceId, 0);

API code changes:

In API if you need to add any design specific validation then you have to make few code changes.

1) Add a validation class that inherit “IValidator” interface.

2) Implement “Validate” method write your own logic for validation.

3) Add required UnitTest.

You might also like