use of org.kie.workbench.common.forms.migration.legacy.services.impl.FormSerializationManagerImpl in project kie-wb-common by kiegroup.
the class AbstractMigrationStep method persist.
private void persist(MigrationContext migrationContext) {
FormSerializationManager oldFormSerializer = new FormSerializationManagerImpl();
FormDefinitionSerializer formDefinitionSerializer = migrationContext.getCDIWrapper().getFormDefinitionSerializer();
Function<Resource<Form>, String> originaldFormSerializationFunction = formResource -> {
Form originalForm = formResource.get();
originalForm.setMigrationStep(getStep());
return oldFormSerializer.generateFormXML(originalForm, migrationContext.getSystem());
};
Function<Resource<FormDefinition>, String> newFormSerializationFuncion = formResource -> formDefinitionSerializer.serialize(formResource.get());
migrationContext.getSummaries().forEach(summary -> {
if (summary.getResult().isSuccess()) {
serializeResource(summary.getOriginalForm().getPath(), originaldFormSerializationFunction.apply(summary.getOriginalForm()), migrationContext);
serializeResource(summary.getNewForm().getPath(), newFormSerializationFuncion.apply(summary.getNewForm()), migrationContext);
}
});
migrationContext.getExtraSummaries().forEach(summary -> {
serializeResource(summary.getNewForm().getPath(), newFormSerializationFuncion.apply(summary.getNewForm()), migrationContext);
});
}
Aggregations