Skip to content
Snippets Groups Projects
Commit b66a753a authored by OZGCloud's avatar OZGCloud
Browse files

OZG-6162 add qualifier to ozgCloudUserProfileService injection

parent 5612caa6
No related branches found
No related tags found
No related merge requests found
......@@ -38,13 +38,13 @@ import org.springframework.stereotype.Service;
import de.ozgcloud.apilib.common.command.OzgCloudCommand;
import de.ozgcloud.apilib.common.command.OzgCloudCommandService;
import de.ozgcloud.apilib.common.command.grpc.CommandMapper;
import de.ozgcloud.command.Command;
import de.ozgcloud.common.errorhandling.TechnicalException;
import de.ozgcloud.document.bescheid.Bescheid;
import de.ozgcloud.document.bescheid.BescheidCallContextAttachingInterceptor;
import de.ozgcloud.document.bescheid.BescheidResponse;
import de.ozgcloud.command.Command;
import de.ozgcloud.document.common.attached_item.AttachedItemService;
import de.ozgcloud.document.common.attached_item.AttachedItem;
import de.ozgcloud.common.errorhandling.TechnicalException;
import de.ozgcloud.document.common.attached_item.AttachedItemService;
@Service
public class DocumentService {
......@@ -60,7 +60,7 @@ public class DocumentService {
@Autowired
private AttachedItemService attachedItemService;
@Autowired
@Qualifier("bescheid_OzgCloudCommandService")
@Qualifier(DocumentManagerConfiguration.COMMAND_SERVICE_NAME)
private OzgCloudCommandService commandService;
@Autowired
private CommandMapper commandMapper;
......
......@@ -25,12 +25,14 @@ package de.ozgcloud.document.bescheid.common.user;
import java.util.Optional;
import org.springframework.beans.factory.annotation.Qualifier;
import org.springframework.stereotype.Service;
import de.ozgcloud.apilib.user.OzgCloudUserId;
import de.ozgcloud.apilib.user.OzgCloudUserProfileService;
import de.ozgcloud.document.bescheid.common.callcontext.CurrentUserService;
import de.ozgcloud.common.errorhandling.TechnicalException;
import de.ozgcloud.document.DocumentManagerConfiguration;
import de.ozgcloud.document.bescheid.common.callcontext.CurrentUserService;
import lombok.RequiredArgsConstructor;
@Service
......@@ -38,11 +40,12 @@ import lombok.RequiredArgsConstructor;
public class UserProfileService {
private final CurrentUserService currentUserService;
private final Optional<OzgCloudUserProfileService> userProfileService;
@Qualifier(DocumentManagerConfiguration.USER_PROFILE_SERVICE_NAME)
private final Optional<OzgCloudUserProfileService> ozgCloudUserProfileService;
private final UserProfileMapper mapper;
public UserProfile getUserProfile() {
var service = userProfileService.orElseThrow(() -> new IllegalStateException("No connection to user-manager configured."));
var service = ozgCloudUserProfileService.orElseThrow(() -> new IllegalStateException("No connection to user-manager configured."));
return currentUserService.getUser().getUserId().map(OzgCloudUserId::from)
.map(service::getById)
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment