Example usage for com.liferay.portal.kernel.events ActionException ActionException

List of usage examples for com.liferay.portal.kernel.events ActionException ActionException

Introduction

In this page you can find the example usage for com.liferay.portal.kernel.events ActionException ActionException.

Prototype

public ActionException(Throwable cause) 

Source Link

Usage

From source file:br.com.thiagomoreira.liferay.plugins.events.SetupBrazilianRegionsStartupAction.java

License:Apache License

public void run(String[] companyIds) throws ActionException {

    PermissionChecker permissionChecker = PermissionThreadLocal.getPermissionChecker();

    try {//from w w  w.  j a  va2 s  .  co  m

        PermissionThreadLocal.setPermissionChecker(new OminAdminPermissionChecker());

        Country brazil = CountryServiceUtil.getCountryByA2("BR");
        long countryId = brazil.getCountryId();

        List<Region> regions = RegionServiceUtil.getRegions(countryId);

        if (regions.isEmpty()) {
            RegionServiceUtil.addRegion(countryId, "AL", "Alagoas", true);
            RegionServiceUtil.addRegion(countryId, "AM", "Amazonas", true);
            RegionServiceUtil.addRegion(countryId, "AP", "Amap", true);
            RegionServiceUtil.addRegion(countryId, "BA", "Bahia", true);
            RegionServiceUtil.addRegion(countryId, "CE", "Cear", true);
            RegionServiceUtil.addRegion(countryId, "DF", "Distrito Federal", true);
            RegionServiceUtil.addRegion(countryId, "ES", "Esprito Santo", true);
            RegionServiceUtil.addRegion(countryId, "GO", "Gois", true);
            RegionServiceUtil.addRegion(countryId, "MA", "Maranho", true);
            RegionServiceUtil.addRegion(countryId, "MG", "Minas Gerais", true);
            RegionServiceUtil.addRegion(countryId, "MS", "Mato Grosso do Sul", true);
            RegionServiceUtil.addRegion(countryId, "MT", "Mato Grosso", true);
            RegionServiceUtil.addRegion(countryId, "PA", "Par", true);
            RegionServiceUtil.addRegion(countryId, "PB", "Paraba", true);
            RegionServiceUtil.addRegion(countryId, "PE", "Pernambuco", true);
            RegionServiceUtil.addRegion(countryId, "PI", "Piau", true);
            RegionServiceUtil.addRegion(countryId, "PR", "Paran", true);
            RegionServiceUtil.addRegion(countryId, "RJ", "Rio de Janeiro", true);
            RegionServiceUtil.addRegion(countryId, "RN", "Rio Grande do Norte", true);
            RegionServiceUtil.addRegion(countryId, "RR", "Roraima", true);
            RegionServiceUtil.addRegion(countryId, "RO", "Rondnia", true);
            RegionServiceUtil.addRegion(countryId, "RS", "Rio Grande do Sul", true);
            RegionServiceUtil.addRegion(countryId, "SC", "Santa Catarina", true);
            RegionServiceUtil.addRegion(countryId, "SE", "Sergipe", true);
            RegionServiceUtil.addRegion(countryId, "SP", "So Paulo", true);
            RegionServiceUtil.addRegion(countryId, "TO", "Tocantins", true);
        }
    } catch (Exception e) {
        throw new ActionException(e);
    } finally {
        PermissionThreadLocal.setPermissionChecker(permissionChecker);
    }

}

From source file:br.com.thiagomoreira.liferay.plugins.fixvirtualhost.FixVirtualHostAction.java

License:Apache License

@Override
public void run(String[] ids) throws ActionException {
    try {//w  w w. j a  v a 2  s .  c o m
        doRun(GetterUtil.getLong(ids[0]));
    } catch (Exception e) {
        throw new ActionException(e);
    }
}

From source file:br.com.thiagomoreira.liferay.plugins.ReplaceThemeIdsAction.java

License:Apache License

