Example usage for com.liferay.portal.util PortalInstances initCompany

List of usage examples for com.liferay.portal.util PortalInstances initCompany

Introduction

In this page you can find the example usage for com.liferay.portal.util PortalInstances initCompany.

Prototype

public static long initCompany(ServletContext servletContext, String webId) 

Source Link

Usage

From source file:com.liferay.portlet.admin.action.EditInstanceAction.java

License:Open Source License

protected void updateInstance(ActionRequest actionRequest) throws Exception {

    long companyId = ParamUtil.getLong(actionRequest, "companyId");

    String webId = ParamUtil.getString(actionRequest, "webId");
    String virtualHostname = ParamUtil.getString(actionRequest, "virtualHostname");
    String mx = ParamUtil.getString(actionRequest, "mx");
    String shardName = ParamUtil.getString(actionRequest, "shardName", PropsValues.SHARD_DEFAULT_NAME);
    boolean system = false;
    int maxUsers = ParamUtil.getInteger(actionRequest, "maxUsers", 0);
    boolean active = ParamUtil.getBoolean(actionRequest, "active");

    if (companyId <= 0) {

        // Add instance

        Company company = CompanyServiceUtil.addCompany(webId, virtualHostname, mx, shardName, system, maxUsers,
                active);/* w  w  w .  ja  v  a 2 s .  c  om*/

        ServletContext servletContext = (ServletContext) actionRequest.getAttribute(WebKeys.CTX);

        PortalInstances.initCompany(servletContext, company.getWebId());
    } else {

        // Update instance

        CompanyServiceUtil.updateCompany(companyId, virtualHostname, mx, maxUsers, active);
    }
}