Skip to content

Commit

Permalink
Removing specified set of properties when creating a new sitemap entry
Browse files Browse the repository at this point in the history
from a template page.
  • Loading branch information
tHerrmann committed Feb 28, 2019
1 parent b562e42 commit ae5d5fb
Showing 1 changed file with 24 additions and 1 deletion.
25 changes: 24 additions & 1 deletion src/org/opencms/ade/sitemap/CmsVfsSitemapService.java
Original file line number Diff line number Diff line change
Expand Up @@ -141,6 +141,7 @@

import java.text.DateFormat;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.Collection;
import java.util.Collections;
import java.util.Comparator;
Expand Down Expand Up @@ -214,6 +215,15 @@ public boolean wasJustLocked() {
}
}

/** Properties to remove from the copied template when creating a new sitemap entry. */
public static final List<String> FILTER_PROPERTIES = Arrays.asList(
new String[] {
CmsPropertyDefinition.PROPERTY_TITLE,
CmsPropertyDefinition.PROPERTY_DESCRIPTION,
CmsPropertyDefinition.PROPERTY_DESCRIPTION_HTML,
CmsPropertyDefinition.PROPERTY_NAVTEXT,
CmsPropertyDefinition.PROPERTY_NAVINFO});

/** The path of the JSP used to download aliases. */
public static final String ALIAS_DOWNLOAD_PATH = "/system/workplace/commons/download-aliases.jsp";

Expand Down Expand Up @@ -1729,7 +1739,20 @@ private CmsClientSitemapEntry createNewEntry(String entryPoint, CmsSitemapChange
}
List<CmsProperty> filteredProperties = new ArrayList<CmsProperty>();
for (CmsProperty property : properties) {
if (!property.getName().equals(CmsPropertyDefinition.PROPERTY_DESCRIPTION)) {
boolean filter = false;
if (FILTER_PROPERTIES.contains(property.getName())) {
filter = true;

} else {
// filter localized versions also
for (String filterProp : FILTER_PROPERTIES) {
if (property.getName().startsWith(filterProp + "_")) {
filter = true;
break;
}
}
}
if (!filter) {
filteredProperties.add(property);
}
}
Expand Down

0 comments on commit ae5d5fb

Please sign in to comment.