/** * Create an instance of {@link OtherNames } * */ public OtherNames createOtherNames() { return new OtherNames(); }
private OtherNames getOtherNames(ProfileEntity profile) { OtherNames otherNames = new OtherNames(); Visibility mostRestrictive = Visibility.PUBLIC; Set<OtherNameEntity> otherNamesEntitiy = profile.getOtherNames(); if (otherNamesEntitiy != null && otherNamesEntitiy.size() > 0) { for (OtherNameEntity otherNameEntity : otherNamesEntitiy) { //will only be null if there's an issue with the data or you're using this layer directly Visibility vis = (otherNameEntity.getVisibility() != null)?Visibility.valueOf(otherNameEntity.getVisibility()):Visibility.PRIVATE; if (vis.isMoreRestrictiveThan(mostRestrictive)) mostRestrictive = vis; OtherName otherName = new OtherName(otherNameEntity.getDisplayName(), vis); if(!PojoUtil.isEmpty(otherNameEntity.getElementSourceId())) { Source source = getSource(otherNameEntity); otherName.setSource(source); } otherNames.getOtherName().add(otherName); } } otherNames.setVisibility(mostRestrictive); return otherNames; }