Skip to content

Commit

Permalink
Updated Dynamic service impl
Browse files Browse the repository at this point in the history
  • Loading branch information
balaji-alluru committed Apr 26, 2024
1 parent c5c8838 commit 929ade1
Show file tree
Hide file tree
Showing 2 changed files with 22 additions and 2 deletions.
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
package io.mosip.kernel.masterdata.dto;

import com.fasterxml.jackson.annotation.JsonIgnoreProperties;

import lombok.AllArgsConstructor;
import lombok.Data;
import lombok.NoArgsConstructor;

@Data
@AllArgsConstructor
@NoArgsConstructor
@JsonIgnoreProperties(ignoreUnknown = true)
public class DynamicFieldCodeValueDTO {

private String code;

private String value;

}
Original file line number Diff line number Diff line change
Expand Up @@ -511,14 +511,15 @@ public DynamicFieldConsolidateResponseDto getDynamicFieldByNameAndLangcode(Strin
DynamicFieldConsolidateResponseDto dto = new DynamicFieldConsolidateResponseDto();
dto.setDescription(lst.get(0).getDescription());
dto.setName(lst.get(0).getName());
dto.setJsonValues(null);
List<DynamicFieldCodeValueDTO> dtolist = new ArrayList<DynamicFieldCodeValueDTO>();
if (withValue == true) {

List<JSONObject> l = new ArrayList<>();
for (int i = 0; i < lst.size(); i++) {
l.add(new JSONObject(lst.get(i).getValueJson()));
dtolist.add(objectMapper.readValue(lst.get(i).getValueJson(),DynamicFieldCodeValueDTO.class));
}
dto.setJsonValues(new JSONArray(l));
dto.setValues(dtolist);
}

return dto;
Expand Down

0 comments on commit 929ade1

Please sign in to comment.