public JSONArray storeRecentSearch( String recentSearch ) { JSONArray recentSearches = getRecentSearches(); try { if ( recentSearch == null || recentSearches.contains( recentSearch ) ) { return recentSearches; } recentSearches.add( recentSearch ); if ( recentSearches.size() > 5 ) { recentSearches.remove( 0 ); } PropsUI props = PropsUI.getInstance(); String jsonValue = props.getRecentSearches(); JSONParser jsonParser = new JSONParser(); JSONObject jsonObject = jsonValue != null ? (JSONObject) jsonParser.parse( jsonValue ) : new JSONObject(); jsonObject.put( getLogin(), recentSearches ); props.setRecentSearches( jsonObject.toJSONString() ); } catch ( Exception e ) { e.printStackTrace(); } return recentSearches; }
/** * Add an enabledCapability if it does not exist */ public static void addEnabledCapability(JSONArray enabledCapabilities, String cap) { if (!enabledCapabilities.contains(cap)) { enabledCapabilities.add(cap); } }
/** * Check if a particular capability is enabled * * @param String resourceHandler - JSONObject for the resource_handler * @param String messageType - Which message type you are looking for * @param String capability - The capability to look for */ public boolean enabledCapability(JSONObject resourceHandler, String messageType, String capability) { JSONArray enabled_capability = enabledCapabilities(resourceHandler, messageType); if ( enabled_capability == null ) return false; return enabled_capability.contains(capability); }
/** * Add an enabledCapability if it does not exist */ public static void addEnabledCapability(JSONArray enabledCapabilities, String cap) { if ( ! enabledCapabilities.contains(cap) ) enabledCapabilities.add(cap); }
throw new OozieClientException("HTTP error", "no response message"); if (!supportedVersions.contains(WS_PROTOCOL_VERSION) && !supportedVersions.contains(WS_PROTOCOL_VERSION_1) && !supportedVersions.contains(WS_PROTOCOL_VERSION_0)) { StringBuilder msg = new StringBuilder(); msg.append("Supported version [").append(WS_PROTOCOL_VERSION) throw new OozieClientException(OozieClientException.UNSUPPORTED_VERSION, msg.toString()); if (supportedVersions.contains(WS_PROTOCOL_VERSION)) { protocolUrl = baseUrl + "v" + WS_PROTOCOL_VERSION + "/"; else if (supportedVersions.contains(WS_PROTOCOL_VERSION_1)) { protocolUrl = baseUrl + "v" + WS_PROTOCOL_VERSION_1 + "/"; if (supportedVersions.contains(WS_PROTOCOL_VERSION_0)) { protocolUrl = baseUrl + "v" + WS_PROTOCOL_VERSION_0 + "/";
throw new OozieClientException("HTTP error", "no response message"); if (!supportedVersions.contains(WS_PROTOCOL_VERSION) && !supportedVersions.contains(WS_PROTOCOL_VERSION_1) && !supportedVersions.contains(WS_PROTOCOL_VERSION_0)) { StringBuilder msg = new StringBuilder(); msg.append("Supported version [").append(WS_PROTOCOL_VERSION) throw new OozieClientException(OozieClientException.UNSUPPORTED_VERSION, msg.toString()); if (supportedVersions.contains(WS_PROTOCOL_VERSION)) { protocolUrl = baseUrl + "v" + WS_PROTOCOL_VERSION + "/"; else if (supportedVersions.contains(WS_PROTOCOL_VERSION_1)) { protocolUrl = baseUrl + "v" + WS_PROTOCOL_VERSION_1 + "/"; if (supportedVersions.contains(WS_PROTOCOL_VERSION_0)) { protocolUrl = baseUrl + "v" + WS_PROTOCOL_VERSION_0 + "/";
throw new OozieClientException("HTTP error", "no response message"); if (!array.contains(WS_PROTOCOL_VERSION) && !array.contains(WS_PROTOCOL_VERSION_0)) { StringBuilder msg = new StringBuilder(); msg.append("Supported version [").append(WS_PROTOCOL_VERSION).append( throw new OozieClientException(OozieClientException.UNSUPPORTED_VERSION, msg.toString()); if (array.contains(WS_PROTOCOL_VERSION)) { protocolUrl = baseUrl + "v" + WS_PROTOCOL_VERSION + "/"; if (array.contains(WS_PROTOCOL_VERSION_0)) { protocolUrl = baseUrl + "v" + WS_PROTOCOL_VERSION_0 + "/";
throw new OozieClientException("HTTP error", "no response message"); if (!array.contains(WS_PROTOCOL_VERSION) && !array.contains(WS_PROTOCOL_VERSION_0)) { StringBuilder msg = new StringBuilder(); msg.append("Supported version [").append(WS_PROTOCOL_VERSION).append( throw new OozieClientException(OozieClientException.UNSUPPORTED_VERSION, msg.toString()); if (array.contains(WS_PROTOCOL_VERSION)) { protocolUrl = baseUrl + "v" + WS_PROTOCOL_VERSION + "/"; if (array.contains(WS_PROTOCOL_VERSION_0)) { protocolUrl = baseUrl + "v" + WS_PROTOCOL_VERSION_0 + "/";
if (jsonArray.contains(inputType)) {
private String getBaseURLForVersion(long protocolVersion) throws OozieClientException { try { if (supportedVersions == null) { supportedVersions = getSupportedProtocolVersions(); } if (supportedVersions == null) { throw new OozieClientException("HTTP error", "no response message"); } if (supportedVersions.contains(protocolVersion)) { return baseUrl + "v" + protocolVersion + "/"; } else { throw new OozieClientException(OozieClientException.UNSUPPORTED_VERSION, "Protocol version " + protocolVersion + " is not supported"); } } catch (IOException e) { throw new OozieClientException(OozieClientException.IO_ERROR, e); } }
/** * Extract an icon path by icon_style from an icon_info string * * @param String resourceHandler - JSONObject for the resource_handler * @param String icon_style - The style to look for */ public String getIconPath(JSONObject resourceHandler, String icon_style) { JSONArray icon_info = getArray(resourceHandler, LTI2Constants.ICON_INFO); if ( icon_info == null ) return null; for (Object m : icon_info) { if ( ! ( m instanceof JSONObject) ) continue; JSONObject jm = (JSONObject) m; JSONArray icon_styles = getArray(jm, LTI2Constants.ICON_STYLE); if ( icon_styles == null ) continue; if ( ! icon_styles.contains(icon_style) ) continue; JSONObject default_location = getObject(jm, LTI2Constants.DEFAULT_LOCATION); if ( default_location == null ) continue; String default_location_path = getString(default_location,LTI2Constants.PATH); if ( default_location_path == null ) continue; return default_location_path; } return null; }
private String getBaseURLForVersion(long protocolVersion) throws OozieClientException { try { if (supportedVersions == null) { supportedVersions = getSupportedProtocolVersions(); } if (supportedVersions == null) { throw new OozieClientException("HTTP error", "no response message"); } if (supportedVersions.contains(protocolVersion)) { return baseUrl + "v" + protocolVersion + "/"; } else { throw new OozieClientException(OozieClientException.UNSUPPORTED_VERSION, "Protocol version " + protocolVersion + " is not supported"); } } catch (IOException e) { throw new OozieClientException(OozieClientException.IO_ERROR, e); } }
log.debug("before ltiProps={}", ltiProps); log.debug("enabledCapabilities={}", enabledCapabilities); boolean allowExt = enabledCapabilities.contains(SAKAI_EXTENSIONS_ALL); LTI2Util.filterLTI1LaunchProperties(ltiProps, enabledCapabilities, allowExt);
log.debug("before ltiProps={}", ltiProps); log.debug("enabledCapabilities={}", enabledCapabilities); boolean allowExt = enabledCapabilities.contains(SAKAI_EXTENSIONS_ALL); LTI2Util.filterLTI1LaunchProperties(ltiProps, enabledCapabilities, allowExt);