Updated code for label in pdf
This commit is contained in:
@@ -251,7 +251,7 @@ public class PdfDao {
|
||||
List<String> keys = new ArrayList<>(entry.keySet()); // Get all keys in the current map
|
||||
|
||||
// Handle based on the number of keys in the map
|
||||
if (Boolean.FALSE.equals(containsThreeValues) && keys.size() == 2) {
|
||||
if (Boolean.FALSE.equals(containsThreeValues) && (keys.size() == 2 || keys.size()<2)) {
|
||||
// Treat the first key as the "key" and second key as the "value"
|
||||
String heading = (String) entry.get(keys.get(0)); // Get value of first key
|
||||
String value1 = (String) entry.get(keys.get(1)); // Get value of second key
|
||||
@@ -475,6 +475,16 @@ public class PdfDao {
|
||||
// If the content with the matching fieldId is found, create a label-value pair
|
||||
if (matchingContent.isPresent()) {
|
||||
String name = matchingContent.get().getName();
|
||||
ContentResponseBean content = matchingContent.get();
|
||||
|
||||
// Find the setting where the name is "label"
|
||||
String contentLabel = content.getSettings().stream()
|
||||
.filter(setting -> "label".equals(setting.getName())) // Filter settings by name
|
||||
.map(SettingResponseBean::getValue) // Extract the value from the matching setting
|
||||
.map(Object::toString) // Convert the value to a string
|
||||
.findFirst() // Get the first matching value
|
||||
.orElse(null); // If no match is found, set label to null
|
||||
|
||||
if (name.equals("fileupload")) {
|
||||
|
||||
// Step 1: Check if fieldValue is an instance of List<DocumentResponseBean>
|
||||
@@ -518,12 +528,9 @@ public class PdfDao {
|
||||
}
|
||||
}
|
||||
}
|
||||
String label = matchingContent.get().getLabel();
|
||||
// Add the label-value pair to the list
|
||||
if (fieldValue != null && !fieldValue.toString().trim().isEmpty()) {
|
||||
fieldValue = findLabelInOptions(matchingContent.get().getSettings(), fieldValue);
|
||||
labelValuePairs.add(new FieldLabelValuePairRequest(label, fieldValue));
|
||||
}
|
||||
labelValuePairs.add(new FieldLabelValuePairRequest(contentLabel, fieldValue));
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user