@Test public void testNoArp() { Person p = new Person(); p.setDisplayName("john.doe"); ARP arp = new ARP(); arp.setNoArp(true); Person enforced = e.enforceARP(p, arp); assertEquals(p.getDisplayName(), enforced.getDisplayName()); }
public Person enforceARP(Person person, ARP arp) { Assert.notNull(person); if (arp == null || arp.isNoArp()) { return person; } Person newP = new Person(); if (arp.isNoAttrArp()) { return newP; } final Set<String> arpAttributeNames = arp.getAttributes().keySet(); if (CollectionUtils.containsAny(nameAttributes, arpAttributeNames)) { newP.setDisplayName(person.getDisplayName()); newP.setName(person.getName()); newP.setNickname(person.getNickname()); } if (CollectionUtils.containsAny(organizationAttributes, arpAttributeNames)) { newP.setOrganizations(person.getOrganizations()); } if (arpAttributeNames.contains(Attribute.EMAIL.name)) { newP.setEmails(person.getEmails()); } if (CollectionUtils.containsAny(idAttributes, arpAttributeNames)) { newP.setTags(person.getTags()); newP.setAccounts(person.getAccounts()); newP.setId(person.getId()); newP.setVoot_membership_role(person.getVoot_membership_role()); } return newP; }
PersonARPEnforcer { public Person enforceARP(Person person, ARP arp) { Assert.notNull(person); if (arp == null || arp.isNoArp()) { return person; } Person newP = new Person(); if (arp.isNoAttrArp()) { return newP; } final Set<String> arpAttributeNames = arp.getAttributes().keySet(); if (CollectionUtils.containsAny(nameAttributes, arpAttributeNames)) { newP.setDisplayName(person.getDisplayName()); newP.setName(person.getName()); newP.setNickname(person.getNickname()); } if (CollectionUtils.containsAny(organizationAttributes, arpAttributeNames)) { newP.setOrganizations(person.getOrganizations()); } if (arpAttributeNames.contains(Attribute.EMAIL.name)) { newP.setEmails(person.getEmails()); } if (CollectionUtils.containsAny(idAttributes, arpAttributeNames)) { newP.setTags(person.getTags()); newP.setAccounts(person.getAccounts()); newP.setId(person.getId()); newP.setVoot_membership_role(person.getVoot_membership_role()); } return newP; } }
PersonARPEnforcer { public Person enforceARP(Person person, ARP arp) { Assert.notNull(person); if (arp == null || arp.isNoArp()) { return person; } Person newP = new Person(); if (arp.isNoAttrArp()) { return newP; } final Set<String> arpAttributeNames = arp.getAttributes().keySet(); if (CollectionUtils.containsAny(nameAttributes, arpAttributeNames)) { newP.setDisplayName(person.getDisplayName()); newP.setName(person.getName()); newP.setNickname(person.getNickname()); } if (CollectionUtils.containsAny(organizationAttributes, arpAttributeNames)) { newP.setOrganizations(person.getOrganizations()); } if (arpAttributeNames.contains(Attribute.EMAIL.name)) { newP.setEmails(person.getEmails()); } if (CollectionUtils.containsAny(idAttributes, arpAttributeNames)) { newP.setTags(person.getTags()); newP.setAccounts(person.getAccounts()); newP.setId(person.getId()); newP.setVoot_membership_role(person.getVoot_membership_role()); } return newP; }  }
PersonARPEnforcer { public Person enforceARP(Person person, ARP arp) { Assert.notNull(person); if (arp == null || arp.isNoArp()) { return person; } Person newP = new Person(); if (arp.isNoAttrArp()) { return newP; } final Set<String> arpAttributeNames = arp.getAttributes().keySet(); if (CollectionUtils.containsAny(nameAttributes, arpAttributeNames)) { newP.setDisplayName(person.getDisplayName()); newP.setName(person.getName()); newP.setNickname(person.getNickname()); } if (CollectionUtils.containsAny(organizationAttributes, arpAttributeNames)) { newP.setOrganizations(person.getOrganizations()); } if (arpAttributeNames.contains(Attribute.EMAIL.name)) { newP.setEmails(person.getEmails()); } if (CollectionUtils.containsAny(idAttributes, arpAttributeNames)) { newP.setTags(person.getTags()); newP.setAccounts(person.getAccounts()); newP.setId(person.getId()); newP.setVoot_membership_role(person.getVoot_membership_role()); } return newP; }  Person enforceARP(Person person, ARP arp); }
PersonARPEnforcer { public Person enforceARP(Person person, ARP arp) { Assert.notNull(person); if (arp == null || arp.isNoArp()) { return person; } Person newP = new Person(); if (arp.isNoAttrArp()) { return newP; } final Set<String> arpAttributeNames = arp.getAttributes().keySet(); if (CollectionUtils.containsAny(nameAttributes, arpAttributeNames)) { newP.setDisplayName(person.getDisplayName()); newP.setName(person.getName()); newP.setNickname(person.getNickname()); } if (CollectionUtils.containsAny(organizationAttributes, arpAttributeNames)) { newP.setOrganizations(person.getOrganizations()); } if (arpAttributeNames.contains(Attribute.EMAIL.name)) { newP.setEmails(person.getEmails()); } if (CollectionUtils.containsAny(idAttributes, arpAttributeNames)) { newP.setTags(person.getTags()); newP.setAccounts(person.getAccounts()); newP.setId(person.getId()); newP.setVoot_membership_role(person.getVoot_membership_role()); } return newP; }  Person enforceARP(Person person, ARP arp);  }