Example usage for java.lang IllegalAccessException IllegalAccessException

List of usage examples for java.lang IllegalAccessException IllegalAccessException

Introduction

In this page you can find the example usage for java.lang IllegalAccessException IllegalAccessException.

Prototype

public IllegalAccessException(String s) 

Source Link

Document

Constructs an IllegalAccessException with a detail message.

Usage

From source file:com.enonic.cms.business.client.InternalClientImpl.java

public void clearPageCacheForSite(Integer siteKeyInt) {
    try {//from w  w  w  .j  a  v  a 2 s . co m
        UserEntity runningUser = securityService.getRunAsUser();
        if (!(runningUser.isEnterpriseAdmin() || runningUser.isAdministrator())) {
            throw new IllegalAccessException(
                    "User " + runningUser.getQualifiedName() + " do not have access to this operation");
        }

        SiteKey siteKey = new SiteKey(siteKeyInt);
        final PageCacheService pageCache = siteCachesService.getPageCacheService(siteKey);
        if (pageCache != null) {
            pageCache.removeEntriesBySite();
        }
    } catch (Exception e) {
        throw handleException(e);
    }
}

From source file:com.enonic.cms.business.client.InternalClientImpl.java

public void clearPageCacheForPage(Integer siteKeyInt, Integer[] menuItemKeys) {
    try {/*from   w w w  . jav a2  s.c  o m*/
        if (siteKeyInt == null) {
            throw new IllegalArgumentException("siteKey cannot be null");
        }

        if (menuItemKeys == null) {
            throw new IllegalArgumentException("menuItemKeys cannot be null");
        }

        UserEntity runningUser = securityService.getRunAsUser();
        if (!(runningUser.isEnterpriseAdmin() || runningUser.isAdministrator())) {
            throw new IllegalAccessException(
                    "User " + runningUser.getQualifiedName() + " do not have access to this operation");
        }

        for (Integer menuItemKeyInt : menuItemKeys) {
            MenuItemKey menuItemKey = new MenuItemKey(menuItemKeyInt);

            SiteKey siteKey = new SiteKey(siteKeyInt);
            final PageCacheService pageCache = siteCachesService.getPageCacheService(siteKey);
            if (pageCache != null) {
                pageCache.removeEntriesByMenuItem(menuItemKey);
            }
        }
    } catch (Exception e) {
        throw handleException(e);
    }
}

From source file:com.enonic.cms.business.client.InternalClientImpl.java

public void clearPageCacheForContent(Integer[] contentKeys) {
    try {/* w  w  w .jav a  2s  . co m*/
        UserEntity runningUser = securityService.getRunAsUser();
        if (!(runningUser.isEnterpriseAdmin() || runningUser.isAdministrator())) {
            throw new IllegalAccessException(
                    "User " + runningUser.getQualifiedName() + " do not have access to this operation");
        }

        for (Integer contentKeyInt : contentKeys) {
            ContentKey contentKey = new ContentKey(contentKeyInt);
            ContentEntity content = contentDao.findByKey(contentKey);
            if (content != null) {
                new PageCacheInvalidatorForContent(siteCachesService).invalidateForContent(content);
            }
        }
    } catch (Exception e) {
        throw handleException(e);
    }
}

From source file:com.amalto.workbench.editors.DataModelMainPage.java

private void validateElementation() throws IllegalAccessException {
    HashMap<String, Boolean> elemCntMap = new HashMap<String, Boolean>();
    EList<XSDElementDeclaration> elems = xsdSchema.getElementDeclarations();
    for (XSDElementDeclaration elem : elems) {
        if (elemCntMap.get(elem.getName()) == Boolean.TRUE) {
            throw new IllegalAccessException(Messages.bind(Messages.XSDDuplicateName, elem.getName()));
        }/*ww  w.  j a  va2s .co  m*/
        elemCntMap.put(elem.getName(), Boolean.TRUE);
    }
}

From source file:com.enonic.cms.core.client.InternalClientImpl.java

@Transactional(propagation = Propagation.REQUIRED, rollbackFor = Exception.class)
public void clearPageCacheForSite(Integer siteKeyInt) {
    try {/*from   w w w  .  j  a v  a 2 s. co m*/
        UserEntity runningUser = securityService.getImpersonatedPortalUser();
        if (!memberOfResolver.hasAdministratorPowers(runningUser)) {
            throw new IllegalAccessException(
                    "User " + runningUser.getQualifiedName() + " do not have access to this operation");
        }

        SiteKey siteKey = new SiteKey(siteKeyInt);
        final PageCache pageCache = pageCacheService.getPageCacheService(siteKey);
        if (pageCache != null) {
            pageCache.removeEntriesBySite();
        }
    } catch (Exception e) {
        throw handleException(e);
    }
}

From source file:com.enonic.cms.core.client.InternalClientImpl.java

@Transactional(propagation = Propagation.REQUIRED, rollbackFor = Exception.class)
public void clearPageCacheForPage(Integer siteKeyInt, Integer[] menuItemKeys) {
    try {/*  w w w  .java  2 s . c o  m*/
        if (siteKeyInt == null) {
            throw new IllegalArgumentException("siteKey cannot be null");
        }

        if (menuItemKeys == null) {
            throw new IllegalArgumentException("menuItemKeys cannot be null");
        }

        UserEntity runningUser = securityService.getImpersonatedPortalUser();
        if (!memberOfResolver.hasAdministratorPowers(runningUser)) {
            throw new IllegalAccessException(
                    "User " + runningUser.getQualifiedName() + " do not have access to this operation");
        }

        for (Integer menuItemKeyInt : menuItemKeys) {
            MenuItemKey menuItemKey = new MenuItemKey(menuItemKeyInt);

            SiteKey siteKey = new SiteKey(siteKeyInt);
            final PageCache pageCache = pageCacheService.getPageCacheService(siteKey);
            if (pageCache != null) {
                pageCache.removeEntriesByMenuItem(menuItemKey);
            }
        }
    } catch (Exception e) {
        throw handleException(e);
    }
}

From source file:com.enonic.cms.core.client.InternalClientImpl.java

@Transactional(propagation = Propagation.REQUIRED, rollbackFor = Exception.class)
public void clearPageCacheForContent(Integer[] contentKeys) {
    try {/*from w w  w. j  a  v  a 2 s  . c om*/
        UserEntity runningUser = securityService.getImpersonatedPortalUser();
        if (!memberOfResolver.hasAdministratorPowers(runningUser)) {
            throw new IllegalAccessException(
                    "User " + runningUser.getQualifiedName() + " do not have access to this operation");
        }

        for (Integer contentKeyInt : contentKeys) {
            ContentKey contentKey = new ContentKey(contentKeyInt);
            ContentEntity content = contentDao.findByKey(contentKey);
            if (content != null) {
                new PageCacheInvalidatorForContent(pageCacheService).invalidateForContent(content);
            }
        }
    } catch (Exception e) {
        throw handleException(e);
    }
}