Done ticket GEPAFINBE-180
This commit is contained in:
@@ -485,6 +485,8 @@ public class GepafinConstant {
|
|||||||
public static final String USAGE="usage";
|
public static final String USAGE="usage";
|
||||||
public static final String LIMIT="limit";
|
public static final String LIMIT="limit";
|
||||||
public static final String DATA="data";
|
public static final String DATA="data";
|
||||||
|
|
||||||
|
public static final String FILE_SELECT = "fileselect";
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@@ -181,6 +181,7 @@ public class ApplicationAmendmentRequestDao {
|
|||||||
for (ApplicationFormEntity form : forms) {
|
for (ApplicationFormEntity form : forms) {
|
||||||
String content = form.getForm().getContent();
|
String content = form.getForm().getContent();
|
||||||
List<Map<String, Object>> result = filterByName(content, "fileupload");
|
List<Map<String, Object>> result = filterByName(content, "fileupload");
|
||||||
|
result.addAll(filterByName(content, GepafinConstant.FILE_SELECT));
|
||||||
List<AmendmentFormFieldResponse> amendmentFormFieldResponses= getIdAndLabelFromResult(result);
|
List<AmendmentFormFieldResponse> amendmentFormFieldResponses= getIdAndLabelFromResult(result);
|
||||||
amendmentFormFieldResponses.removeIf(amendmentFormFieldResponse -> {
|
amendmentFormFieldResponses.removeIf(amendmentFormFieldResponse -> {
|
||||||
FieldRequest matchingRequest = fieldRequestMap.get(amendmentFormFieldResponse.getFieldId());
|
FieldRequest matchingRequest = fieldRequestMap.get(amendmentFormFieldResponse.getFieldId());
|
||||||
@@ -533,12 +534,15 @@ public class ApplicationAmendmentRequestDao {
|
|||||||
}
|
}
|
||||||
return response;
|
return response;
|
||||||
}
|
}
|
||||||
|
|
||||||
private Map<String, String> extractFieldIdToLabelMap(List<ApplicationFormEntity> forms) {
|
private Map<String, String> extractFieldIdToLabelMap(List<ApplicationFormEntity> forms) {
|
||||||
return forms.stream()
|
return forms.stream()
|
||||||
.flatMap(form -> {
|
.flatMap(form -> {
|
||||||
String content = form.getForm().getContent();
|
String content = form.getForm().getContent();
|
||||||
return getIdAndLabelFromResult(filterByName(content, "fileupload")).stream();
|
List<Map<String, Object>> filteredResults = new ArrayList<>();
|
||||||
|
filteredResults.addAll(filterByName(content, "fileupload"));
|
||||||
|
filteredResults.addAll(filterByName(content, GepafinConstant.FILE_SELECT));
|
||||||
|
return getIdAndLabelFromResult(filteredResults).stream();
|
||||||
})
|
})
|
||||||
.collect(Collectors.toMap(AmendmentFormFieldResponse::getFieldId, AmendmentFormFieldResponse::getLabel));
|
.collect(Collectors.toMap(AmendmentFormFieldResponse::getFieldId, AmendmentFormFieldResponse::getLabel));
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -378,6 +378,9 @@ public class ApplicationEvaluationDao {
|
|||||||
case "fileupload":
|
case "fileupload":
|
||||||
mapFileFieldDetails(mappedField, formFieldId, applicationForm.getId(), applicationId);
|
mapFileFieldDetails(mappedField, formFieldId, applicationForm.getId(), applicationId);
|
||||||
break;
|
break;
|
||||||
|
case "fileselect":
|
||||||
|
mapFileFieldDetails(mappedField, formFieldId, applicationForm.getId(), applicationId);
|
||||||
|
break;
|
||||||
case "checkboxes":
|
case "checkboxes":
|
||||||
populateOptionFieldsAsFieldValue(mappedField, formFieldId, applicationForm, applicationId, contentBean);
|
populateOptionFieldsAsFieldValue(mappedField, formFieldId, applicationForm, applicationId, contentBean);
|
||||||
break;
|
break;
|
||||||
@@ -516,7 +519,7 @@ public class ApplicationEvaluationDao {
|
|||||||
List<ContentResponseBean> contentResponseBeans = formDao.convertFormEntityToFormResponseBean(formEntity).getContent();
|
List<ContentResponseBean> contentResponseBeans = formDao.convertFormEntityToFormResponseBean(formEntity).getContent();
|
||||||
contentResponseBeans.forEach(contentResponseBean -> {
|
contentResponseBeans.forEach(contentResponseBean -> {
|
||||||
// Check if this is a file upload field that matches the current field response
|
// Check if this is a file upload field that matches the current field response
|
||||||
if ("fileupload".equals(contentResponseBean.getName()) && contentResponseBean.getId().equals(fieldResponse.getId())) {
|
if (("fileupload".equals(contentResponseBean.getName()) || GepafinConstant.FILE_SELECT.equals(contentResponseBean.getName())) && contentResponseBean.getId().equals(fieldResponse.getId())) {
|
||||||
String label = null;
|
String label = null;
|
||||||
// Set the label if available
|
// Set the label if available
|
||||||
if (contentResponseBean.getSettings() != null) {
|
if (contentResponseBean.getSettings() != null) {
|
||||||
@@ -1252,7 +1255,9 @@ public class ApplicationEvaluationDao {
|
|||||||
case "fileupload":
|
case "fileupload":
|
||||||
populateFileDetailsAsFieldValue(mappedField, formFieldId, applicationForm, applicationId);
|
populateFileDetailsAsFieldValue(mappedField, formFieldId, applicationForm, applicationId);
|
||||||
break;
|
break;
|
||||||
|
case "fileselect":
|
||||||
|
populateFileDetailsAsFieldValue(mappedField, formFieldId, applicationForm, applicationId);
|
||||||
|
break;
|
||||||
case "checkboxes":
|
case "checkboxes":
|
||||||
populateOptionFieldsAsFieldValue(mappedField, formFieldId, applicationForm, applicationId, contentResponseBean);
|
populateOptionFieldsAsFieldValue(mappedField, formFieldId, applicationForm, applicationId, contentResponseBean);
|
||||||
break;
|
break;
|
||||||
@@ -1402,7 +1407,7 @@ public class ApplicationEvaluationDao {
|
|||||||
// List<ContentResponseBean> contentResponseBeans = Utils.convertJsonStringToList(formEntity.getContent(), ContentResponseBean.class);
|
// List<ContentResponseBean> contentResponseBeans = Utils.convertJsonStringToList(formEntity.getContent(), ContentResponseBean.class);
|
||||||
List<ContentResponseBean> contentResponseBeans = formDao.convertFormEntityToFormResponseBean(formEntity).getContent();
|
List<ContentResponseBean> contentResponseBeans = formDao.convertFormEntityToFormResponseBean(formEntity).getContent();
|
||||||
contentResponseBeans.forEach(contentResponseBean -> {
|
contentResponseBeans.forEach(contentResponseBean -> {
|
||||||
if ("fileupload".equals(contentResponseBean.getName()) && contentResponseBean.getId().equals(fieldResponse.getId())) {
|
if (("fileupload".equals(contentResponseBean.getName()) || GepafinConstant.FILE_SELECT.equals(contentResponseBean.getName())) && contentResponseBean.getId().equals(fieldResponse.getId())) {
|
||||||
String label = null;
|
String label = null;
|
||||||
if (contentResponseBean.getSettings() != null) {
|
if (contentResponseBean.getSettings() != null) {
|
||||||
for (SettingResponseBean setting : contentResponseBean.getSettings()) {
|
for (SettingResponseBean setting : contentResponseBean.getSettings()) {
|
||||||
@@ -1564,9 +1569,10 @@ public class ApplicationEvaluationDao {
|
|||||||
mappedField.setFieldName(contentResponseBean.getName());
|
mappedField.setFieldName(contentResponseBean.getName());
|
||||||
boolean isCheckbox = "checkboxes".equals(contentResponseBean.getName());
|
boolean isCheckbox = "checkboxes".equals(contentResponseBean.getName());
|
||||||
boolean isFileUpload = "fileupload".equals(contentResponseBean.getName());
|
boolean isFileUpload = "fileupload".equals(contentResponseBean.getName());
|
||||||
|
boolean isFileSelect = GepafinConstant.FILE_SELECT.equals(contentResponseBean.getName());
|
||||||
boolean isParagraph = "paragraph".equals(contentResponseBean.getName());
|
boolean isParagraph = "paragraph".equals(contentResponseBean.getName());
|
||||||
boolean isTable = "table".equals(contentResponseBean.getName());
|
boolean isTable = "table".equals(contentResponseBean.getName());
|
||||||
if (isFileUpload) {
|
if (isFileUpload || isFileSelect ) {
|
||||||
handleFileUpload(applicationId, criteriaFormField, mappedField);
|
handleFileUpload(applicationId, criteriaFormField, mappedField);
|
||||||
} else if (isCheckbox) {
|
} else if (isCheckbox) {
|
||||||
handleCheckbox(applicationId, criteriaFormField, contentResponseBean, mappedField);
|
handleCheckbox(applicationId, criteriaFormField, contentResponseBean, mappedField);
|
||||||
@@ -1773,7 +1779,7 @@ public class ApplicationEvaluationDao {
|
|||||||
List<ContentResponseBean> contentResponseBeans = formDao.convertFormEntityToFormResponseBean(formEntity).getContent();
|
List<ContentResponseBean> contentResponseBeans = formDao.convertFormEntityToFormResponseBean(formEntity).getContent();
|
||||||
|
|
||||||
for (ContentResponseBean contentResponseBean : contentResponseBeans) {
|
for (ContentResponseBean contentResponseBean : contentResponseBeans) {
|
||||||
if ("fileupload".equals(contentResponseBean.getName())) {
|
if ("fileupload".equals(contentResponseBean.getName()) || GepafinConstant.FILE_SELECT.equals(contentResponseBean.getName())) {
|
||||||
String fieldId = contentResponseBean.getId();
|
String fieldId = contentResponseBean.getId();
|
||||||
Long applicationFormId = applicationForm.getId();
|
Long applicationFormId = applicationForm.getId();
|
||||||
|
|
||||||
@@ -2103,7 +2109,8 @@ public class ApplicationEvaluationDao {
|
|||||||
|
|
||||||
List<ContentResponseBean> contentResponseBeans=evaluationFormDao.convertEvaluationFormEntityToEvaluationFormResponseBean(evaluationFormEntity).getContent();
|
List<ContentResponseBean> contentResponseBeans=evaluationFormDao.convertEvaluationFormEntityToEvaluationFormResponseBean(evaluationFormEntity).getContent();
|
||||||
for (ContentResponseBean contentResponseBean:contentResponseBeans){
|
for (ContentResponseBean contentResponseBean:contentResponseBeans){
|
||||||
if(Boolean.TRUE.equals(contentResponseBean.getName().equals("fileupload"))) {
|
if(Boolean.TRUE.equals(contentResponseBean.getName().equals("fileupload")) ||
|
||||||
|
Boolean.TRUE.equals(contentResponseBean.getName().equals(GepafinConstant.FILE_SELECT))){
|
||||||
if (contentResponseBean.getId().equals(applicationFormFieldRequestBean.getFieldId())) {
|
if (contentResponseBean.getId().equals(applicationFormFieldRequestBean.getFieldId())) {
|
||||||
Object fieldValueObject = applicationFormFieldRequestBean.getFieldValue();
|
Object fieldValueObject = applicationFormFieldRequestBean.getFieldValue();
|
||||||
if (fieldValueObject instanceof String) {
|
if (fieldValueObject instanceof String) {
|
||||||
@@ -2128,7 +2135,8 @@ public class ApplicationEvaluationDao {
|
|||||||
for (ApplicationEvaluationFormFieldEntity applicationEvaluationFormFieldEntity : evaluationFormFieldEntities) {
|
for (ApplicationEvaluationFormFieldEntity applicationEvaluationFormFieldEntity : evaluationFormFieldEntities) {
|
||||||
|
|
||||||
Optional<ContentResponseBean> fileUploadContent = contentResponseBeans.stream()
|
Optional<ContentResponseBean> fileUploadContent = contentResponseBeans.stream()
|
||||||
.filter(contentResponseBean -> "fileupload".equals(contentResponseBean.getName()) &&
|
.filter(contentResponseBean -> ("fileupload".equals(contentResponseBean.getName()) ||
|
||||||
|
GepafinConstant.FILE_SELECT.equals(contentResponseBean.getName())) &&
|
||||||
contentResponseBean.getId().equals(applicationEvaluationFormFieldEntity.getFieldId()))
|
contentResponseBean.getId().equals(applicationEvaluationFormFieldEntity.getFieldId()))
|
||||||
.findFirst();
|
.findFirst();
|
||||||
|
|
||||||
|
|||||||
@@ -184,8 +184,11 @@ public class EmailNotificationDao {
|
|||||||
// Extract data from forms
|
// Extract data from forms
|
||||||
for (ApplicationFormEntity form : forms) {
|
for (ApplicationFormEntity form : forms) {
|
||||||
String content = form.getForm().getContent();
|
String content = form.getForm().getContent();
|
||||||
List<Map<String, Object>> result = filterByName(content, "fileupload");
|
List<Map<String, Object>> fileUploadResult = filterByName(content, "fileupload");
|
||||||
allFormFields.addAll(getIdAndLabelFromResult(result));
|
allFormFields.addAll(getIdAndLabelFromResult(fileUploadResult));
|
||||||
|
|
||||||
|
List<Map<String, Object>> fileSelectResult = filterByName(content,GepafinConstant.FILE_SELECT);
|
||||||
|
allFormFields.addAll(getIdAndLabelFromResult(fileSelectResult));
|
||||||
}
|
}
|
||||||
|
|
||||||
// Process allFormFields and generate bullet points
|
// Process allFormFields and generate bullet points
|
||||||
|
|||||||
Reference in New Issue
Block a user