@Test public void testGetCurrentUserName() { String userName = personManagerCurrentUserProvider.getCurrentUserName(); assertNotNull(userName); assertEquals(userName, "John1"); }
@Override public String getCurrentUserName() { final HttpServletRequest portalRequest; try { portalRequest = this.portalRequestUtils.getCurrentPortalRequest(); } catch (IllegalStateException ise) { this.logger.warn( "No current portal request available, cannot determine current user name."); return null; } final IPerson person = this.personManager.getPerson(portalRequest); if (person == null) { this.logger.warn( "IPersonManager returned no IPerson for request, cannot determine current user name. " + portalRequest); return null; } return person.getUserName(); }
PersonManagerCurrentUserProvider implements ICurrentUserProvider { @Override public String getCurrentUserName() { final HttpServletRequest portalRequest; try { portalRequest = this.portalRequestUtils.getCurrentPortalRequest(); } catch (IllegalStateException ise) { this.logger.warn( "No current portal request available, cannot determine current user name."); return null; } final IPerson person = this.personManager.getPerson(portalRequest); if (person == null) { this.logger.warn( "IPersonManager returned no IPerson for request, cannot determine current user name. " + portalRequest); return null; } return person.getUserName(); } }
PersonManagerCurrentUserProvider implements ICurrentUserProvider { @Override public String getCurrentUserName() { final HttpServletRequest portalRequest; try { portalRequest = this.portalRequestUtils.getCurrentPortalRequest(); } catch (IllegalStateException ise) { this.logger.warn( "No current portal request available, cannot determine current user name."); return null; } final IPerson person = this.personManager.getPerson(portalRequest); if (person == null) { this.logger.warn( "IPersonManager returned no IPerson for request, cannot determine current user name. " + portalRequest); return null; } return person.getUserName(); }  }
PersonManagerCurrentUserProvider implements ICurrentUserProvider { @Override public String getCurrentUserName() { final HttpServletRequest portalRequest; try { portalRequest = this.portalRequestUtils.getCurrentPortalRequest(); } catch (IllegalStateException ise) { this.logger.warn( "No current portal request available, cannot determine current user name."); return null; } final IPerson person = this.personManager.getPerson(portalRequest); if (person == null) { this.logger.warn( "IPersonManager returned no IPerson for request, cannot determine current user name. " + portalRequest); return null; } return person.getUserName(); }  IPersonManager getPersonManager(); @Autowired void setPersonManager(IPersonManager personManager); @Autowired void setPortalRequestUtils(IPortalRequestUtils portalRequestUtils); @Override String getCurrentUserName(); }
PersonManagerCurrentUserProvider implements ICurrentUserProvider { @Override public String getCurrentUserName() { final HttpServletRequest portalRequest; try { portalRequest = this.portalRequestUtils.getCurrentPortalRequest(); } catch (IllegalStateException ise) { this.logger.warn( "No current portal request available, cannot determine current user name."); return null; } final IPerson person = this.personManager.getPerson(portalRequest); if (person == null) { this.logger.warn( "IPersonManager returned no IPerson for request, cannot determine current user name. " + portalRequest); return null; } return person.getUserName(); }  IPersonManager getPersonManager(); @Autowired void setPersonManager(IPersonManager personManager); @Autowired void setPortalRequestUtils(IPortalRequestUtils portalRequestUtils); @Override String getCurrentUserName();  }