public void addEditableCollectionLine(
     ProposalDevelopmentDocumentForm form, String selectedCollectionPath) {
   if (form.getEditableCollectionLines().containsKey(selectedCollectionPath)) {
     updateEditableCollectionLines(form, selectedCollectionPath);
   } else {
     List<String> newKeyList = new ArrayList<>();
     newKeyList.add("0");
     form.getEditableCollectionLines().put(selectedCollectionPath, newKeyList);
   }
 }
 public void updateEditableCollectionLines(
     ProposalDevelopmentDocumentForm form, String selectedCollectionPath) {
   List<String> indexes = new ArrayList<>();
   indexes.add("0");
   for (String index : form.getEditableCollectionLines().get(selectedCollectionPath)) {
     Integer newIndex = Integer.parseInt(index) + 1;
     indexes.add(newIndex.toString());
   }
   form.getEditableCollectionLines().get(selectedCollectionPath).clear();
   form.getEditableCollectionLines().get(selectedCollectionPath).addAll(indexes);
 }
 public AuditHelper.ValidationState getValidationState(ProposalDevelopmentDocumentForm form) {
   AuditHelper.ValidationState severityLevel = AuditHelper.ValidationState.OK;
   form.setAuditActivated(true);
   List<DataValidationItem> dataValidationItems =
       ((ProposalDevelopmentViewHelperServiceImpl) form.getViewHelperService())
           .populateDataValidation(form);
   if (dataValidationItems != null && dataValidationItems.size() > 0) {
     for (DataValidationItem validationItem : dataValidationItems) {
       if (StringUtils.endsWith(validationItem.getSeverity(), Constants.AUDIT_ERRORS)) {
         severityLevel = AuditHelper.ValidationState.ERROR;
         break;
       }
       if (StringUtils.equals(validationItem.getSeverity(), Constants.AUDIT_WARNINGS)) {
         severityLevel = AuditHelper.ValidationState.WARNING;
       }
     }
     form.setDataValidationItems(dataValidationItems);
   }
   getGlobalVariableService().getMessageMap().clearErrorMessages();
   return severityLevel;
 }
 /**
  * Method calls the permissions service, where it will determine if any user permissions need to
  * be added and/or removed.
  *
  * @param pdForm ProposalDevelopmentDocumentForm that contains the permissions helper
  */
 public void saveDocumentPermissions(ProposalDevelopmentDocumentForm pdForm) {
   List<String> editableLines =
       pdForm
           .getEditableCollectionLines()
           .get(Constants.PERMISSION_PROPOSAL_USERS_COLLECTION_PROPERTY_KEY);
   if (editableLines != null && editableLines.size() > 0) {
     getGlobalVariableService()
         .getMessageMap()
         .putErrorForSectionId(
             Constants.PERMISSION_PROPOSAL_USERS_COLLECTION_ID_KEY,
             KeyConstants.ERROR_UNFINISHED_PERMISSIONS);
   } else if (arePermissionsValid(
       pdForm.getProposalDevelopmentDocument(), pdForm.getWorkingUserRoles())) {
     getProposalDevelopmentPermissionsService()
         .savePermissions(
             pdForm.getProposalDevelopmentDocument(),
             getProposalDevelopmentPermissionsService()
                 .getPermissions(pdForm.getProposalDevelopmentDocument()),
             pdForm.getWorkingUserRoles());
   }
 }