From a6a2298a5ca15e84e2dbfb141eba52637c4ea5cd Mon Sep 17 00:00:00 2001
From: Peter Hormanns <peter.hormanns@jalin.de>
Date: Thu, 05 Jul 2018 15:12:22 +0200
Subject: [PATCH] fix email-target mapping from hsscript

---
 hsarback/src/de/hsadmin/remote/EMailAddressRemote.java |   16 ++++++++++++++--
 1 files changed, 14 insertions(+), 2 deletions(-)

diff --git a/hsarback/src/de/hsadmin/remote/EMailAddressRemote.java b/hsarback/src/de/hsadmin/remote/EMailAddressRemote.java
index d02d5ae..daaa729 100644
--- a/hsarback/src/de/hsadmin/remote/EMailAddressRemote.java
+++ b/hsarback/src/de/hsadmin/remote/EMailAddressRemote.java
@@ -55,8 +55,8 @@
 		}
 		Object l = map.get("target");
 		if (l != null && l instanceof Object[]) {
-			StringBuffer tBuff = new StringBuffer();
-			Object[] targetObjArray = (Object[]) l;
+			final StringBuffer tBuff = new StringBuffer();
+			final Object[] targetObjArray = (Object[]) l;
 			for (int idx=0; idx<targetObjArray.length; idx++) {
 				if (targetObjArray[idx] instanceof String) {
 					if (tBuff.length() > 0) {
@@ -66,6 +66,18 @@
 				}
 			}
 			adr.setTarget(tBuff.toString());
+		} else if ((l != null && l instanceof Map<?, ?>)) {
+			final StringBuffer tBuff = new StringBuffer();
+			final Map<? ,?> targetObjMap = (Map<?, ?>) l;
+			for (Object targetObj : targetObjMap.values()) {
+				if (targetObj instanceof String) {
+					if (tBuff.length() > 0) {
+						tBuff.append(',');
+					}
+					tBuff.append((String) targetObj);
+				}
+			}
+			adr.setTarget(tBuff.toString());
 		} else {
 			if (l != null && l instanceof String) {
 				adr.setTarget((String) l);

--
Gitblit v1.9.0-SNAPSHOT