Example usage for com.liferay.portal.util PropsValues PLUGIN_NOTIFICATIONS_PACKAGES_IGNORED

List of usage examples for com.liferay.portal.util PropsValues PLUGIN_NOTIFICATIONS_PACKAGES_IGNORED

Introduction

In this page you can find the example usage for com.liferay.portal.util PropsValues PLUGIN_NOTIFICATIONS_PACKAGES_IGNORED.

Prototype

String[] PLUGIN_NOTIFICATIONS_PACKAGES_IGNORED

To view the source code for com.liferay.portal.util PropsValues PLUGIN_NOTIFICATIONS_PACKAGES_IGNORED.

Click Source Link

Usage

From source file:com.liferay.portlet.plugininstaller.action.InstallPluginAction.java

License:Open Source License

protected void unignorePackages(ActionRequest actionRequest) throws Exception {

    String[] pluginPackagesUnignored = StringUtil
            .splitLines(ParamUtil.getString(actionRequest, "pluginPackagesUnignored"));

    String[] pluginPackagesIgnored = PrefsPropsUtil.getStringArray(
            PropsKeys.PLUGIN_NOTIFICATIONS_PACKAGES_IGNORED, StringPool.NEW_LINE,
            PropsValues.PLUGIN_NOTIFICATIONS_PACKAGES_IGNORED);

    StringBundler sb = new StringBundler();

    for (int i = 0; i < pluginPackagesIgnored.length; i++) {
        String packageId = pluginPackagesIgnored[i];

        if (!ArrayUtil.contains(pluginPackagesUnignored, packageId)) {
            sb.append(packageId);/* ww  w .ja v a2s .c om*/
            sb.append(StringPool.NEW_LINE);
        }
    }

    PortletPreferences preferences = PrefsPropsUtil.getPreferences();

    preferences.setValue(PropsKeys.PLUGIN_NOTIFICATIONS_PACKAGES_IGNORED, sb.toString());

    preferences.store();

    PluginPackageUtil.refreshUpdatesAvailableCache();
}