Example usage for com.liferay.portal.plugin PluginPackageUtil refreshUpdatesAvailableCache

List of usage examples for com.liferay.portal.plugin PluginPackageUtil refreshUpdatesAvailableCache

Introduction

In this page you can find the example usage for com.liferay.portal.plugin PluginPackageUtil refreshUpdatesAvailableCache.

Prototype

public static void refreshUpdatesAvailableCache() 

Source Link

Usage

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

License:Open Source License

protected void ignorePackages(ActionRequest actionRequest) throws Exception {

    String pluginPackagesIgnored = ParamUtil.getString(actionRequest, "pluginPackagesIgnored");

    String oldPluginPackagesIgnored = PrefsPropsUtil.getString(PropsKeys.PLUGIN_NOTIFICATIONS_PACKAGES_IGNORED);

    PortletPreferences preferences = PrefsPropsUtil.getPreferences();

    if (Validator.isNotNull(oldPluginPackagesIgnored)) {
        preferences.setValue(PropsKeys.PLUGIN_NOTIFICATIONS_PACKAGES_IGNORED,
                oldPluginPackagesIgnored.concat(StringPool.NEW_LINE).concat(pluginPackagesIgnored));
    } else {//from  ww w. j a  v a2 s  .c  om
        preferences.setValue(PropsKeys.PLUGIN_NOTIFICATIONS_PACKAGES_IGNORED, pluginPackagesIgnored);
    }

    preferences.store();

    PluginPackageUtil.refreshUpdatesAvailableCache();
}

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);//from   w  w w.java  2  s  .  c o  m
            sb.append(StringPool.NEW_LINE);
        }
    }

    PortletPreferences preferences = PrefsPropsUtil.getPreferences();

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

    preferences.store();

    PluginPackageUtil.refreshUpdatesAvailableCache();
}