Skip to content

Commit

Permalink
Added helper class for analyzing content type usage.
Browse files Browse the repository at this point in the history
  • Loading branch information
gWestenberger committed Dec 1, 2023
1 parent 9fc10e0 commit 78c9d13
Show file tree
Hide file tree
Showing 3 changed files with 742 additions and 0 deletions.
25 changes: 25 additions & 0 deletions src/org/opencms/ade/configuration/CmsADEConfigCacheState.java
Original file line number Diff line number Diff line change
Expand Up @@ -108,6 +108,9 @@ public class CmsADEConfigCacheState {
/** Cached list of subsites to be included in the site selector. */
private volatile List<String> m_subsitesForSiteSelector;

/** Cached set of names of content types anywhere in the configuration. */
private volatile Set<String> m_contentTypes;

/**
* Creates a new configuration cache state.<p>
*
Expand Down Expand Up @@ -265,6 +268,28 @@ public CmsSitemapAttributeEditorConfiguration getAttributeEditorConfiguration(Cm
return m_sitemapAttributeEditorConfigurations.get(id);
}

/**
* Gets the set of content types configured anywhere in sitemap configurations.
*
* @return the set of content types
*/
public Set<String> getContentTypes() {

if (m_contentTypes == null) {
Set<String> contentTypes = new HashSet<>();
for (CmsADEConfigDataInternal config : m_siteConfigurations.values()) {
for (CmsResourceTypeConfig typeConfig : config.getOwnResourceTypes()) {
contentTypes.add(typeConfig.getTypeName());
}
}
for (CmsResourceTypeConfig typeConfig : m_moduleConfiguration.getOwnResourceTypes()) {
contentTypes.add(typeConfig.getTypeName());
}
m_contentTypes = Collections.unmodifiableSet(contentTypes);
}
return m_contentTypes;
}

/**
* Gets the detail page information for everything.<p>
*
Expand Down
13 changes: 13 additions & 0 deletions src/org/opencms/ade/configuration/CmsADEManager.java
Original file line number Diff line number Diff line change
Expand Up @@ -409,6 +409,19 @@ public Set<String> getConfiguredWorkplaceBundles() {
return configData.getConfiguredWorkplaceBundles();
}

/**
* Gets the content types configured in any sitemap configuations.
*
* @param online true if the types for the Online project should be fetched
* @return the set of content types
*/
public Set<String> getContentTypeNames(boolean online) {

CmsConfigurationCache cache = online ? m_onlineCache : m_offlineCache;
return cache.getState().getContentTypes();

}

/**
* Reads the current element bean from the request.<p>
*
Expand Down
Loading

0 comments on commit 78c9d13

Please sign in to comment.