summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorSidharth Singh2013-08-28 07:50:16 (EDT)
committer Stephan Born2013-09-23 05:02:56 (EDT)
commit8f3a6582385ff83bb85e6c61a8319d1cb23432b0 (patch)
tree57478212c9128552050298f6cf0983341b1a0aa0
parent9fc847afbc0f26e5cfaf5f7f0ee0682fa7a2b1e8 (diff)
downloadorg.eclipse.stardust.ui.web-8f3a6582385ff83bb85e6c61a8319d1cb23432b0.zip
org.eclipse.stardust.ui.web-8f3a6582385ff83bb85e6c61a8319d1cb23432b0.tar.gz
org.eclipse.stardust.ui.web-8f3a6582385ff83bb85e6c61a8319d1cb23432b0.tar.bz2
Jira-ID: RNT-29739
Added common-menu-config-context.xml with bean entry 'commonMenuConfig' with Sungard menu Guid and baseURL params. Overloaded RestControllerUtils.resolveSpringBean(id,servletContext) to get bean by Id. Added code to HTML5FrameworkServices to parse string initialized by 'commonMenuConfig' bean. git-svn-id: https://svn.csa.sungard.com/repos/ipp2/product/trunk/stardust/ui.web@66987 8100b5e0-4d52-466c-ae9c-bdeccbdeaf6b Signed-off-by: Sidharth Singh <sidharth.singh@sungard.com>
-rw-r--r--portal-common/src/main/java/org/eclipse/stardust/ui/web/html5/rest/HTML5FrameworkServices.java44
-rw-r--r--portal-common/src/main/java/org/eclipse/stardust/ui/web/html5/rest/RestControllerUtils.java6
-rw-r--r--portal-common/src/main/resources/bpm-ui/templates/config.json2
3 files changed, 50 insertions, 2 deletions
diff --git a/portal-common/src/main/java/org/eclipse/stardust/ui/web/html5/rest/HTML5FrameworkServices.java b/portal-common/src/main/java/org/eclipse/stardust/ui/web/html5/rest/HTML5FrameworkServices.java
index 76c7512..bd63536 100644
--- a/portal-common/src/main/java/org/eclipse/stardust/ui/web/html5/rest/HTML5FrameworkServices.java
+++ b/portal-common/src/main/java/org/eclipse/stardust/ui/web/html5/rest/HTML5FrameworkServices.java
@@ -41,6 +41,8 @@ import org.eclipse.stardust.ui.web.common.util.MessagePropertiesBean;
public class HTML5FrameworkServices
{
private static final Logger trace = LogManager.getLogger(HTML5FrameworkServices.class);
+ private final String COMMON_MENU_KEY_SEPERATOR = "=";
+ private final String NEWLINE_TAB = "\n\t";
@Context
private ServletContext servletContext;
@@ -63,7 +65,12 @@ public class HTML5FrameworkServices
messageBean.getString("portalFramework.config.PORTAL_TITLE"));
contents = StringUtils.replace(contents, "SIDEBAR_LABEL",
messageBean.getString("portalFramework.config.SIDEBAR_LABEL"));
-
+ String commonMenuConfigStr = (String) RestControllerUtils.resolveSpringBean("commonMenuConfig", servletContext);
+ if (StringUtils.isNotEmpty(commonMenuConfigStr))
+ {
+ contents = StringUtils.replace(contents, "COMMON_MENU", parseCommonMenuString(commonMenuConfigStr));
+ }
+
return Response.ok(contents, MediaType.APPLICATION_JSON_TYPE).build();
}
@@ -207,4 +214,39 @@ public class HTML5FrameworkServices
Random random = new Random();
return String.valueOf(random.nextInt(10000));
}
+
+ /**
+ *
+ * @param commonMenuString
+ * @return
+ */
+ private String parseCommonMenuString(String commonMenuString)
+ {
+ String arr[] = commonMenuString.split(",");
+ StringBuffer commonMenuJsonStr = new StringBuffer();
+ commonMenuJsonStr.append("," +NEWLINE_TAB);
+ commonMenuJsonStr.append(splitAndParseStr(arr[0], COMMON_MENU_KEY_SEPERATOR));
+ commonMenuJsonStr.append("," + NEWLINE_TAB);
+ commonMenuJsonStr.append(splitAndParseStr(arr[1], COMMON_MENU_KEY_SEPERATOR));
+ return commonMenuJsonStr.toString();
+ }
+
+ /**
+ *
+ * @param strVal
+ * @param seperator
+ * @return
+ */
+ private String splitAndParseStr(String strVal, String seperator)
+ {
+ StringBuffer buffer = new StringBuffer();
+ if (StringUtils.isNotEmpty(strVal))
+ {
+ String params[] = strVal.split(seperator);
+ buffer.append("\"" + params[0] + "\"");
+ buffer.append(":");
+ buffer.append("\"" + params[1] + "\"");
+ }
+ return buffer.toString();
+ }
}
diff --git a/portal-common/src/main/java/org/eclipse/stardust/ui/web/html5/rest/RestControllerUtils.java b/portal-common/src/main/java/org/eclipse/stardust/ui/web/html5/rest/RestControllerUtils.java
index 9710c63..c43626a 100644
--- a/portal-common/src/main/java/org/eclipse/stardust/ui/web/html5/rest/RestControllerUtils.java
+++ b/portal-common/src/main/java/org/eclipse/stardust/ui/web/html5/rest/RestControllerUtils.java
@@ -12,4 +12,10 @@ public class RestControllerUtils
ApplicationContext context = WebApplicationContextUtils.getWebApplicationContext(servletContext);
return context.getBean(type);
}
+
+ public static Object resolveSpringBean(String beanId, ServletContext servletContext)
+ {
+ ApplicationContext context = WebApplicationContextUtils.getWebApplicationContext(servletContext);
+ return context.getBean(beanId);
+ }
}
diff --git a/portal-common/src/main/resources/bpm-ui/templates/config.json b/portal-common/src/main/resources/bpm-ui/templates/config.json
index 1611fae..eabc6ec 100644
--- a/portal-common/src/main/resources/bpm-ui/templates/config.json
+++ b/portal-common/src/main/resources/bpm-ui/templates/config.json
@@ -18,5 +18,5 @@
"navigation": "/CONTEXT_ROOT/services/rest/common/html5/api/navigation?random=RANDOM_VALUE",
"i18n": "/CONTEXT_ROOT/services/rest/common/html5/api/messages",
"theme": "/CONTEXT_ROOT/services/rest/common/html5/api/themes"
- }
+ }COMMON_MENU
} \ No newline at end of file