List of usage examples for com.liferay.portal.kernel.util ArrayUtil getValue
public static Object getValue(Object[] array, int pos)
From source file:com.liferay.opensocial.shindig.util.ShindigUtil.java
License:Open Source License
public static void updateOAuthConsumers(ActionRequest actionRequest, ActionResponse actionResponse) throws Exception { ThemeDisplay themeDisplay = (ThemeDisplay) actionRequest.getAttribute(WebKeys.THEME_DISPLAY); long[] oAuthConsumerIds = ParamUtil.getLongValues(actionRequest, "oAuthConsumerId"); String gadgetKey = ParamUtil.getString(actionRequest, "gadgetKey"); String[] serviceNames = ParamUtil.getParameterValues(actionRequest, "serviceName"); String[] consumerKeys = ParamUtil.getParameterValues(actionRequest, "consumerKey"); String[] consumerSecrets = ParamUtil.getParameterValues(actionRequest, "consumerSecret"); String[] keyTypes = ParamUtil.getParameterValues(actionRequest, "keyType"); if ((serviceNames.length == 0) && (keyTypes.length != 0)) { serviceNames = new String[] { StringPool.BLANK }; }/* w w w . ja v a 2 s .com*/ for (int i = 0; i < serviceNames.length; i++) { String consumerKey = (String) ArrayUtil.getValue(consumerKeys, i); String consumerSecret = (String) ArrayUtil.getValue(consumerSecrets, i); if (Validator.isNull(consumerKey)) { consumerKey = StringPool.BLANK; } if (Validator.isNull(consumerSecret)) { consumerSecret = StringPool.BLANK; } if (oAuthConsumerIds[i] <= 0) { OAuthConsumerLocalServiceUtil.addOAuthConsumer(themeDisplay.getCompanyId(), gadgetKey, serviceNames[i], consumerKey, consumerSecret, keyTypes[i]); } else { OAuthConsumerLocalServiceUtil.updateOAuthConsumer(oAuthConsumerIds[i], consumerKey, consumerSecret, keyTypes[i], StringPool.BLANK, StringPool.BLANK); } } }