-
Notifications
You must be signed in to change notification settings - Fork 3.6k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
LPS-90262 Add upgrade process to use the dashboard theme for personal…
… applications for existing installations
- Loading branch information
1 parent
9e49ad4
commit 3a2d0bf
Showing
5 changed files
with
145 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
44 changes: 44 additions & 0 deletions
44
...avigation/personal/menu/web/internal/upgrade/ProductNavigationPersonalMenuWebUpgrade.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,44 @@ | ||
/** | ||
* 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.product.navigation.personal.menu.web.internal.upgrade; | ||
|
||
import com.liferay.portal.kernel.upgrade.DummyUpgradeStep; | ||
import com.liferay.portal.upgrade.registry.UpgradeStepRegistrator; | ||
import com.liferay.product.navigation.personal.menu.web.internal.upgrade.v1_0_0.UpgradePersonalMenuConfiguration; | ||
|
||
import org.osgi.service.cm.ConfigurationAdmin; | ||
import org.osgi.service.component.annotations.Component; | ||
import org.osgi.service.component.annotations.Reference; | ||
|
||
/** | ||
* @author Pei-Jung Lan | ||
*/ | ||
@Component(immediate = true, service = UpgradeStepRegistrator.class) | ||
public class ProductNavigationPersonalMenuWebUpgrade | ||
implements UpgradeStepRegistrator { | ||
|
||
@Override | ||
public void register(Registry registry) { | ||
registry.register("0.0.0", "1.0.0", new DummyUpgradeStep()); | ||
|
||
registry.register( | ||
"0.0.1", "1.0.0", | ||
new UpgradePersonalMenuConfiguration(_configurationAdmin)); | ||
} | ||
|
||
@Reference | ||
private ConfigurationAdmin _configurationAdmin; | ||
|
||
} |
65 changes: 65 additions & 0 deletions
65
...avigation/personal/menu/web/internal/upgrade/v1_0_0/UpgradePersonalMenuConfiguration.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,65 @@ | ||
/** | ||
* 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.product.navigation.personal.menu.web.internal.upgrade.v1_0_0; | ||
|
||
import com.liferay.petra.string.StringBundler; | ||
import com.liferay.petra.string.StringPool; | ||
import com.liferay.portal.kernel.upgrade.UpgradeProcess; | ||
import com.liferay.portal.kernel.util.HashMapDictionary; | ||
import com.liferay.product.navigation.personal.menu.configuration.PersonalMenuConfiguration; | ||
|
||
import java.util.Dictionary; | ||
|
||
import org.osgi.framework.Constants; | ||
import org.osgi.service.cm.Configuration; | ||
import org.osgi.service.cm.ConfigurationAdmin; | ||
|
||
/** | ||
* @author Pei-Jung Lan | ||
*/ | ||
public class UpgradePersonalMenuConfiguration extends UpgradeProcess { | ||
|
||
public UpgradePersonalMenuConfiguration( | ||
ConfigurationAdmin configurationAdmin) { | ||
|
||
_configurationAdmin = configurationAdmin; | ||
} | ||
|
||
@Override | ||
protected void doUpgrade() throws Exception { | ||
String filterString = StringBundler.concat( | ||
"(", Constants.SERVICE_PID, "=", | ||
PersonalMenuConfiguration.class.getName(), ")"); | ||
|
||
Configuration[] configurations = _configurationAdmin.listConfigurations( | ||
filterString); | ||
|
||
if (configurations != null) { | ||
return; | ||
} | ||
|
||
Configuration configuration = _configurationAdmin.getConfiguration( | ||
PersonalMenuConfiguration.class.getName(), StringPool.QUESTION); | ||
|
||
Dictionary<String, Object> properties = new HashMapDictionary<>(); | ||
|
||
properties.put("personalApplicationsLookAndFeel", "my-dashboard"); | ||
|
||
configuration.update(properties); | ||
} | ||
|
||
private final ConfigurationAdmin _configurationAdmin; | ||
|
||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
33 changes: 33 additions & 0 deletions
33
portal-impl/src/com/liferay/portal/upgrade/v7_2_x/UpgradePersonalMenu.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,33 @@ | ||
/** | ||
* Copyright (c) 2000-present Liferay, Inc. All rights reserved. | ||
* <p> | ||
* 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. | ||
* <p> | ||
* 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.portal.upgrade.v7_2_x; | ||
|
||
import com.liferay.portal.kernel.model.dao.ReleaseDAO; | ||
import com.liferay.portal.kernel.upgrade.UpgradeProcess; | ||
|
||
/** | ||
* @author Pei-Jung Lan | ||
*/ | ||
public class UpgradePersonalMenu extends UpgradeProcess { | ||
|
||
@Override | ||
protected void doUpgrade() throws Exception { | ||
ReleaseDAO releaseDAO = new ReleaseDAO(); | ||
|
||
releaseDAO.addRelease( | ||
connection, "com.liferay.product.navigation.personal.menu.web"); | ||
} | ||
|
||
} |