@Override protected Element exportDataElement(String userName) { final Integer userId = this.userIdentityStore.getPortalUserId(userName); if (userId == null) { this.logger.warn("No user " + userName + " found, no layout will be exported"); return null; } // Setup empty IPerson used to interact with the layout store final PersonImpl person = new PersonImpl(); person.setUserName(userName); person.setID(userId); person.setSecurityContext(new BrokenSecurityContext()); try { this.userLayoutStore.setProfileImportExportCache(layoutCache); this.userLayoutStore.setLayoutImportExportCache(profileCache); final IUserProfile userProfile = userLayoutStore.getUserProfileByFname( person, UserProfile.DEFAULT_PROFILE_FNAME); final Element layoutElement = userLayoutStore.exportLayout(person, userProfile); return layoutElement; } finally { this.userLayoutStore.setProfileImportExportCache(null); this.userLayoutStore.setLayoutImportExportCache(null); } } }