Source:
public List<String> resolveVirtualAttributeValueChange(PerunSessionImpl sess, String message) throws InternalErrorException, WrongReferenceAttributeValueException, AttributeNotExistsException, WrongAttributeAssignmentException { List<String> resolvingMessages = new ArrayList<>(); if (message == null) return resolvingMessages; Matcher userSetMatcher = userSetPattern.matcher(message); Matcher userRemoveMatcher = userRemovePattern.matcher(message); Matcher userPublicationsSetMatcher = userPublicationsSetPattern.matcher(message); Matcher userPublicationsRemoveMatcher = userPublicationsRemovePattern.matcher(message); Matcher userAllAttrsRemovedMatcher = userAllAttrsRemovedPattern.matcher(message); Matcher uesAllAttrsRemovedMatcher = uesAllAttrsRemovedPattern.matcher(message); Matcher uesSetAffiliationAttributeMatcher = uesSetAffiliationAttributePattern.matcher(message); Matcher uesRemoveAffiliationAttributeMatcher = uesRemoveAffiliationAttributePattern.matcher(message); User user; Attribute attribute; if (uesSetAffiliationAttributeMatcher.find() || uesRemoveAffiliationAttributeMatcher.find() || uesAllAttrsRemovedMatcher.find() || userSetMatcher.find() || userRemoveMatcher.find() || userAllAttrsRemovedMatcher.find() || userPublicationsSetMatcher.find() || userPublicationsRemoveMatcher.find()) { user = sess.getPerunBl().getModulesUtilsBl().getUserFromMessage(sess, message); if (user != null) { String messageAttributeSet; attribute = sess.getPerunBl().getAttributesManagerBl().getAttribute(sess, user, AttributesManager.NS_USER_ATTR_VIRT + ":" + FRIENDLY_NAME); String value = (String) attribute.getValue(); if (value == null || value.isEmpty()) { AttributeDefinition attributeDefinition = new AttributeDefinition(attribute); messageAttributeSet = attributeDefinition.serializeToString() + " removed for " + user.serializeToString() + "."; } else { messageAttributeSet = attribute.serializeToString() + " set for " + user.serializeToString() + "."; } resolvingMessages.add(messageAttributeSet); } else { log.error("Failed to get user from message: {}", message); } } return resolvingMessages; }

Target:
public List<String> resolveVirtualAttributeValueChange(PerunSessionImpl sess, String message) throws InternalErrorException, WrongReferenceAttributeValueException, AttributeNotExistsException, WrongAttributeAssignmentException { List<String> resolvingMessages = new ArrayList<>(); if (message == null) return resolvingMessages; Matcher userRemsSetMatcher = userRemsSetPattern.matcher(message); Matcher userRemsRemoveMatcher = userRemsRemovePattern.matcher(message); Matcher userPublicationsSetMatcher = userPublicationsSetPattern.matcher(message); Matcher userPublicationsRemoveMatcher = userPublicationsRemovePattern.matcher(message); Matcher userAllAttrsRemovedMatcher = userAllAttrsRemovedPattern.matcher(message); Matcher uesAllAttrsRemovedMatcher = uesAllAttrsRemovedPattern.matcher(message); Matcher uesSetAffiliationAttributeMatcher = uesSetAffiliationAttributePattern.matcher(message); Matcher uesRemoveAffiliationAttributeMatcher = uesRemoveAffiliationAttributePattern.matcher(message); User user; Attribute attribute; if (uesSetAffiliationAttributeMatcher.find() || uesRemoveAffiliationAttributeMatcher.find() || uesAllAttrsRemovedMatcher.find() || userRemsSetMatcher.find() || userRemsRemoveMatcher.find() || userAllAttrsRemovedMatcher.find() || userPublicationsSetMatcher.find() || userPublicationsRemoveMatcher.find()) { user = sess.getPerunBl().getModulesUtilsBl().getUserFromMessage(sess, message); if (user != null) { String messageAttributeSet; attribute = sess.getPerunBl().getAttributesManagerBl().getAttribute(sess, user, AttributesManager.NS_USER_ATTR_VIRT + ":" + FRIENDLY_NAME); String value = (String) attribute.getValue(); if (value == null || value.isEmpty()) { AttributeDefinition attributeDefinition = new AttributeDefinition(attribute); messageAttributeSet = attributeDefinition.serializeToString() + " removed for " + user.serializeToString() + "."; } else { messageAttributeSet = attribute.serializeToString() + " set for " + user.serializeToString() + "."; } resolvingMessages.add(messageAttributeSet); } else { log.error("Failed to get user from message: {}", message); } } return resolvingMessages; }