use of com.enonic.xp.index.PatternIndexConfigDocument in project xp by enonic.
the class HtmlAreaNodeDataUpgrader method upgradeNodeData.
private void upgradeNodeData(final PropertySet nodeData, final PatternIndexConfigDocument indexConfigDocument) {
final List<Pattern> htmlAreaPatterns = indexConfigDocument.getPathIndexConfigs().stream().filter(this::hasHtmlStripperProcessor).map(PathIndexConfig::getPath).map(PropertyPath::toString).map(HtmlAreaNodeDataUpgrader::toPattern).collect(Collectors.toList());
final PropertyVisitor propertyVisitor = new PropertyVisitor() {
@Override
public void visit(final Property property) {
if (isHtmlAreaProperty(property)) {
upgradeHtmlAreaProperty(property, false);
} else if (isBackwardCompatibleHtmlAreaProperty(property)) {
upgradeHtmlAreaProperty(property, true);
}
}
private boolean isHtmlAreaProperty(Property property) {
return ValueTypes.STRING.equals(property.getType()) && htmlAreaPatterns.stream().anyMatch(htmlPattern -> htmlPattern.matcher(property.getPath().toString()).matches());
}
private boolean isBackwardCompatibleHtmlAreaProperty(Property property) {
return ValueTypes.STRING.equals(property.getType()) && BACKWARD_COMPATIBILITY_HTML_PROPERTY_PATH_PATTERNS.stream().anyMatch(htmlPattern -> htmlPattern.matcher(property.getPath().toString()).matches());
}
};
propertyVisitor.traverse(nodeData);
}
use of com.enonic.xp.index.PatternIndexConfigDocument in project xp by enonic.
the class HtmlAreaDumpUpgrader method upgradeBlobRecord.
private void upgradeBlobRecord(final DumpBlobRecord nodeDumpBlobRecord, final DumpBlobRecord indexDumpBlobRecord) {
final NodeVersion nodeVersion = getNodeVersion(nodeDumpBlobRecord);
final PatternIndexConfigDocument indexConfigDocument = getIndexConfigDocument(indexDumpBlobRecord);
final boolean upgraded = upgradeNodeVersion(nodeVersion, indexConfigDocument);
if (upgraded) {
writeNodeVersion(nodeVersion, nodeDumpBlobRecord);
}
}
use of com.enonic.xp.index.PatternIndexConfigDocument in project xp by enonic.
the class IndexConfigUpgrader method upgradeIndexConfigDocument.
private BlobKey upgradeIndexConfigDocument(final BlobKey blobKey, final NodeVersion nodeVersion) {
final DumpBlobRecord indexConfigBlobRecord = dumpReader.getDumpBlobStore().getRecord(INDEX_CONFIG_SEGMENT, blobKey);
final PatternIndexConfigDocument sourceDocument = getIndexConfigDocument(indexConfigBlobRecord);
PatternIndexConfigDocument upgradedDocument = this.upgradeLanguageIndexConfig(sourceDocument, nodeVersion);
upgradedDocument = this.upgradePageIndexConfig(upgradedDocument, nodeVersion);
return !upgradedDocument.equals(sourceDocument) ? storeIndexConfigBlob(upgradedDocument) : blobKey;
}
Aggregations