private PurposePIICategory getPurposePIICategory(PurposePIICategory purposePIICategory) throws ConsentManagementException { PIICategory piiCategory = getPiiCategoryById(purposePIICategory.getId()); PurposePIICategory purposePIICategoryResult = new PurposePIICategory(piiCategory, purposePIICategory.getMandatory()); return purposePIICategoryResult; } }
/** * Get mandatory PIIs of a purpose. * * @param purpose Purpose. * @return A set of mandatory PIIs in the given purpose. * @throws ConsentUtilityServiceException ConsentUtilityServiceException. */ public Set<Integer> getMandatoryPIIs(Purpose purpose) throws ConsentUtilityServiceException { if (purpose == null) { throw new ConsentUtilityServiceException("Purposes List should not be null"); } Set<Integer> mandatoryPIIs = new HashSet<>(); purpose = fillPurpose(purpose); List<PurposePIICategory> purposePIICategories = purpose.getPurposePIICategories(); for (PurposePIICategory purposePIICategory : purposePIICategories) { if (purposePIICategory.getMandatory()) { mandatoryPIIs.add(purposePIICategory.getId()); } } return mandatoryPIIs; }
/** * Get mandatory PIIs of a purpose. * * @param purpose Purpose. * @return A set of mandatory PIIs in the given purpose. * @throws ConsentUtilityServiceException ConsentUtilityServiceException. */ public Set<Integer> getMandatoryPIIs(Purpose purpose) throws ConsentUtilityServiceException { if (purpose == null) { throw new ConsentUtilityServiceException("Purposes List should not be null"); } Set<Integer> mandatoryPIIs = new HashSet<>(); purpose = fillPurpose(purpose); List<PurposePIICategory> purposePIICategories = purpose.getPurposePIICategories(); for (PurposePIICategory purposePIICategory : purposePIICategories) { if (purposePIICategory.getMandatory()) { mandatoryPIIs.add(purposePIICategory.getId()); } } return mandatoryPIIs; }
throw handleClientException(ERROR_CODE_PII_CATEGORY_ID_INVALID, String.valueOf(id)); if (purposePIICategory.getMandatory() == null) { throw handleClientException(ERROR_CODE_PURPOSE_PII_CONSTRAINT_REQUIRED, String.valueOf(id));
preparedStatement.setInt(1, insertedId); preparedStatement.setInt(2, piiCategory.getId()); preparedStatement.setInt(3, piiCategory.getMandatory() ? 1 : 0); }), piiCategory, false); } catch (DataAccessException e) {