Tabnine Logo
JSONArray.contains
Code IndexAdd Tabnine to your IDE (free)

How to use
contains
method
in
org.json.simple.JSONArray

Best Java code snippets using org.json.simple.JSONArray.contains (Showing top 18 results out of 315)

origin: pentaho/pentaho-kettle

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;
}
origin: sakaiproject/sakai

/**
 * Add an enabledCapability if it does not exist
 */
public static void addEnabledCapability(JSONArray enabledCapabilities, String cap) {
  if (!enabledCapabilities.contains(cap)) {
    enabledCapabilities.add(cap);
  }
}
origin: sakaiproject/sakai

/**
 * 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);
}
origin: org.sakaiproject.basiclti/basiclti-common

/**
 * Add an enabledCapability if it does not exist
 */
public static void addEnabledCapability(JSONArray enabledCapabilities, String cap)
{
  if ( ! enabledCapabilities.contains(cap) ) enabledCapabilities.add(cap);
}
origin: sakaiproject/sakai

if ( enabledCapabilities.contains(keyStr) || 
   (capStr != null && enabledCapabilities.contains(capStr) ) || 
   (mapStr != null && enabledCapabilities.contains(mapStr) ) ) {
origin: org.apache.oozie/oozie-client

  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 + "/";
origin: apache/oozie

  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 + "/";
origin: YahooArchive/oozie

  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 + "/";
origin: com.yahoo.oozie/oozie-client

  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 + "/";
origin: org.geotools/gt-mbstyle

if (jsonArray.contains(inputType)) {
origin: apache/oozie

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);
  }
}
origin: sakaiproject/sakai

/**
 * 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;
}
origin: org.apache.oozie/oozie-client

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);
  }
}
origin: sakaiproject/sakai

log.debug("before ltiProps={}", ltiProps);
log.debug("enabledCapabilities={}", enabledCapabilities);
boolean allowExt = enabledCapabilities.contains(SAKAI_EXTENSIONS_ALL);
LTI2Util.filterLTI1LaunchProperties(ltiProps, enabledCapabilities, allowExt);
origin: org.sakaiproject.basiclti/basiclti-common

log.debug("before ltiProps={}", ltiProps);
log.debug("enabledCapabilities={}", enabledCapabilities);
boolean allowExt = enabledCapabilities.contains(SAKAI_EXTENSIONS_ALL);
LTI2Util.filterLTI1LaunchProperties(ltiProps, enabledCapabilities, allowExt);
origin: fujitsu-pio/io

JSONArray resArray = (JSONArray) res.getMismatchValue("p1ListProperty");
assertEquals(2, resArray.size());
assertTrue(resArray.contains("p1ListPropertyValueUpdated1"));
assertTrue(resArray.contains("p1ListPropertyValueUpdated2"));
origin: fujitsu-pio/io

JSONArray resArray = (JSONArray) res.getMismatchValue("p1ComplexProperty.c1ListProperty");
assertEquals(2, resArray.size());
assertTrue(resArray.contains("c1ListPropertyValueUpdated1"));
assertTrue(resArray.contains("c1ListPropertyValueUpdated2"));
origin: fujitsu-pio/io

    .getMismatchValue("p1ComplexProperty.c1ComplexProperty.c2ComplexProperty.c3ListProperty");
assertEquals(2, resArray.size());
assertTrue(resArray.contains("c3ListPropertyValueUpdated1"));
assertTrue(resArray.contains("c3ListPropertyValueUpdated2"));
org.json.simpleJSONArraycontains

Popular methods of JSONArray

  • <init>
    Constructs a JSONArray containing the elements of the specified collection, in the order they are re
  • add
  • size
  • get
  • toJSONString
  • iterator
  • addAll
  • isEmpty
  • toString
  • toArray
  • writeJSONString
  • remove
  • writeJSONString,
  • remove,
  • set,
  • clear,
  • forEach,
  • getJsonObject,
  • listIterator,
  • subList

Popular in Java

  • Running tasks concurrently on multiple threads
  • scheduleAtFixedRate (ScheduledExecutorService)
  • findViewById (Activity)
  • runOnUiThread (Activity)
  • HttpServer (com.sun.net.httpserver)
    This class implements a simple HTTP server. A HttpServer is bound to an IP address and port number a
  • HttpURLConnection (java.net)
    An URLConnection for HTTP (RFC 2616 [http://tools.ietf.org/html/rfc2616]) used to send and receive d
  • SocketException (java.net)
    This SocketException may be thrown during socket creation or setting options, and is the superclass
  • TimeUnit (java.util.concurrent)
    A TimeUnit represents time durations at a given unit of granularity and provides utility methods to
  • JCheckBox (javax.swing)
  • JList (javax.swing)
  • Best plugins for Eclipse
Tabnine Logo
  • Products

    Search for Java codeSearch for JavaScript code
  • IDE Plugins

    IntelliJ IDEAWebStormVisual StudioAndroid StudioEclipseVisual Studio CodePyCharmSublime TextPhpStormVimGoLandRubyMineEmacsJupyter NotebookJupyter LabRiderDataGripAppCode
  • Company

    About UsContact UsCareers
  • Resources

    FAQBlogTabnine AcademyTerms of usePrivacy policyJava Code IndexJavascript Code Index
Get Tabnine for your IDE now