private ReceiptPurposeInput getReceiptPurposeInput(String consentType, String termination, Purpose purpose, List<PIICategoryValidity> piiCategoryIds, List<Integer> purposeCategoryIds) { ReceiptPurposeInput purposeInput = new ReceiptPurposeInput(); purposeInput.setPrimaryPurpose(true); purposeInput.setTermination(termination); purposeInput.setConsentType(consentType); purposeInput.setThirdPartyDisclosure(false); purposeInput.setPurposeId(purpose.getId()); purposeInput.setPurposeCategoryId(purposeCategoryIds); purposeInput.setPiiCategory(piiCategoryIds); return purposeInput; }
/** * This API is used to set the API version is being used. * * @param receiptInput ReceiptInput. */ protected void setAPIVersion(ReceiptInput receiptInput) { receiptInput.setVersion(API_VERSION); }
public ConsentManagerImpl(ConsentManagerConfigurationHolder configHolder) { purposeDAOs = configHolder.getPurposeDAOs(); purposeCategoryDAOs = configHolder.getPurposeCategoryDAOs(); piiCategoryDAOs = configHolder.getPiiCategoryDAOs(); receiptDAOs = configHolder.getReceiptDAOs(); piiControllers = configHolder.getPiiControllers(); configParser = configHolder.getConfigParser(); realmService = configHolder.getRealmService(); }
public PIICategory getPIICategory(int piiCategoryId) throws ConsentManagementException { ConsentMessageContext context = new ConsentMessageContext(); ConsentInterceptorTemplate<PIICategory, ConsentManagementException> template = new ConsentInterceptorTemplate<>(consentMgtInterceptors, context); return template.intercept(PRE_GET_PII_CATEGORY, properties -> properties.put(PII_CATEGORY_ID, piiCategoryId)) .executeWith(new OperationDelegate<PIICategory>() { @Override public PIICategory execute() throws ConsentManagementException { return consentManager.getPIICategory(piiCategoryId); } }) .intercept(POST_GET_PII_CATEGORY, properties -> properties.put(PII_CATEGORY_ID, piiCategoryId)) .getResult(); }
private ReceiptInput getReceiptInput(String subject, String collectionMethod, String jurisdiction, String language, String policyUrl, List<ReceiptServiceInput> serviceInputs, Map<String, String> properties) { ReceiptInput receiptInput = new ReceiptInput(); receiptInput.setCollectionMethod(collectionMethod); receiptInput.setJurisdiction(jurisdiction); receiptInput.setLanguage(language); receiptInput.setPolicyUrl(policyUrl); receiptInput.setServices(serviceInputs); receiptInput.setProperties(properties); receiptInput.setPiiPrincipalId(subject); return receiptInput; }
public PurposePIICategory(PIICategory piiCategory, Boolean mandatory) { super(piiCategory.getId(), piiCategory.getName(), piiCategory.getDescription(), piiCategory.getSensitive(), piiCategory.getTenantId(), piiCategory.getDisplayName()); this.mandatory = mandatory; }
private List<PIICategoryValidity> getPIICategoriesFromServices(List<ReceiptService> receiptServices) { List<PIICategoryValidity> piiCategoryValidityMap = new ArrayList<>(); for (ReceiptService receiptService : receiptServices) { List<ConsentPurpose> purposes = receiptService.getPurposes(); for (ConsentPurpose purpose : purposes) { piiCategoryValidityMap.addAll(piiCategoryValidityMap.size(), purpose.getPiiCategory()); } } return piiCategoryValidityMap; }
protected void setReceiptSensitivity(ReceiptContext receiptContext, Receipt receipt) { if (receiptContext.getSecretPIICategory().getSecretPIICategories().size() > 0) { receipt.setSensitive(true); receipt.setSpiCat(receiptContext.getSecretPIICategory().getSecretPIICategories()); } }
/** * Execute the main logic. * * @param delegate Functional delegate interface. * @return ConsentInterceptorTemplate. * @throws X Generic exception thrown. If any. */ public ConsentInterceptorTemplate<T, X> executeWith(OperationDelegate<T> delegate) throws X { result = delegate.execute(); return this; }
public InterceptingConsentManager(ConsentManagerConfigurationHolder configHolder, List<ConsentMgtInterceptor> consentMgtInterceptors) { super(configHolder, consentMgtInterceptors); this.realmService = configHolder.getRealmService(); }
public ReceiptContext() { this.secretPIICategory = new SecretPIICategory(); }
private ReceiptPurposeInput getReceiptPurposeInput(String consentType, String termination, Purpose purpose, List<PIICategoryValidity> piiCategoryIds, List<Integer> purposeCategoryIds) { ReceiptPurposeInput purposeInput = new ReceiptPurposeInput(); purposeInput.setPrimaryPurpose(true); purposeInput.setTermination(termination); purposeInput.setConsentType(consentType); purposeInput.setThirdPartyDisclosure(false); purposeInput.setPurposeId(purpose.getId()); purposeInput.setPurposeCategoryId(purposeCategoryIds); purposeInput.setPiiCategory(piiCategoryIds); return purposeInput; }
public void revokeReceipt(String receiptId) throws ConsentManagementException { ConsentMessageContext context = new ConsentMessageContext(); ConsentInterceptorTemplate<Void, ConsentManagementException> template = new ConsentInterceptorTemplate<>(consentMgtInterceptors, context); template.intercept(PRE_REVOKE_RECEIPT, properties -> properties.put(RECEIPT_ID, receiptId)) .executeWith(new OperationDelegate<Void>() { @Override public Void execute() throws ConsentManagementException { consentManager.revokeReceipt(receiptId); return null; } }) .intercept(POST_REVOKE_RECEIPT, properties -> properties.put(RECEIPT_ID, receiptId)); }
private ReceiptInput getReceiptInput(String subject, String collectionMethod, String jurisdiction, String language, String policyUrl, List<ReceiptServiceInput> serviceInputs, Map<String, String> properties) { ReceiptInput receiptInput = new ReceiptInput(); receiptInput.setCollectionMethod(collectionMethod); receiptInput.setJurisdiction(jurisdiction); receiptInput.setLanguage(language); receiptInput.setPolicyUrl(policyUrl); receiptInput.setServices(serviceInputs); receiptInput.setProperties(properties); receiptInput.setPiiPrincipalId(subject); return receiptInput; }
public boolean isPurposeCategoryExists(String name) throws ConsentManagementException { ConsentMessageContext context = new ConsentMessageContext(); ConsentInterceptorTemplate<Boolean, ConsentManagementException> template = new ConsentInterceptorTemplate<>(consentMgtInterceptors, context); return template.intercept(PRE_IS_PURPOSE_CATEGORY_EXIST, properties -> properties.put(PURPOSE_CATEGORY_NAME, name)) .executeWith(new OperationDelegate<Boolean>() { @Override public Boolean execute() throws ConsentManagementException { return consentManager.isPurposeCategoryExists(name); } }) .intercept(POST_IS_PURPOSE_CATEGORY_EXIST, properties -> properties.put(PURPOSE_CATEGORY_NAME, name)) .getResult(); }
public PIICategory addPIICategory(PIICategory piiCategory) throws ConsentManagementException { ConsentMessageContext context = new ConsentMessageContext(); ConsentInterceptorTemplate<PIICategory, ConsentManagementException> template = new ConsentInterceptorTemplate<>(consentMgtInterceptors, context); return template.intercept(PRE_ADD_PII_CATEGORY, properties -> properties.put(PII_CATEGORY, piiCategory)) .executeWith(new OperationDelegate<PIICategory>() { @Override public PIICategory execute() throws ConsentManagementException { return consentManager.addPIICategory(piiCategory); } }) .intercept(POST_ADD_PII_CATEGORY, properties -> properties.put(PII_CATEGORY, piiCategory)) .getResult(); }
public AddReceiptResponse addConsent(ReceiptInput receiptInput) throws ConsentManagementException { ConsentMessageContext context = new ConsentMessageContext(); ConsentInterceptorTemplate<AddReceiptResponse, ConsentManagementException> template = new ConsentInterceptorTemplate<>(consentMgtInterceptors, context); return template.intercept(PRE_ADD_RECEIPT, properties -> properties.put(RECEIPT_INPUT, receiptInput)) .executeWith(new OperationDelegate<AddReceiptResponse>() { @Override public AddReceiptResponse execute() throws ConsentManagementException { return consentManager.addConsent(receiptInput); } }) .intercept(POST_ADD_RECEIPT, properties -> properties.put(RECEIPT_INPUT, receiptInput)) .getResult(); }
public boolean isPIICategoryExists(String name) throws ConsentManagementException { ConsentMessageContext context = new ConsentMessageContext(); ConsentInterceptorTemplate<Boolean, ConsentManagementException> template = new ConsentInterceptorTemplate<>(consentMgtInterceptors, context); return template.intercept(PRE_IS_PII_CATEGORY_EXIST, properties -> properties.put(PII_CATEGORY_NAME, name)) .executeWith(new OperationDelegate<Boolean>() { @Override public Boolean execute() throws ConsentManagementException { return consentManager.isPIICategoryExists(name); } }) .intercept(POST_IS_PII_CATEGORY_EXIST, properties -> properties.put(PII_CATEGORY_NAME, name)) .getResult(); }
public void deletePIICategory(int piiCategoryId) throws ConsentManagementException { ConsentMessageContext context = new ConsentMessageContext(); ConsentInterceptorTemplate<Void, ConsentManagementException> template = new ConsentInterceptorTemplate<>(consentMgtInterceptors, context); template.intercept(PRE_DELETE_PII_CATEGORY, properties -> properties.put(PII_CATEGORY_ID, piiCategoryId)) .executeWith(new OperationDelegate<Void>() { @Override public Void execute() throws ConsentManagementException { consentManager.deletePIICategory(piiCategoryId); return null; } }) .intercept(POST_DELETE_PII_CATEGORY, properties -> properties.put(PII_CATEGORY_ID, piiCategoryId)); }
public void deleteReceipt(String receiptId) throws ConsentManagementException { ConsentMessageContext context = new ConsentMessageContext(); ConsentInterceptorTemplate<Void, ConsentManagementException> template = new ConsentInterceptorTemplate<>(consentMgtInterceptors, context); template.intercept(PRE_DELETE_RECEIPT, properties -> properties.put(RECEIPT_ID, receiptId)) .executeWith(new OperationDelegate<Void>() { @Override public Void execute() throws ConsentManagementException { consentManager.deleteReceipt(receiptId); return null; } }) .intercept(POST_DELETE_RECEIPT, properties -> properties.put(RECEIPT_ID, receiptId)); }