private void addConsents(Profile profile, Map<String, Object> sfdcLeadFields) { Map<String, Consent> consents = profile.getConsents(); String mappingConsentsString = sfdcConfiguration.getSfdcFieldsConsents(); if (!mappingConsentsString.isEmpty()) { String[] mappingConsents = mappingConsentsString.split(","); if (mappingConsents.length > 0) { for (String mappingConsent : mappingConsents) { String[] mappingConsentArray = mappingConsent.split("<=>"); if (mappingConsentArray.length <= 0) { logger.error("Error with the mapping for field {}, this field will not be mapped please check the cfg file", mappingConsentsString); } else { String consentUnomiId = mappingConsentArray[0]; if (consents.containsKey(consentUnomiId)) { String consentSfdcId = mappingConsentArray[1]; String consentValue = consents.get(consentUnomiId).getStatus().toString(); sfdcLeadFields.put(consentSfdcId, consentValue); logger.debug("Consent {} with value {} was mapped with {}", consentUnomiId, consentValue, consentSfdcId); } else { logger.debug("Consent {} not found in current profile or not answered yet", consentUnomiId); } } } } } }
if (profile.getConsents() != null && profile.getConsents().size() > 0) { for(String consentId : profile.getConsents().keySet()) { if(masterProfile.getConsents().containsKey(consentId)) { if(masterProfile.getConsents().get(consentId).getRevokeDate().before(new Date())) { masterProfile.getConsents().remove(consentId); masterProfileChanged = true; } else if(masterProfile.getConsents().get(consentId).getStatusDate().before(profile.getConsents().get(consentId).getStatusDate())) { masterProfile.getConsents().replace(consentId, profile.getConsents().get(consentId)); masterProfileChanged = true; masterProfile.getConsents().put(consentId, profile.getConsents().get(consentId)); masterProfileChanged = true;
if (profile.getConsents() != null && profile.getConsents().size() > 0) { for(String consentId : profile.getConsents().keySet()) { if(masterProfile.getConsents().containsKey(consentId)) { if(masterProfile.getConsents().get(consentId).getRevokeDate().before(new Date())) { masterProfile.getConsents().remove(consentId); masterProfileChanged = true; } else if(masterProfile.getConsents().get(consentId).getStatusDate().before(profile.getConsents().get(consentId).getStatusDate())) { masterProfile.getConsents().replace(consentId, profile.getConsents().get(consentId)); masterProfileChanged = true; masterProfile.getConsents().put(consentId, profile.getConsents().get(consentId)); masterProfileChanged = true;
@java.lang.Override protected DataTable buildDataTable() { Query query = new Query(); query.setSortby("properties.lastVisit:desc"); query.setLimit(maxEntries); Condition matchAllCondition = new Condition(definitionsService.getConditionType("matchAllCondition")); query.setCondition(matchAllCondition); PartialList<Profile> lastModifiedProfiles = profileService.search(query, Profile.class); DataTable dataTable = new DataTable(); for (Profile profile : lastModifiedProfiles.getList()) { ArrayList<Comparable> rowData = new ArrayList<>(); rowData.add(profile.getItemId()); rowData.add(profile.getScope()); rowData.add(StringUtils.join(profile.getSegments(), ",")); rowData.add(StringUtils.join(profile.getConsents().keySet(), ",")); rowData.add((String) profile.getProperty("lastVisit")); dataTable.addRow(rowData.toArray(new Comparable[rowData.size()])); } return dataTable; } }
return profile.getConsents();