Upgrades
Upgrades
Brightspot Enterprise 4.5 to 4.7 Developer Upgrade Guide

Adding 4.7 Features Guide



Release Notes / Documentation

This feature is enabled by default.

These implementations are required for the Drag and Drop functionality of the Board View to work correctly.

Caution
Any fields/methods that have the @BoardSearchResultField annotation applied need to be re-indexed to function correctly.

If your project contains AuthorableData or SectionableData

If your project does not contain either of these classes, refer to the below section for alternative implementations.

On AuthorableData and SectionableData, add @BoardSearchResultField to the relevant field as the examples show below, ensuring that all existing annotations remain applied to the field.

    @BoardSearchResultField
    private List<AuthoringEntity> authors;
    @BoardSearchResultField
    private Section section;


If your project uses HasAuthorWithField , HasSectionWithField, or HasPodcastWithField

If your project uses these classes, you should implement the @BoardSearchResultField annotation as follows.

Apply the annotation to these classes using an alteration. Use the writeField annotation parameter to modify the correct field.

Here is an example of this applied to HasSectionWithField, but a similar pattern can be followed for authors and podcasts.

public class HasSectionWithFieldAlteration extends Alteration<HasSectionWithField> {
    @BoardSearchResultField(writeField = "hasSectionWithField.section")
    @InternalName("hasSection.getSectionParent")
    private Section getSectionParent;
}
Tip
Notice how the above code applies the annotation to getSectionParent. This is an indexed method on the class HasSectionData. It then uses the writeField parameter to specify which field will write the data to that indexed method.


Documentation

This feature is enabled by default.

Remove the following dependencies if they are present on your project to ensure there is no conflict with legacy functionality. Removing these dependencies will ensure the feature works as intended by default.

Remove:

  • com.psddev:watch
  • lib-model-cms-auto-watch

Documentation


This feature is enabled by default.

Add com.psddev:content-reporting dependency. Set Brightspot version to 4.7.13+.


This feature is disabled by default. To enable it, go into Sites & Settings > Global > Integrations tab > Open AI cluster > Enabled.

Add com.psddev:openai dependency.


Previously in versions <- 4.5, there was a Taxonomy Search Result View (supported by Taxon). In 4.7, this has been removed and replaced by Hierarchy Search Result View (supported by Hierarchy). This features is always enabled. In order to support the new view, implement the changes below as needed.

Add UnresolvedState from GO Library

If your project does not have the dependency com.brightspot.go:lib-util-unresolved-state, then you need to define your Brightspot GO version and add that dependency. This will be used in later steps.

Note
If your application codebase does not already depend on com.brightspot.go, you may need to add a line for this version management to the settings.gradle file where versions for bom dependencies are managed. Refer to the version specified in Brightspot Dependency Version Upgrades Guide. This additional dependency management is only needed if your application contains any dependencies relocated to com.brightspot.go.

It is recommended to leave the comment in the code block below alongside the version to note the purpose of adding the com.brightspot.go dependency management.

If version management for com.brightspot.go needs to be added to the settings.gradle, ensure that the versions configuration block contains the line in the example below:

    versions {
        ... // likely other versions such as componentLib or brightspot
        brightspotGo = '1.4.5'  // Using com.brightspot.go for library dependencies moved from component-lib
    }


Remove all usages of ExpressTaxon

This interface was used to drive the Taxonomy Search Result View. We need to eliminate all usages of this interface and replace them.

If your project contains brightspot.core.hierarchy.Hierarchy

This class is incompatible with newer hierarchy versions. If this class exists on the project or is in use anywhere, all usages need to be removed.

Follow the below steps for remediation.

Navigate to brightspot.core.hierarchy.Hierarchy and refactor the name to LegacyHierarchy.

Remove the extension of ExpressTaxon from this class class and implement Hierarchy (full path is com.psddev.cms.tool.Hierarchy)

Change the getParents() method to the following:

    @Override
    default Set<Hierarchy> getParents() {
        return Optional.ofNullable(getParent())
            .map(parent -> parent.as(Hierarchy.class))
            .map(Collections::singleton)
            .orElse(null);
    }


Below is an example of fully updated class:

public interface LegacyHierarchy extends Hierarchical,
    Hierarchy,
    TypeSpecificCascadingPageElements {

    Hierarchy getParent();

    @Override
    default Set<Hierarchy> getParents() {
        return Optional.ofNullable(getParent())
            .map(parent -> parent.as(Hierarchy.class))
            .map(Collections::singleton)
            .orElse(null);
    }
}


