Upgrading Legacy Titan - Refactoring Code

Author:Aaron S. and Amanda A.
Last Updated:February 16, 2022 12:43 PM

This provides an overview of refactoring code when upgrading a legacy Titan instance to v6.9.5 and v.7. There are specific tips for v6.9.5 and v7.

v6.9.5 Refactoring

Namespaces

The below are examples of old namespaces that will need to be updated to the new namespace. Custom code is likely to have these. Using Find and Replace can make these changes easier. Be sure not to replace with a misspelling! 

OLD NAMESPACE NEW NAMESPACE
CustomComponents  [ClientID].Titan.Public.Components 
CustomDatabase  [ClientID].Titan.Public.Database
CustomDisplay  [ClientID].Titan.Public.Display
CustomUISupport  [ClientID].Titan.Public.UISupport 
CustomWcfContracts  [ClientID].Titan.Public.WcfContracts 
CustomWcfServiceProxies  [ClientID].Titan.Public.WcfServiceProxies
CustomWcfServices  [ClientID].Titan.Public.WcfServices 
CustomWorkstation  [ClientID].Titan.Public.Wkst 
[CustomProject] [ClientID].Titan.Public.[CustomProject] 

 

Web.config transformations

The web.config tranformation files have examples, but the most common example is adding rewrite rules.

 

v7 Refactoring

NWS.Titan.Modules.Accessibility

If the instance is using the NWS.Titan.Modules.Accessibility package, there is no v7 equivalent. The NWS.Titan.Modules.Accessibility package will need to be removed and the NWS.Titan.Modules.Accessibility.Support packages in v7 replaces it. There will likely be a v6 version of NWS.Titan.Modules.Accessibility.Support already installed, so all that needs to happen is deleting the other package.

XSLs and other template

XSL and template will need to be updated. Check if they are using legacy JS.

JS patterns

Upgrade JavaScript patterns in XSLs and custom code. View the V7 JavaScript upgrade guide.

Page Layouts

Page layouts for themes/client instances must be converted to razor files. View the Page Layout upgrade guide.

Custom Themes

If a Custom Theme is using a different base file like RWD_Blocks.css or Responsive_blocks.css, the following css needs to be added:

/* provide space before 'uses' */
span.uses {margin-left: 5px;}

Image file type icons as svg are new in v7 and some css is necessary for them to display. This css was added to the Base version of ReFlex and the ReFlex core package, but it needs to be added manually for sites relying on other structural css files (like RWD_blocks.css in this instance).

img[src*="FileTypeImages"] {height: 40px;width: 40px;}

Custom Browse Views

Check if there are any Custom Browse Views by looking at the Browse Views table. If the Browse View contains a Table element, confirm that it does not have a WHERE clause. If it does, move it to the PreFilterClauses element:

<PreFilterClauses>
      <PreFilterClause>
           DocumentType.SupportsURLRewriting = 1
      </PreFilterClause>
</PreFilterClauses> 

Custom Blocks

Custom blocks - view comprehensive block upgrade guide

Custom Code and handler

Any other custom code, including handlers, etc. - view app block upgrade guide

Environment Packages

If they are still using Environment packages (like [ClientID].Titan.Public.Environment.[Instance]), remove these as we should using Environment specific packages (like NWS.Titan.Modules.Environment.Debug and NWS.Titan.Modules.Environment.Release)

Background Tasks

DataNodeLoader Background Task 

The following updates need to be made:

  • DataNodeLoader\UtilityClasses\DataRow.cs -- add missing Classification Type:
    switch (classification.Type)
    {
        case ClassificationType.Public:
            publicCreate.Add(classificationElement);
            publicUpdate.Add(classificationElement);
            break;
        case ClassificationType.Schema:
            schemaCreate.Add(new XElement(classification.XPathName, classificationElement));
            schemaUpdate.Add(new XElement(classification.XPathName, classificationElement));
            break;
        case ClassificationType.Lookup:
            schemaCreate.Add(new XElement(classification.XPathName, classificationElement));
            schemaUpdate.Add(new XElement(classification.XPathName, classificationElement));
            break;
    }
    
  • DataNodeLoader\UtilityClasses\ClassificationType.cs -- add missing enum value:
    public enum ClassificationType
    {
        Public,
        Schema,
        Lookup
    }
    
  • DataNodeLoader\GenericDataNodeLoader.cs -- change Classification:
    Classification lookup = new Classification(df.ClassificationID.Value, AttributeIds, ClassificationType.Lookup);
    lookup.XPathName = df.XPathName;
    dataNodeItem.Add(lookup);
    

 

Import File Task Background Task or Load File to Data Node Background Task

Check the SourceFileDir element in the config for an ftp location. If it looks like the below:

\\hostingprodsstoragenws.file.core.windows.net\files\Sites\[ClientID]\Titan\Public\FTP\[directory]\[subdirectory]

The following updates need to be made:

  • Create request for Brian to allow access to the above directory for the TitanBackgroundUser on the new server. For example, if setting up an environment on host-dev-2, the TitanBackgroundUser on host-dev-2, needs access to the above directory. If setting up an environment on host-prod-2, the TitanBackgroundUser on host-prod-2, needs access to the above directory.
  • Update the [ClientID]_Titan_Public background service on the server to log in as the Titan Admin Proxy.
    • Log in to the new server and open Services by searching in the start menu.
    • Scroll to the [ClientID]_Titan_Public background service and right click and select Properties.
    • Click on the Log On tab
    • Select This Account and enter the Titan Proxy Admin user and password [lookup in keepass]
    • Click Ok
    • Stop and restart the service
    • Retest the service and confirm it completes
top