Example usage for com.liferay.portal.kernel.plugin PluginPackage getTypes

List of usage examples for com.liferay.portal.kernel.plugin PluginPackage getTypes

Introduction

In this page you can find the example usage for com.liferay.portal.kernel.plugin PluginPackage getTypes.

Prototype

public List<String> getTypes();

Source Link

Usage

From source file:com.liferay.server.manager.internal.executor.PluginExecutor.java

License:Open Source License

@Override
public void executeRead(HttpServletRequest request, JSONObject responseJSONObject, Queue<String> arguments) {

    JSONObject pluginPackageJSONObject = JSONFactoryUtil.createJSONObject();

    String context = arguments.poll();

    PluginPackage pluginPackage = DeployManagerUtil.getInstalledPluginPackage(context);

    boolean installed = true;

    if (pluginPackage == null) {
        installed = false;//from w  w w.j av a2s  .c o m
    }

    pluginPackageJSONObject.put("installed", installed);

    boolean started = true;

    if (pluginPackage == null) {
        started = false;
    }

    pluginPackageJSONObject.put("started", started);

    List<String> types = new ArrayList<>();

    if (pluginPackage != null) {
        types = pluginPackage.getTypes();
    }

    JSONArray typesJSONArray = JSONFactoryUtil.createJSONArray();

    for (String type : types) {
        typesJSONArray.put(type);
    }

    pluginPackageJSONObject.put("types", typesJSONArray);

    responseJSONObject.put(JSONKeys.OUTPUT, pluginPackageJSONObject);
}

From source file:com.liferay.servermanager.executor.PluginExecutor.java

License:Open Source License

@Override
public void executeRead(HttpServletRequest request, JSONObject responseJSONObject, Queue<String> arguments) {

    JSONObject pluginPackageJSONObject = JSONFactoryUtil.createJSONObject();

    String context = arguments.poll();

    PluginPackage pluginPackage = DeployManagerUtil.getInstalledPluginPackage(context);

    boolean installed = true;

    if (pluginPackage == null) {
        installed = false;/*from  w  w w  .ja  v  a  2  s. c o m*/
    }

    pluginPackageJSONObject.put("installed", installed);

    boolean started = true;

    if (pluginPackage == null) {
        started = false;
    }

    pluginPackageJSONObject.put("started", started);

    List<String> types = new ArrayList<String>();

    if (pluginPackage != null) {
        types = pluginPackage.getTypes();
    }

    JSONArray typesJSONArray = JSONFactoryUtil.createJSONArray();

    for (String type : types) {
        typesJSONArray.put(type);
    }

    pluginPackageJSONObject.put("types", typesJSONArray);

    responseJSONObject.put(JSONKeys.OUTPUT, pluginPackageJSONObject);
}