public void run(String[] companyIds) throws ActionException {
    String[] oldThemeIdPatterns = PropsUtil.getArray("replace.themeIds.old");
    String[] newThemeIdPatterns = PropsUtil.getArray("replace.themeIds.new");

    for (int i = 0; i < newThemeIdPatterns.length; i++) {
        String oldThemeIdPattern = oldThemeIdPatterns[i];
        String newThemeIdPattern = newThemeIdPatterns[i];

        if (Validator.isNotNull(oldThemeIdPattern) && Validator.isNotNull(newThemeIdPattern)
                && !oldThemeIdPattern.equals(newThemeIdPattern)) {
            try {
                updateLayouts(oldThemeIdPattern, newThemeIdPattern);
            } catch (Exception ex) {
                throw new ActionException(ex);
            }/*from  w ww  .  j  a va2s .  c om*/
        }
    }
}

From source file:com.ext.portlet.models.StartupAction.java

License:Open Source License

public void run(String[] ids) throws ActionException {
    try {//from  w  w w  .  j ava2s.  c o  m
        doRun(GetterUtil.getLong(ids[0]));
    } catch (Exception e) {
        throw new ActionException(e);
    }
}

From source file:com.inkwell.internet.shopping.startup.StartupAction.java

License:Open Source License

public void run(String[] ids) throws ActionException {

    try {/*  w w  w .  ja  va 2s. com*/
        doRun(GetterUtil.getLong(ids[0]));
    } catch (Exception e) {
        throw new ActionException(e);
    }
}

From source file:com.liferay.compat.hook.events.StartupAction.java

License:Open Source License

public void run(String[] ids) throws ActionException {
    try {/*from w  w w  .ja v a2  s.  c o m*/
        for (String id : ids) {
            doRun(GetterUtil.getLong(id));
        }
    } catch (Exception e) {
        throw new ActionException(e);
    }
}

From source file:com.liferay.content.targeting.anonymous.users.hook.events.AnonymousUsersLoginAction.java

License:Open Source License

@Override
public void run(HttpServletRequest request, HttpServletResponse response) throws ActionException {

    try {/*from   w w  w . j  a  v a 2s  .  co m*/
        doRun(request, response);
    } catch (Exception e) {
        throw new ActionException(e);
    }
}

From source file:com.liferay.google.mail.groups.events.StartupAction.java

License:Open Source License

@Override
public void run(String[] ids) throws ActionException {
    try {//from w  w  w  .j a  v  a 2s  . c o m
        if ((PortletPropsValues.EMAIL_LARGE_GROUP_SIZE >= 0)
                && Validator.isNotNull(PortletPropsValues.EMAIL_LARGE_GROUP_ROLE)) {

            for (String id : ids) {
                long companyId = Long.valueOf(id);

                setupExpando(companyId);
                setupRole(companyId);
            }
        }

        if (!PortletPropsValues.SYNC_ON_STARTUP) {
            return;
        }

        GoogleMailGroupsUtil.syncGroups();
    } catch (Exception e) {
        throw new ActionException(e);
    }
}

From source file:com.liferay.invitation.invite.members.internal.events.LoginPostAction.java

License:Open Source License

@Override
public void processLifecycleEvent(LifecycleEvent lifecycleEvent) throws ActionException {

    try {// w  w  w  .j  av a  2 s.co  m
        String ppid = ParamUtil.getString(lifecycleEvent.getRequest(), "p_p_id");

        String portletNamespace = _portal.getPortletNamespace(ppid);

        String memberRequestKey = ParamUtil.getString(lifecycleEvent.getRequest(),
                portletNamespace.concat("key"));

        if (Validator.isNull(memberRequestKey)) {
            return;
        }

        User user = _portal.getUser(lifecycleEvent.getRequest());

        _memberRequestLocalService.updateMemberRequest(memberRequestKey, user.getUserId());
    } catch (Exception e) {
        throw new ActionException(e);
    }
}

From source file:com.liferay.journal.internal.events.JournalServicePreAction.java

License:Open Source License

@Override
public void run(HttpServletRequest request, HttpServletResponse response) throws ActionException {

    try {/*from w ww.j  a v  a  2s  .c  om*/
        servicePre(request);
    } catch (Exception e) {
        throw new ActionException(e);
    }
}