Skip to content

Instantly share code, notes, and snippets.

@ryanschuhler
Created September 24, 2020 23:00
Show Gist options
  • Save ryanschuhler/64aaadbbe2a16cc0667b1f176fe58034 to your computer and use it in GitHub Desktop.
Save ryanschuhler/64aaadbbe2a16cc0667b1f176fe58034 to your computer and use it in GitHub Desktop.
/**
* Copyright (c) 2000-present Liferay, Inc. All rights reserved.
*
* This library is free software; you can redistribute it and/or modify it under
* the terms of the GNU Lesser General Public License as published by the Free
* Software Foundation; either version 2.1 of the License, or (at your option)
* any later version.
*
* This library is distributed in the hope that it will be useful, but WITHOUT
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
* FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more
* details.
*/
package com.liferay.osb.www.fragment.collection.contributor.components.global.internal.upgrade;
import com.liferay.fragment.service.FragmentEntryLinkLocalService;
import com.liferay.osb.www.fragment.collection.contributor.components.global.v1_0_1.UpgradeCardIconFragmentConfigurationValues;
import com.liferay.osb.www.fragment.collection.contributor.components.global.v1_0_1.UpgradeMaroonedFragmentEditableValues;
import com.liferay.osb.www.fragment.collection.contributor.components.global.v1_0_1.UpgradeTextDisplayFragmentConfigurationValues;
import com.liferay.osb.www.fragment.collection.contributor.components.global.v1_0_1.UpgradeTextParagraphFragmentConfigurationValues;
import com.liferay.osb.www.fragment.collection.contributor.components.global.v1_0_1.UpgradeVideoFragmentConfigurationValues;
import com.liferay.osb.www.fragment.collection.contributor.components.global.v1_0_2.UpgradeFragmentRendererKeys;
import com.liferay.osb.www.fragment.collection.contributor.components.global.v1_0_3.UpgradeFragmentConfigurationKeys;
import com.liferay.osb.www.fragment.collection.contributor.components.global.v1_0_3.UpgradeFragmentTemplateConfigurationKeys;
import com.liferay.portal.kernel.upgrade.DummyUpgradeStep;
import com.liferay.portal.kernel.upgrade.UpgradeStep;
import com.liferay.portal.upgrade.registry.UpgradeStepRegistrator;
import org.osgi.service.component.annotations.Component;
import org.osgi.service.component.annotations.Reference;
/**
* @author Allen Ziegenfus
*/
@Component(immediate = true, service = UpgradeStepRegistrator.class)
public class GlobalFragmentsUpgrade implements UpgradeStepRegistrator {
@Override
public void register(Registry registry) {
registry.register("0.0.0", "1.0.0", new DummyUpgradeStep());
registry.register(
"1.0.0", "1.0.1",
new UpgradeVideoFragmentConfigurationValues(
_fragmentEntryLinkLocalService),
new UpgradeMaroonedFragmentEditableValues(
_fragmentEntryLinkLocalService),
new UpgradeCardIconFragmentConfigurationValues(
_fragmentEntryLinkLocalService),
new UpgradeTextDisplayFragmentConfigurationValues(
_fragmentEntryLinkLocalService),
new UpgradeTextParagraphFragmentConfigurationValues(
_fragmentEntryLinkLocalService));
registry.register(
"1.0.1", "1.0.2",
new UpgradeFragmentRendererKeys(_fragmentEntryLinkLocalService));
registry.register(
"1.0.2", "1.0.3",
new UpgradeFragmentConfigurationKeys(
_fragmentEntryLinkLocalService),
new UpgradeFragmentTemplateConfigurationKeys(
_fragmentEntryLinkLocalService));
UpgradeStep upgradeRelatedContentConfigurationValues =
new BaseUpgradeFragmentConfigurationValues(
_fragmentEntryLinkLocalService) {
@Override
protected String[] getRendererKeys() {
return new String[] {
"OSB_WWW_COMPONENTS_LANDING_PAGE-relatedContent"
};
}
@Override
protected String getTransformFilename() {
return "/v1_0_4/transform_related_content.json";
}
};
registry.register(
"1.0.3", "1.0.4", upgradeRelatedContentConfigurationValues);
UpgradeStep upgradeDocumentPreviewConfigurationValues =
new BaseUpgradeFragmentConfigurationValues(
_fragmentEntryLinkLocalService) {
@Override
protected String[] getRendererKeys() {
return new String[] {
"OSB_WWW_COMPONENTS_GLOBAL-documentPreview"
};
}
@Override
protected String getTransformFilename() {
return "/v1_0_5/transform_document_preview.json";
}
};
UpgradeStep upgradeTagConfigurationValues =
new BaseUpgradeFragmentConfigurationValues(
_fragmentEntryLinkLocalService) {
@Override
protected String[] getRendererKeys() {
return new String[] {"OSB_WWW_COMPONENTS_GLOBAL-tag"};
}
@Override
protected String getTransformFilename() {
return "/v1_0_5/transform_tag.json";
}
};
UpgradeStep upgradeNotificationBarConfigurationValues =
new BaseUpgradeFragmentConfigurationValues(
_fragmentEntryLinkLocalService) {
@Override
protected String[] getRendererKeys() {
return new String[] {
"OSB_WWW_COMPONENTS_OTHER-notificationBar"
};
}
@Override
protected String getTransformFilename() {
return "/v1_0_5/transform_notification_bar.json";
}
};
registry.register(
"1.0.4", "1.0.5", upgradeDocumentPreviewConfigurationValues,
upgradeTagConfigurationValues,
upgradeNotificationBarConfigurationValues);
UpgradeStep upgradeRelatedContentTypeConfigurationValues =
new BaseUpgradeFragmentConfigurationValues(
_fragmentEntryLinkLocalService) {
@Override
protected String[] getRendererKeys() {
return new String[] {
"OSB_WWW_COMPONENTS_LANDING_PAGE-relatedContent"
};
}
@Override
protected String getTransformFilename() {
return "/v1_0_6/transform_related_content.json";
}
};
registry.register(
"1.0.5", "1.0.6", upgradeRelatedContentTypeConfigurationValues);
}
@Reference
private FragmentEntryLinkLocalService _fragmentEntryLinkLocalService;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment