Codota Logo
JSONArray.getString
Code IndexAdd Codota to your IDE (free)

How to use
getString
method
in
org.opencms.json.JSONArray

Best Java code snippets using org.opencms.json.JSONArray.getString (Showing top 11 results out of 315)

  • Add the Codota plugin to your IDE and get smart completions
private void myMethod () {
ScheduledThreadPoolExecutor s =
  • Codota Iconnew ScheduledThreadPoolExecutor(corePoolSize)
  • Codota IconThreadFactory threadFactory;new ScheduledThreadPoolExecutor(corePoolSize, threadFactory)
  • Codota IconString str;new ScheduledThreadPoolExecutor(1, new ThreadFactoryBuilder().setNameFormat(str).build())
  • Smart code suggestions by Codota
}
origin: org.opencms/opencms-core

/**
 * Decodes a parameter which has been encoded from a string list using encodeStringsAsBase64Parameter.<p>
 *
 * @param data the data to decode
 * @return the list of strings
 */
public static List<String> decodeStringsFromBase64Parameter(String data) {
  data = StringUtils.replaceChars(data, BASE64_EXTRA_REPLACEMENTS, BASE64_EXTRA);
  byte[] bytes = deobfuscateBytes(Base64.decodeBase64(data));
  try {
    JSONArray json = new JSONArray(new String(bytes, "UTF-8"));
    List<String> result = Lists.newArrayList();
    for (int i = 0; i < json.length(); i++) {
      result.add(json.getString(i));
    }
    return result;
  } catch (UnsupportedEncodingException e) {
    // TODO Auto-generated catch block
    e.printStackTrace();
  } catch (JSONException e) {
    throw new IllegalArgumentException("Decoding failed: " + data, e);
  }
  return null;
}
origin: org.opencms/opencms-core

/** Helper for reading a mandatory String value list - throwing an Exception if parsing fails.
 * @param json The JSON object where the list should be read from.
 * @param key The key of the value to read.
 * @return The value from the JSON.
 * @throws JSONException thrown when parsing fails.
 */
protected List<String> parseMandatoryStringValues(final JSONObject json, final String key) throws JSONException {
  List<String> list = null;
  JSONArray array = json.getJSONArray(key);
  list = new ArrayList<String>(array.length());
  for (int i = 0; i < array.length(); i++) {
    try {
      String entry = array.getString(i);
      list.add(entry);
    } catch (JSONException e) {
      LOG.info(Messages.get().getBundle().key(Messages.LOG_OPTIONAL_STRING_ENTRY_UNPARSABLE_1, key), e);
    }
  }
  return list;
}
origin: org.opencms/opencms-core

/**
 * @see org.opencms.ui.apps.I_CmsAppSettings#restoreSettings(java.lang.String)
 */
public void restoreSettings(String storedSettings) {
  Map<String, CmsResourceTableProperty> columnMap = CmsResourceTableProperty.getDefaultColumnsByName();
  try {
    JSONObject json = new JSONObject(storedSettings);
    if (json.has(SORT_ORDER_KEY)) {
      m_sortAscending = json.getBoolean(SORT_ORDER_KEY);
    }
    if (json.has(SORT_COLUMN_KEY)) {
      m_sortColumnId = columnMap.get(json.getString(SORT_COLUMN_KEY));
    }
    if (json.has(COLLAPSED_COLUMNS_KEY)) {
      List<CmsResourceTableProperty> collapsed = new ArrayList<CmsResourceTableProperty>();
      JSONArray array = json.getJSONArray(COLLAPSED_COLUMNS_KEY);
      for (int i = 0; i < array.length(); i++) {
        collapsed.add(columnMap.get(array.getString(i)));
      }
      m_collapsedColumns = collapsed;
    }
  } catch (JSONException e) {
    LOG.error("Failed to restore file explorer settings from '" + storedSettings + "'", e);
  }
}
origin: org.opencms/opencms-solr

/**
 * Produce a JSONArray containing the values of the members of this
 * JSONObject.<p>
 * 
 * @param names a JSONArray containing a list of key strings. This
 * determines the sequence of the values in the result
 * @return a JSONArray of values
 * @throws JSONException if any of the values are non-finite numbers.
 */
public JSONArray toJSONArray(JSONArray names) throws JSONException {
  if (names == null || names.length() == 0) {
    return null;
  }
  JSONArray ja = new JSONArray();
  for (int i = 0; i < names.length(); i += 1) {
    ja.put(this.opt(names.getString(i)));
  }
  return ja;
}
origin: org.opencms/opencms-core

/**
 * Reads the folder filters for the current site.<p>
 *
 * @return the folder filters
 */
private Set<String> readFolderFilters() {
  JSONObject storedFilters = readUserFolderFilters();
  Set<String> result = null;
  if (storedFilters.has(getCmsObject().getRequestContext().getSiteRoot())) {
    try {
      org.opencms.json.JSONArray folders = storedFilters.getJSONArray(
        getCmsObject().getRequestContext().getSiteRoot());
      result = new HashSet<String>();
      for (int i = 0; i < folders.length(); i++) {
        result.add(folders.getString(i));
      }
    } catch (JSONException e) {
      LOG.error(e.getLocalizedMessage(), e);
    }
  }
  return result;
}
origin: org.opencms/opencms-core

