com.github.javaclub.base.service.impl.AdminUserProfileBuilderImpl Maven / Gradle / Ivy
package com.github.javaclub.base.service.impl;
import java.util.Map;
import org.springframework.stereotype.Service;
import com.github.javaclub.base.domain.AdminUser;
import com.github.javaclub.base.service.AdminUserProfileBuilder;
import com.github.javaclub.base.service.AdminUserProfileFiller;
import com.github.javaclub.sword.core.Maps;
import com.github.javaclub.toolbox.spring.BeanFactory;
import lombok.extern.slf4j.Slf4j;
@Service
@Slf4j
public class AdminUserProfileBuilderImpl implements AdminUserProfileBuilder {
@Override
public void onLogin(AdminUser user) {
Map map = BeanFactory.getInstance().getBeansOfType(AdminUserProfileFiller.class);
if (Maps.isEmpty(map)) {
return;
}
for (AdminUserProfileFiller filler : map.values()) {
try {
filler.setExtraProfile(user);
} catch (Exception e) {
log.error("AdminUser onLogin setExtraProfile error: filler=" + filler, e);
}
}
}
}