var result = server.ADF.objectFactory.getBean("CSPage_1_0").createPage(arguments.stdMetadata, arguments.custMetadata); // TODO needs to verify security var deletePageResult = structNew(); var csPage = server.ADF.objectFactory.getBean("CSPage_1_0"); deletePageResult = csPage.deletePage(arguments.pageData); var data = structNew(); var updateResults = ""; // Get the RTE element name to update from the config var controlName = application.ptImport.appConfig.new_content_container; //data.textblock = arguments.content; data.textblock = Replace(arguments.content, """, "'", "all"); data.caption = arguments.caption; data.pageID = arguments.pageID; data.subsiteID = application.ptImport.CSData.getSubsiteIDByPageID(data.pageID); data.templateName = application.ptImport.CSData.getSubsiteIDByPageID(data.pageID); data.submitChange = 1; data.submitChange_comment = "Content populated from the PT Import Content application."; if ( arguments.controlCount GT 1 ){ controlName = controlName & arguments.controlCount; } updateResults = server.ADF.objectFactory.getBean("ptImport_CSContent").populateContent(application.ptImport.appConfig.ccapi_element, data, controlName); SELECT DISTINCT LinkUsage.PageID as csPageID FROM LinkUsage ORDER BY LinkUsage.PageID SELECT * FROM #appConfig.page_mapping_view# WHERE sourceID = '#arguments.sourceID#' WHERE pageID = #arguments.pageID# WHERE newPageID = #arguments.newPageID# WHERE oldPageID = #arguments.oldPageID# var createResults = server.ADF.objectFactory.getBean("CSContent_1_0").populateContent("pageMap", arguments.data); var retDataQry = ""; // Get the subsite mapping data for subsites to get these subsites pages var subsiteMapQry = ""; var newSubsiteURLList = ""; // Check if migration if ( application.ptImport.appConfig.migration ) retDataQry = getSourceDataCS(arguments.oldPageID, arguments.ID); else retDataQry = getSourceDataExternal(arguments.oldPageID, arguments.ID); // Get the subsite mapping data for subsites to get these subsites pages subsiteMapQry = application.ptImport.subsiteDAO.getMappingData(isCreated=true); newSubsiteURLList = ValueList(subsiteMapQry.newSubsiteURL); SELECT * FROM retDataQry WHERE newSubsiteURL IN () ORDER BY ID var dataQry = ""; var subsiteMapQry = ""; var subsiteMapIDList = ""; var sitePagesQry = ""; subsiteMapQry = application.ptImport.subsiteDAO.getMappingData(); subsiteMapIDList = ValueList(subsiteMapQry.oldSubsiteID); SELECT * FROM SitePages WHERE SitePages.subsiteID IN () AND SitePages.pageType = 0 AND SitePages.InheritedTemplateList <> '' AND SitePages.ID = AND SitePages.ID = SELECT sitePagesQry.ID AS ID, sitePagesQry.ID AS OldPageID, subsiteMapQry.OldSubsiteID AS OldSubsiteID, subsiteMapQry.OldSubsiteURL AS OldSubsiteURL, subsiteMapQry.newSubsiteURL AS NewSubsiteURL, subsiteMapQry.TemplateName AS TemplateName, sitePagesQry.Name AS Name, sitePagesQry.Title AS Title, '' AS Keywords, sitePagesQry.Description AS Description, '' AS ContentData, sitePagesQry.PublicReleaseDate AS PublicationDate, sitePagesQry.DateAdded AS DateCreated FROM sitePagesQry, subsiteMapQry WHERE sitePagesQry.subsiteID = subsiteMapQry.OldSubsiteID AND subsiteMapQry.newSubsiteID <> 0 var verifySourceDB = verifySourceTable(); var dataQry = QueryNew("null"); var sourceTable = "page_mapping"; SELECT * FROM #sourceTable# WHERE OldPageID = WHERE ID = ORDER BY ID var verifySourceDB = verifySourceTable(); var sourceTable = "page_mapping"; INSERT INTO #sourceTable# ( OldPageID, OldSubsiteID, OldSubsiteURL, NewSubsiteURL, TemplateName, Name, Title, Keywords, Description, ContentData, PublicationDate, DateCreated ) VALUES ( , , , , , , , , , , , ) var verifySourceDB = verifySourceTable(); var sourceTable = "page_mapping"; UPDATE #sourceTable# SET OldSubsiteID = , OldSubsiteURL = , NewSubsiteURL = , TemplateName = , Name = , Title = , Keywords = , Description = , ContentData = , PublicationDate = WHERE OldPageID = SELECT * FROM INFORMATION_SCHEMA.TABLES WHERE TABLE_NAME = '#sourceTable#' CREATE TABLE #sourceTable# ( [ID] [int] IDENTITY(1,1) NOT NULL, [OldPageID] [varchar](max) NULL, [OldSubsiteID] [varchar](max) NULL, [OldSubsiteURL] [varchar](max) NULL, [NewSubsiteURL] [varchar](max) NULL, [TemplateName] [varchar](max) NULL, [Name] [varchar](max) NULL, [Title] [varchar](max) NULL, [Keywords] [varchar](max) NULL, [Description] [varchar](max) NULL, [ContentData] [varchar](max) NULL, [PublicationDate] [varchar](max) NULL, [DateCreated] [varchar](max) NULL ) CREATE SEQUENCE #sourceTable#_seq START WITH 1 INCREMENT BY 1 CACHE 100 CREATE OR REPLACE TRIGGER populate_#sourceTable#_id BEFORE INSERT ON #sourceTable# FOR EACH ROW BEGIN IF( :new.id is null ) THEN :new.id := #sourceTable#_seq.nextval; END IF; END; CREATE TABLE #sourceTable# ( ID NUMBER NOT NULL PRIMARY KEY, OldPageID VARCHAR2(1000) NULL , OldSubsiteID VARCHAR2(1000) NULL , OldSubsiteURL VARCHAR2(1000) NULL , NewSubsiteURL VARCHAR2(1000) NULL , TemplateName VARCHAR2(1000) NULL , Name VARCHAR2(1000) NULL , Title VARCHAR2(1000) NULL , Keywords VARCHAR2(1000) NULL , Description VARCHAR2(2000) NULL , ContentData VARCHAR2(2000) NULL , PublicationDate VARCHAR2(1000) NULL , DateCreated VARCHAR2(1000) NULL ) CREATE TABLE #sourceTable# ( `ID` INT NOT NULL AUTO_INCREMENT , OldPageID VARCHAR(1000) NULL , OldSubsiteID VARCHAR(1000) NULL , OldSubsiteURL VARCHAR(1000) NULL , NewSubsiteURL VARCHAR(1000) NULL , TemplateName VARCHAR(1000) NULL , Name VARCHAR(1000) NULL , Title VARCHAR(1000) NULL , Keywords VARCHAR(1000) NULL , Description VARCHAR(2000) NULL , ContentData TEXT NULL , PublicationDate VARCHAR(1000) NULL , DateCreated VARCHAR(1000) NULL, PRIMARY KEY (ID) ) var dataQry = QueryNew("null"); // Verify the page mapping view table exists var mappingViewExists = application.ptImport.ImportService.verifyMappingView(elementName="Page Mapping",tableViewName=application.ptImport.appConfig.page_mapping_view); SELECT DISTINCT LinkUsage.PageID AS csPageID, view_page_mapping_ce_data.name, view_page_mapping_ce_data.newSubsiteURL, view_page_mapping_ce_data.title, view_page_mapping_ce_data.PageID AS dataPageID, view_page_mapping_ce_data.formID, view_page_mapping_ce_data.dateCreated FROM LinkUsage INNER JOIN view_page_mapping_ce_data ON LinkUsage.PageID = view_page_mapping_ce_data.newPageID WHERE (LinkUsage.VersionState > 2) AND (LinkUsage.FieldName = 'TEXTBLOCK') ORDER BY view_page_mapping_ce_data.newSubsiteURL, csPageID SELECT PageID, ControlID FROM Data_Textblock WHERE VersionState = 2 ORDER BY PageID SELECT PageID, textblock FROM Data_Textblock WHERE PageID = #srcDataQry.PageID# AND ControlID = #srcDataQry.ControlID# AND VersionState = 2 UPDATE Data_Textblock SET textblock = '#srcTextblockQry.textblock#' WHERE PageID = #srcDataQry.PageID# AND ControlID = #srcDataQry.ControlID# AND VersionState = 2 var globalKeywordsList = ""; var qryGlobalKeywords = QueryNew("tmp"); var keywordObj = ""; SELECT Distinct Keyword FROM Keywords,UserKeywords WHERE Keywords.ID=UserKeywords.KeywordID AND UserID=0 AND PageID= ORDER BY Keyword // Get the list of global keywords from the qryGlobalKeywords query if ( qryGlobalKeywords.RecordCount gt 0 ) globalKeywordsList = ValueList(qryGlobalKeywords.Keyword); return TRIM(globalKeywordsList); var rteDataArray = ArrayNew(1); // If running migration, get the textblocks for the page if ( application.ptImport.appConfig.migration ){ // Get the textblock array for the old page id rteDataArray = application.ptImport.ElementController.getPageTextBlocks(pageid=arguments.oldPageID, dataSource=application.ptImport.appConfig.migration_DSN, siteType="old"); } return rteDataArray;