internalConsentPurposes.forEach(rethrowConsumer(consentPurpose -> { consentPurpose.setPiiCategory(getPIICategoryInfoOfPurpose( consentPurpose.getServiceToPurposeId(), consentReceiptId, receiptContext)); consentPurpose.setPurposeCategory(getPurposeCategoryInfoOfPurpose( consentPurpose.getServiceToPurposeId(), consentReceiptId)); }));
public void deleteReceipt(String receiptID) throws ConsentManagementException { Receipt receipt = getReceipt(receiptID); if (receipt == null) { throw ConsentUtils.handleServerException(ErrorMessages.ERROR_CODE_DELETE_RECEIPT, String .valueOf(receiptID)); } JdbcTemplate jdbcTemplate = JdbcUtils.getNewTemplate(); try { jdbcTemplate.withTransaction(template -> { receipt.getServices().forEach(rethrowConsumer(receiptService -> { int receiptToServiceId = receiptService.getReceiptToServiceId(); receiptService.getPurposes().forEach(rethrowConsumer(consentPurpose -> { int serviceToPurposeId = consentPurpose.getServiceToPurposeId(); deleteSpPurposeToPiiCategoryAssociation(serviceToPurposeId); deleteSpPurposeToPurposeCategoryAssociation(serviceToPurposeId); })); deleteSpToPurposeAssociation(receiptToServiceId); })); deleteReceiptSPAssociation(receiptID); deleteReceiptProperties(receiptID); deleteReceiptOnly(receiptID); return null; }); } catch (TransactionException e) { throw ConsentUtils.handleServerException(ErrorMessages.ERROR_CODE_DELETE_RECEIPT, receiptID, e); } }