Source:
private void storeApplicationAttributes(Application app) throws PerunException { User user = usersManager.getUserById(registrarSession, app.getUser().getId()); Member member = membersManager.getMemberByUser(registrarSession, app.getVo(), user); List<ApplicationFormItemData> items = getApplicationDataById(registrarSession, app.getId()); List<Attribute> attributes = new ArrayList<Attribute>(); for (ApplicationFormItemData item : items) { String destAttr = item.getFormItem().getPerunDestinationAttribute(); String newValue = item.getValue(); if (newValue == null || newValue.isEmpty()) continue; if (destAttr != null && !destAttr.isEmpty()) { Attribute a = null; if (destAttr.contains("urn:perun:user:")) { a = attrManager.getAttribute(registrarSession, user, destAttr); } else if (destAttr.contains("urn:perun:member:")) { a = attrManager.getAttribute(registrarSession, member, destAttr); } else { continue; } if (a != null && "login-namespace".equals(a.getBaseFriendlyName())) { continue; } if (a != null) { if (a.getType().equalsIgnoreCase("java.util.LinkedHashMap")) { continue; } else if (a.getType().equalsIgnoreCase("java.util.ArrayList") || a.getType().equalsIgnoreCase("java.util.LargeArrayList")) { ArrayList<String> value = ((ArrayList<String>)a.getValue()); if (value == null) { value = new ArrayList<String>(); value.add(newValue); } else if (!value.contains(newValue)) { value.add(newValue); } a.setValue(value); attributes.add(a); continue; } else { a.setValue(newValue); attributes.add(a); } } } } if (!attributes.isEmpty()) { attrManager.setAttributes(registrarSession, member, attributes, true); } }

Target:
private void storeApplicationAttributes(Application app) throws PerunException { User user = usersManager.getUserById(registrarSession, app.getUser().getId()); Member member = membersManager.getMemberByUser(registrarSession, app.getVo(), user); List<ApplicationFormItemData> items = getApplicationDataById(registrarSession, app.getId()); List<Attribute> attributes = new ArrayList<Attribute>(); for (ApplicationFormItemData item : items) { String destAttr = item.getFormItem().getPerunDestinationAttribute(); String newValue = item.getValue(); if (newValue == null || newValue.isEmpty()) continue; if (destAttr != null && !destAttr.isEmpty()) { Attribute a = null; if (destAttr.contains("urn:perun:user:")) { a = attrManager.getAttribute(registrarSession, user, destAttr); } else if (destAttr.contains("urn:perun:member:")) { a = attrManager.getAttribute(registrarSession, member, destAttr); } else { continue; } if (a != null && "login-namespace".equals(a.getBaseFriendlyName())) { continue; } if (a != null) { if (a.getType().equalsIgnoreCase("java.util.LinkedHashMap")) { continue; } else if (a.getType().equalsIgnoreCase("java.util.ArrayList") || a.getType().equalsIgnoreCase(BeansUtils.largeArrayListClassName)) { ArrayList<String> value = ((ArrayList<String>)a.getValue()); if (value == null) { value = new ArrayList<String>(); value.add(newValue); } else if (!value.contains(newValue)) { value.add(newValue); } a.setValue(value); attributes.add(a); continue; } else { a.setValue(newValue); attributes.add(a); } } } } if (!attributes.isEmpty()) { attrManager.setAttributes(registrarSession, member, attributes, true); } }