protected <T> ObjectNode toJsonBase(Attribute<T> src) { ObjectNode root = mapper.createObjectNode(); root.put("visibility", src.getVisibility().name()); if (src.getRemoteIdp() != null) root.put("remoteIdp", src.getRemoteIdp()); if (src.getTranslationProfile() != null) root.put("translationProfile", src.getTranslationProfile()); ArrayNode values = root.putArray("values"); AttributeValueSyntax<T> syntax = src.getAttributeSyntax(); for (T value : src.getValues()) values.add(syntax.serialize(value)); return root; }
private String getAddressFrom( List<VerifiableEmail> emailIds, Attribute<?> emailAttr, boolean useConfirmed) { for (VerifiableEmail id : emailIds) if (!useConfirmed || id.isConfirmed()) return id.getValue(); if (emailAttr != null && (!useConfirmed || emailAttr.getAttributeSyntax().isVerifiable())) for (Object emailO : emailAttr.getValues()) { if (!useConfirmed) { return emailO.toString(); } else if (emailAttr.getAttributeSyntax().isVerifiable()) { VerifiableEmail email = (VerifiableEmail) emailO; if (!useConfirmed || email.isConfirmed()) return email.getValue(); } } return null; }