Sergey Shepelevich pushed to branch release/5.0 at cms-community / hippo-repository
Commits: cb448376 by Sergey Shepelevich at 2018-02-15T14:27:39+01:00 REPO-1946 [Backport 5.0.7] Fix console export failure on binary properties (cherry picked from commit 3105beb6b34787b8f589af8de52a6f75b6b9a129) - - - - - 3 changed files: - engine/src/main/java/org/onehippo/cm/engine/ConfigurationServiceImpl.java - + engine/src/main/java/org/onehippo/cm/model/ConsoleExportModuleContext.java - engine/src/main/java/org/onehippo/cm/model/ExportModuleContext.java Changes: ===================================== engine/src/main/java/org/onehippo/cm/engine/ConfigurationServiceImpl.java ===================================== --- a/engine/src/main/java/org/onehippo/cm/engine/ConfigurationServiceImpl.java +++ b/engine/src/main/java/org/onehippo/cm/engine/ConfigurationServiceImpl.java @@ -48,6 +48,7 @@ import org.onehippo.cm.engine.migrator.MigrationException; import org.onehippo.cm.engine.migrator.PostMigrator; import org.onehippo.cm.engine.migrator.PreMigrator; import org.onehippo.cm.model.ConfigurationModel; +import org.onehippo.cm.model.ConsoleExportModuleContext; import org.onehippo.cm.model.ExportModuleContext; import org.onehippo.cm.model.ImportModuleContext; import org.onehippo.cm.model.definition.ActionType; @@ -437,7 +438,7 @@ public class ConfigurationServiceImpl implements InternalConfigurationService { final ModuleImpl module = contentService.exportNode(nodeToExport); - final ModuleContext moduleContext = new ExportModuleContext(module); + final ModuleContext moduleContext = new ConsoleExportModuleContext(module); final ContentSourceSerializer contentSourceSerializer = new ContentSourceSerializer(moduleContext, module.getContentSources().iterator().next(), false); final org.yaml.snakeyaml.nodes.Node node = contentSourceSerializer.representSource(); ===================================== engine/src/main/java/org/onehippo/cm/model/ConsoleExportModuleContext.java ===================================== --- /dev/null +++ b/engine/src/main/java/org/onehippo/cm/model/ConsoleExportModuleContext.java @@ -0,0 +1,41 @@ +/* + * Copyright 2018 Hippo B.V. (http://www.onehippo.com) + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +package org.onehippo.cm.model; + +import java.io.IOException; + +import org.onehippo.cm.model.impl.ModuleImpl; +import org.onehippo.cm.model.impl.source.SourceImpl; +import org.onehippo.cm.model.impl.tree.ValueImpl; + +public class ConsoleExportModuleContext extends ExportModuleContext { + + public ConsoleExportModuleContext(ModuleImpl module) throws IOException { + super(module, null); + } + + @Override + public void resolveNewResourceValuePath(final SourceImpl source, final ValueImpl value) { + if (contentOutputProvider == null) { + final String candidateResourceName = mapperProvider.generateName(value); + value.setResourceValue(candidateResourceName); + } + } + + public void serializeResourceValue(final SourceImpl source, final ValueImpl resourceValue) { + } + +} ===================================== engine/src/main/java/org/onehippo/cm/model/ExportModuleContext.java ===================================== --- a/engine/src/main/java/org/onehippo/cm/model/ExportModuleContext.java +++ b/engine/src/main/java/org/onehippo/cm/model/ExportModuleContext.java @@ -1,5 +1,5 @@ /* - * Copyright 2017 Hippo B.V. (http://www.onehippo.com) + * Copyright 2017-2018 Hippo B.V. (http://www.onehippo.com) * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -27,10 +27,6 @@ import org.onehippo.cm.model.serializer.ModuleContext; */ public class ExportModuleContext extends ModuleContext { - public ExportModuleContext(ModuleImpl module) throws IOException { - super(module, null); - } - public ExportModuleContext(ModuleImpl module, Path moduleDescriptorPath) throws IOException { super(module, moduleDescriptorPath); createOutputProviders(moduleDescriptorPath); View it on GitLab: https://code.onehippo.org/cms-community/hippo-repository/commit/cb448376b9c8ed496b32eb8c6c077c871c35c731 --- View it on GitLab: https://code.onehippo.org/cms-community/hippo-repository/commit/cb448376b9c8ed496b32eb8c6c077c871c35c731 You're receiving this email because of your account on code.onehippo.org.
_______________________________________________ Hippocms-svn mailing list Hippocms-svn@lists.onehippo.org https://lists.onehippo.org/mailman/listinfo/hippocms-svn