From 95c2921ff0dff9bb819cbee8161c28aeadeed94e Mon Sep 17 00:00:00 2001 From: Maek Twain Date: Tue, 17 Nov 2015 15:33:07 +0530 Subject: [PATCH] Reverted Back to basicauth --- .../service/TemplateMergeService.java | 20 +++++-------------- 1 file changed, 5 insertions(+), 15 deletions(-) diff --git a/mifosng-provider/src/main/java/org/mifosplatform/template/service/TemplateMergeService.java b/mifosng-provider/src/main/java/org/mifosplatform/template/service/TemplateMergeService.java index 88b5b7eda..2948b34a5 100644 --- a/mifosng-provider/src/main/java/org/mifosplatform/template/service/TemplateMergeService.java +++ b/mifosng-provider/src/main/java/org/mifosplatform/template/service/TemplateMergeService.java @@ -59,8 +59,7 @@ public class TemplateMergeService { public String compile(final Template template, final Map scopes) throws MalformedURLException, IOException { this.scopes = scopes; this.scopes.put("static", new TemplateFunctions()); - final String auth = ThreadLocalContextUtil.getAuthToken(); - setAuthToken(auth); + final MustacheFactory mf = new DefaultMustacheFactory(); final Mustache mustache = mf.compile(new StringReader(template.getText()), template.getName()); @@ -129,7 +128,7 @@ public class TemplateMergeService { try { connection = (HttpURLConnection) new URL(url).openConnection(); if (this.authToken != null) { - connection.setRequestProperty("Authorization", "Bearer " + this.authToken); + connection.setRequestProperty("Authorization", "Basic " + this.authToken); } TrustModifier.relaxHostChecking(connection); @@ -173,36 +172,27 @@ public class TemplateMergeService { @SuppressWarnings("unchecked") private void expandMapArrays(Object value) { if (value instanceof Map) { - System.out.println(value); Map valueAsMap = (Map) value; //Map newValue = null; - Map myNewMap = new HashMap<>(); + Map valueAsMap_second = new HashMap<>(); for (Entry valueAsMapEntry : valueAsMap.entrySet()) { - System.out.println(valueAsMapEntry); Object valueAsMapEntryValue = valueAsMapEntry.getValue(); - System.out.println(valueAsMapEntryValue); if (valueAsMapEntryValue instanceof Map) { // JSON Object expandMapArrays(valueAsMapEntryValue); - System.out.println(valueAsMapEntryValue); } else if (valueAsMapEntryValue instanceof Iterable) { // JSON Array Iterable valueAsMapEntryValueIterable = (Iterable) valueAsMapEntryValue; - System.out.println(valueAsMapEntryValue); String valueAsMapEntryKey = valueAsMapEntry.getKey(); int i = 0; for (Object object : valueAsMapEntryValueIterable) { - System.out.println(valueAsMapEntryValueIterable); - myNewMap.put(valueAsMapEntryKey + "#" + i, object); - //valueAsMap.putAll(myNewMap); - + valueAsMap_second.put(valueAsMapEntryKey + "#" + i, object); ++i; expandMapArrays(object); - System.out.println(object); } } } - valueAsMap.putAll(myNewMap); + valueAsMap.putAll(valueAsMap_second); } }