public EntityRunner( int myThread, SystemUser su, String callerRef, String docType, Fortress fortress, Collection<TagInputBean> tags, int maxRun, CountDownLatch latch, CountDownLatch startSignal) { this.callerRef = callerRef; this.docType = docType; this.fortress = fortress; this.tags = tags; this.latch = latch; this.startSignal = startSignal; this.maxRun = maxRun; this.myThread = myThread; this.apiKey = su.getApiKey(); this.company = su.getCompany(); inputBeans = new ArrayList<>(); int count = 0; while (count < maxRun) { EntityInputBean inputBean = new EntityInputBean(fortress, "wally", docType, new DateTime(), callerRef + count); inputBean.setTags(tags); inputBeans.add(inputBean); count++; } }
@Override public UserProfile getUser(Authentication authentication) { Object userName = authentication.getPrincipal(); String login; User auth = null; if (userName instanceof String) login = (String) userName; else { login = ((User) authentication.getPrincipal()).getUsername(); auth = (User) authentication.getPrincipal(); } UserProfile userProfile = new UserProfile(); userProfile.setUserId(login); userProfile.setStatus("ENABLED"); if (auth != null && !auth.getAuthorities().isEmpty()) { for (GrantedAuthority grantedAuthority : auth.getAuthorities()) { userProfile.addUserRole(grantedAuthority.getAuthority()); } } if (auth != null) { SystemUser sysUser = systemUserService.findByLogin(login); if (sysUser != null) { userProfile.setApiKey(sysUser.getApiKey()); userProfile.setCompany(sysUser.getCompany().getName()); } } return userProfile; }