private List<PIICategoryValidity> getPIICategoryInfoOfPurpose(int serviceToPurposeId, String consentReceiptId, ReceiptContext receiptContext) throws ConsentManagementServerException { JdbcTemplate jdbcTemplate = JdbcUtils.getNewTemplate(); try { return jdbcTemplate.withTransaction(template -> template.executeQuery(GET_PII_CAT_SQL, ((resultSet, rowNumber) -> { String name = resultSet.getString(1); boolean isSensitive = resultSet.getInt(2) == 1; String validity = resultSet.getString(3); int id = resultSet.getInt(4); String displayName = resultSet.getString(5); if (isSensitive) { receiptContext.getSecretPIICategory().addSecretCategory(name); } return new PIICategoryValidity(name, validity, id, displayName); }), preparedStatement -> preparedStatement.setInt(1, serviceToPurposeId))); } catch (TransactionException e) { throw ConsentUtils.handleServerException(ErrorMessages.ERROR_CODE_RETRIEVE_RECEIPT_INFO, consentReceiptId, e); } }
for (int categoryIndex = 0; categoryIndex < piiCategories.length(); categoryIndex++) { JSONObject piiCategory = (JSONObject) piiCategories.get(categoryIndex); PIICategoryValidity piiCategoryValidity = new PIICategoryValidity(piiCategory.getInt("piiCategoryId"), FrameworkConstants.Consent.INFINITE_TERMINATION); piiCategoryValidities.add(piiCategoryValidity);
for (int categoryIndex = 0; categoryIndex < piiCategories.length(); categoryIndex++) { JSONObject piiCategory = (JSONObject) piiCategories.get(categoryIndex); PIICategoryValidity piiCategoryValidity = new PIICategoryValidity(piiCategory.getInt("piiCategoryId"), FrameworkConstants.Consent.INFINITE_TERMINATION); piiCategoryValidities.add(piiCategoryValidity);
private List<PIICategoryValidity> getPiiCategoryValiditiesForClaims(List<ClaimMetaData> claims, String termination) throws SSOConsentServiceException { List<PIICategoryValidity> piiCategoryIds = new ArrayList<>(); for (ClaimMetaData claim : claims) { PIICategory piiCategory; try { piiCategory = getConsentManager().getPIICategoryByName(claim.getClaimUri()); } catch (ConsentManagementClientException e) { if (isInvalidPIICategoryError(e)) { piiCategory = addPIICategoryForClaim(claim); } else { throw new SSOConsentServiceException("Consent PII category error", "Error while retrieving" + " PII category: " + DEFAULT_PURPOSE_CATEGORY, e); } } catch (ConsentManagementException e) { throw new SSOConsentServiceException("Consent PII category error", "Error while retrieving " + "PII category: " + DEFAULT_PURPOSE_CATEGORY, e); } piiCategoryIds.add(new PIICategoryValidity(piiCategory.getId(), termination)); } return piiCategoryIds; }
private List<PIICategoryValidity> getPiiCategoryValiditiesForClaims(List<ClaimMetaData> claims, String termination) throws SSOConsentServiceException { List<PIICategoryValidity> piiCategoryIds = new ArrayList<>(); for (ClaimMetaData claim : claims) { PIICategory piiCategory; try { piiCategory = getConsentManager().getPIICategoryByName(claim.getClaimUri()); } catch (ConsentManagementClientException e) { if (isInvalidPIICategoryError(e)) { piiCategory = addPIICategoryForClaim(claim); } else { throw new SSOConsentServiceException("Consent PII category error", "Error while retrieving" + " PII category: " + DEFAULT_PURPOSE_CATEGORY, e); } } catch (ConsentManagementException e) { throw new SSOConsentServiceException("Consent PII category error", "Error while retrieving " + "PII category: " + DEFAULT_PURPOSE_CATEGORY, e); } piiCategoryIds.add(new PIICategoryValidity(piiCategory.getId(), termination)); } return piiCategoryIds; }