Next, navigate to SectionableData and change the method getSectionAndAncestors() to the following (ensure that you maintain any annotations applied to the method).

    public Set<? extends LegacyHierarchy> getSectionAndAncestors() {
        return Optional.ofNullable(section)
            .map(s -> TaxonUtils.getAncestors(s, t ->
                Optional.ofNullable(t.getParents()).orElseGet(Collections::emptySet).stream()
                    .filter(Section.class::isInstance)
                    .map(Section.class::cast)
                    .map(UnresolvedState::resolve)
                    .filter(Objects::nonNull)
                    .collect(Collectors.toSet())))
            .map(HashSet::new)
            .map(set -> {
                Section resolvedSection = StateUtils.resolve(section);
                if (resolvedSection != null) {
                    set.add(resolvedSection);
                }
                return set;
            })
            .orElse(null);
    }


Next, navigate to any class that implements LegacyHierarchy and remove the methods isRoot() and getChildren(). Two common classes that implement this are Section and OneOffPage.

Remove other usages of ExpressTaxon

A common place this is found to be implemented is on Tag. Follow this pattern for other classes that implement ExpressTaxon.

In Tag.java, replace ExpressTaxon<Tag> with Hierarchy (full path is com.psddev.cms.tool.Hierarchy).

Next, remove isRoot() and getChildren() from Tag.

Change the implementation of getParents() to the following:

    @Override
    public Set<Hierarchy> getParents() {
        return Optional.ofNullable(getParent()).map(Hierarchy.class::cast).map(Collections::singleton).orElse(null);
    }

Add the following method:

public Tag getTagParent() {
    return parent;
}


Navigate to TaggableData and change the implementation of getTagsAndAncestors() to the following (ensure that any annotations are maintained on the method).

    public Set<Tag> getTagsAndAncestors() {
        Set<Tag> tagsAndAncestors = new LinkedHashSet<>();
        Set<Tag> visited = new HashSet<>();
        Queue<Tag> toProcess = new LinkedList<>(getTags());
        while (!toProcess.isEmpty()) {
            Tag next = toProcess.remove();
            if (!visited.add(next)) {
                continue;
            }
            tagsAndAncestors.add(next);
            Optional.ofNullable(UnresolvedState.resolveAndGet(next, Tag::getTagParent))
                .ifPresent(toProcess::add);
        }
        return tagsAndAncestors;
    }


Remove all usages of TaxonParentExtension

Note
Your project will likely not include TaxonParentExtension if it included usages of ExpressTaxon.

If your project uses the interface TaxonParentExtension, you need to remove the interface and replace it with Hierarchy.

By removing TaxonParentExtension, you will need to remove the methods getTaxonParent() and getTaxonChildrenQuery().

You will then need to implement the method getParents(). Below is an example of this implementation on SectionPage.

    @Override
    public Set<Hierarchy> getParents() {
        return Optional.ofNullable(getParent()).map(Hierarchy.class::cast).map(Collections::singleton).orElse(null);
    }


Reindex updated hierarchy data

After completion of the above steps, you will need to ensure that you re-index the type com.psddev.cms.tool.Hierarchy, and then run a SQL -> SOLR index on the same type.

This step will need to be completed after the build is deployed to environment. Ensure that this step is completed immediately after production deployment to ensure the hierarchy search results are functioning as expected.

Previous Topic
4.5 to 4.7 Table of Contents
Next Topic
4.7 Breaking Changes Guide
Was this topic helpful?
Thanks for your feedback.

Browse All Docs

Everything you need to know when creating, managing, and administering content within Brightspot CMS.

Dashboards
Publishing
Workflows
Admin configurations
A guide for installing, supporting, extending, modifying and administering code on the Brightspot platform.

Field types
Content modeling
Rich-text elements
Images
A guide to configuring Brightspot's library of integrations, including pre-built options and developer-configured extensions.

Google Analytics
Shopify
Apple News
Brightspot is packaged with content types that get you up and running in a matter of days, including assets, modules and landing pages.

Assets
Modules
Landing pages
Our robust, flexible Design System provides hundreds of pre-built components you can use to build the presentation layer of your dreams.

Asset types
Module types
Page types