for (int i = 0; i < array.length(); i++) {
  try {
    CmsUUID modId = new CmsUUID(array.getString(i));
    CmsResource res = cms.readResource(modId, CmsResourceFilter.ONLY_VISIBLE_NO_DELETED);
    String sitePath = cms.getSitePath(res);
origin: org.opencms/opencms-core

/**
 * Produce a JSONArray containing the values of the members of this
 * JSONObject.<p>
 *
 * @param names a JSONArray containing a list of key strings. This
 * determines the sequence of the values in the result
 * @return a JSONArray of values
 * @throws JSONException if any of the values are non-finite numbers.
 */
public JSONArray toJSONArray(JSONArray names) throws JSONException {
  if ((names == null) || (names.length() == 0)) {
    return null;
  }
  JSONArray ja = new JSONArray();
  for (int i = 0; i < names.length(); i += 1) {
    ja.put(opt(names.getString(i)));
  }
  return ja;
}
origin: org.opencms/opencms-core

/**
 * Returns the quick launch apps set for the current user.<p>
 *
 * @param cms the cms context
 *
 * @return the quick launch app configurations
 */
protected List<I_CmsWorkplaceAppConfiguration> getUserQuickLauchConfigurations(CmsObject cms) {
  String apps_info = (String)cms.getRequestContext().getCurrentUser().getAdditionalInfo(QUICK_LAUCH_APPS_KEY);
  String[] appIds = null;
  if (CmsStringUtil.isNotEmptyOrWhitespaceOnly(apps_info)) {
    try {
      JSONArray ids = new JSONArray(apps_info);
      appIds = new String[ids.length()];
      for (int i = 0; i < appIds.length; i++) {
        appIds[i] = ids.getString(i);
      }
    } catch (JSONException e) {
      LOG.error("Error parsing user quick launch apps setting.", e);
      appIds = null;
    }
  }
  return getAppConfigurations(appIds != null ? appIds : DEFAULT_USER_APPS);
}
origin: org.opencms/opencms-core

/**
 * Produce a JSONObject by combining a JSONArray of names with the values
 * of this JSONArray.<p>
 *
 * @param names a JSONArray containing a list of key strings. These will be
 * paired with the values
 * @return a JSONObject, or null if there are no names or if this JSONArray
 * has no values
 * @throws JSONException if any of the names are null
 */
public JSONObject toJSONObject(JSONArray names) throws JSONException {
  if ((names == null) || (names.length() == 0) || (length() == 0)) {
    return null;
  }
  JSONObject jo = new JSONObject();
  for (int i = 0; i < names.length(); i += 1) {
    jo.put(names.getString(i), opt(i));
  }
  return jo;
}
origin: org.opencms/opencms-solr

/**
 * Produce a JSONObject by combining a JSONArray of names with the values
 * of this JSONArray.<p>
 * 
 * @param names a JSONArray containing a list of key strings. These will be
 * paired with the values
 * @return a JSONObject, or null if there are no names or if this JSONArray
 * has no values
 * @throws JSONException if any of the names are null
 */
public JSONObject toJSONObject(JSONArray names) throws JSONException {
  if (names == null || names.length() == 0 || length() == 0) {
    return null;
  }
  JSONObject jo = new JSONObject();
  for (int i = 0; i < names.length(); i += 1) {
    jo.put(names.getString(i), this.opt(i));
  }
  return jo;
}
origin: org.opencms/opencms-core

for (int i = 0; i < array.length(); i++) {
  try {
    CmsUUID delId = new CmsUUID(array.getString(i));
    CmsResource res = cms.readResource(delId, CmsResourceFilter.ALL);
    if (res.getState().isDeleted()) {
org.opencms.jsonJSONArraygetString

Javadoc

Get the string associated with an index.

Popular methods of JSONArray

  • <init>
    Construct a JSONArray from a JSONTokener.
  • toString
    Make a pretty printed JSON text of this JSONArray. Warning: This method assumes that the data struct
  • get
    Get the object value associated with an index.
  • getBoolean
    Get the boolean value associated with an index. The string values "true" and "false" are converted t
  • getDouble
    Get the double value associated with an index.
  • getInt
    Get the int value associated with an index.
  • getLong
    Get the long value associated with an index.
  • join
    Make a string from the contents of this JSONArray. The separator string is inserted between each ele
  • length
    Get the number of elements in the JSONArray, included nulls.
  • opt
    Get the optional object value associated with an index.
  • optBoolean
    Get the optional boolean value associated with an index. It returns the defaultValue if there is no
  • optDouble
    Get the optional double value associated with an index. The defaultValue is returned if there is no
  • optBoolean,
  • optDouble,
  • optInt,
  • optJSONObject,
  • optLong,
  • optString,
  • put,
  • toJSONObject,
  • write

Popular in Java

  • Parsing JSON documents to java classes using gson
  • getApplicationContext (Context)
  • onCreateOptionsMenu (Activity)
  • notifyDataSetChanged (ArrayAdapter)
  • GridLayout (java.awt)
    The GridLayout class is a layout manager that lays out a container's components in a rectangular gri
  • Thread (java.lang)
    A thread is a thread of execution in a program. The Java Virtual Machine allows an application to ha
  • SocketException (java.net)
    This SocketException may be thrown during socket creation or setting options, and is the superclass
  • ReentrantLock (java.util.concurrent.locks)
    A reentrant mutual exclusion Lock with the same basic behavior and semantics as the implicit monitor
  • HttpServletRequest (javax.servlet.http)
    Extends the javax.servlet.ServletRequest interface to provide request information for HTTP servlets.
  • Option (scala)
Codota Logo
  • Products

    Search for Java codeSearch for JavaScript codeEnterprise
  • IDE Plugins

    IntelliJ IDEAWebStormAndroid StudioEclipseVisual Studio CodePyCharmSublime TextPhpStormVimAtomGoLandRubyMineEmacsJupyter
  • Company

    About UsContact UsCareers
  • Resources

    FAQBlogCodota Academy Plugin user guide Terms of usePrivacy policyJava Code IndexJavascript Code Index
Get Codota for your IDE now