@Override
    public void resetAttributes(ExternalContext externalContext) {
        final Principal currentUser = externalContext.getCurrentUser();
        final String uid = currentUser.getName();

        this.logger.warn("User '" + uid + "' reseting to default attributes");

        // Remove the person directory override
        this.portalRootPersonAttributeDao.removeUserAttributeOverride(uid);

        // Remove the IPerson attribute override, bit of a hack as we really just remove all
        // overrides
        // then re-add all attributes from person directory
        final PortletRequest portletRequest = (PortletRequest) externalContext.getNativeRequest();
        final HttpServletRequest portalRequest =
                this.portalRequestUtils.getPortletHttpRequest(portletRequest);

        final IPerson person = this.personManager.getPerson(portalRequest);

        final Set<String> overriddenAttributes =
                (Set<String>) person.getAttribute(OVERRIDDEN_ATTRIBUTES);
        if (overriddenAttributes != null) {
            person.setAttribute(OVERRIDDEN_ATTRIBUTES, null);

            for (final String attribute : overriddenAttributes) {
                person.setAttribute(attribute, null);
            }
        }

        final IPersonAttributes originalUserAttributes = this.getOriginalUserAttributes(uid);
        final Map<String, List<Object>> attributes = originalUserAttributes.getAttributes();
        person.setAttributes(attributes);
    }
@ Override public void resetAttributes ( ExternalContext externalContext ) { final Principal currentUser = externalContext . getCurrentUser ( ) ; final String uid = currentUser . getName ( ) ; this . logger . warn ( "User '" + uid + "' reseting to default attributes" ) ; this . portalRootPersonAttributeDao . removeUserAttributeOverride ( uid ) ; final PortletRequest portletRequest = ( PortletRequest ) externalContext . getNativeRequest ( ) ; final HttpServletRequest portalRequest = this . portalRequestUtils . getPortletHttpRequest ( portletRequest ) ; final IPerson person = this . personManager . getPerson ( portalRequest ) ; final Set < String > overriddenAttributes = ( Set < String > ) person . getAttribute ( OVERRIDDEN_ATTRIBUTES ) ; if ( overriddenAttributes != null ) { person . setAttribute ( OVERRIDDEN_ATTRIBUTES , null ) ; for ( final String attribute : overriddenAttributes ) { person . setAttribute ( attribute , null ) ; } } final IPersonAttributes originalUserAttributes = this . getOriginalUserAttributes ( uid ) ; final Map < String , List < Object > > attributes = originalUserAttributes . getAttributes ( ) ; person . setAttributes ( attributes ) ; }
/* (non-Javadoc)
@see org.apereo.portal.portlets.swapper.IAttributeSwapperHelper#resetAttributes(java.lang.String)