Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

MOSIP-37784 Fixed name issue #1360

Merged
merged 4 commits into from
Nov 25, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
\echo 'Upgrade Queries not required for transition from $CURRENT_VERSION to $UPGRADE_VERSION'
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
\echo 'Upgrade Queries not required for transition from $CURRENT_VERSION to $UPGRADE_VERSION'
Original file line number Diff line number Diff line change
Expand Up @@ -23,14 +23,14 @@
import io.mosip.resident.validator.RequestValidator;
import reactor.util.function.Tuple2;
import reactor.util.function.Tuples;
import io.mosip.resident.constant.RegistrationConstants;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.core.env.Environment;
import org.springframework.security.core.context.SecurityContextHolder;
import org.springframework.stereotype.Component;

import javax.annotation.PostConstruct;
import java.io.IOException;
import java.nio.charset.StandardCharsets;
import java.time.LocalDate;
Expand Down Expand Up @@ -148,17 +148,17 @@ public IdentityDTO getIdentity(String id, boolean fetchFace, String langCode) th
return identityDTO;
}

public String getFullName(Map<String, Object> identity, String langCode) throws ResidentServiceCheckedException, IOException {
if(nameValueList==null){
nameValueList= getNameValueFromIdentityMapping();
public String getFullName(Map<String, Object> identity, String langCode)
throws ResidentServiceCheckedException, IOException {
if (nameValueList == null) {
nameValueList = getNameValueFromIdentityMapping();
}
StringBuilder nameValue = new StringBuilder();
for (String nameString : nameValueList) {
nameValue.append(getValueFromIdentityMapping(nameString, identity, langCode));
}
return String.valueOf(nameValue);
return nameValueList.stream()
.map(nameString -> getValueFromIdentityMapping(nameString, identity, langCode))
.collect(Collectors.joining(RegistrationConstants.SPACE));
}


private String getValueFromIdentityMapping(String nameString, Map<String, Object> identity, String langCode) {
if (nameString == null || identity == null || langCode == null) {
return ""; // Return early if any input is null
Expand Down Expand Up @@ -206,6 +206,7 @@ public List<String> getNameValueFromIdentityMapping() throws ResidentServiceChec
}
return nameValueList;
}


@Override
public Map<String, Object> getIdentityAttributes(String id, String schemaType) throws ResidentServiceCheckedException, IOException {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,10 @@

import static org.springframework.test.web.servlet.result.MockMvcResultMatchers.status;

import java.io.IOException;
import java.util.Map;

import io.mosip.resident.exception.ResidentServiceCheckedException;
import io.mosip.resident.util.Utility;
import org.junit.Before;
import org.junit.Test;
Expand Down Expand Up @@ -92,7 +94,7 @@ public class IdAuthControllerTest {
private RequestWrapper<IdAuthRequestDto> requestWrapper;

@Before
public void setUp() {
public void setUp() throws ResidentServiceCheckedException, IOException {
MockitoAnnotations.initMocks(this);
this.mockMvc = MockMvcBuilders.standaloneSetup(idAuthController).build();
requestWrapper = new RequestWrapper<IdAuthRequestDto>();
Expand Down
Loading