if (!json.isEmpty()) { String uuid = (String) ((JSONObject) json.get(0)).get("id"); return UuidUtils.fromFlatString(uuid);
@SuppressWarnings( "unchecked" ) private void outPutRow( Object[] rowData ) throws KettleStepException { // We can now output an object data.jg = new JSONObject(); data.jg.put( data.realBlocName, data.ja ); String value = data.jg.toJSONString(); if ( data.outputValue && data.outputRowMeta != null ) { Object[] outputRowData = RowDataUtil.addValueData( rowData, data.inputRowMetaSize, value ); incrementLinesOutput(); putRow( data.outputRowMeta, outputRowData ); } if ( data.writeToFile && !data.ja.isEmpty() ) { // Open a file if ( !openNewFile() ) { throw new KettleStepException( BaseMessages.getString( PKG, "JsonOutput.Error.OpenNewFile", buildFilename() ) ); } // Write data to file try { data.writer.write( value ); } catch ( Exception e ) { throw new KettleStepException( BaseMessages.getString( PKG, "JsonOutput.Error.Writing" ), e ); } // Close file closeFile(); } // Data are safe data.rowsAreSafe = true; data.ja = new JSONArray(); }
public static void deserializeHeaderExtensions( JSONArray headerExtensions, ColibriConferenceIQ.Channel channelIQ) { if ((headerExtensions != null) && !headerExtensions.isEmpty()) { for (Object headerExtension : headerExtensions) { deserializeHeaderExtension((JSONObject) headerExtension, channelIQ); } } }
public static void deserializePayloadTypes( JSONArray payloadTypes, ColibriConferenceIQ.Channel channelIQ) { if ((payloadTypes != null) && !payloadTypes.isEmpty()) { for (Object payloadType : payloadTypes) { deserializePayloadType((JSONObject) payloadType, channelIQ); } } }
public static void deserializeContents( JSONArray contents, ColibriConferenceIQ conferenceIQ) { if ((contents != null) && !contents.isEmpty()) { for (Object content : contents) { deserializeContent((JSONObject) content, conferenceIQ); } } }
public static void deserializeFingerprints( JSONArray fingerprints, IceUdpTransportPacketExtension transportIQ) { if ((fingerprints != null) && !fingerprints.isEmpty()) { for (Object fingerprint : fingerprints) { deserializeFingerprint((JSONObject) fingerprint, transportIQ); } } }
public static void deserializeSourceGroups( JSONArray sourceGroups, ColibriConferenceIQ.Channel channelIQ) { if ((sourceGroups != null) && !sourceGroups.isEmpty()) { for (Object sourceGroup : sourceGroups) { deserializeSourceGroup(sourceGroup, channelIQ); } } }
public static void deserializeChannels( JSONArray channels, ColibriConferenceIQ.Content contentIQ) { if ((channels != null) && !channels.isEmpty()) { for (Object channel : channels) { deserializeChannel((JSONObject) channel, contentIQ); } } }
public static void deserializeSources( JSONArray sources, ColibriConferenceIQ.Channel channelIQ) { if ((sources != null) && !sources.isEmpty()) { for (Object source : sources) { deserializeSource(source, channelIQ); } } }
public static void deserializeEndpoints( JSONArray endpoints, ColibriConferenceIQ conferenceIQ) { if ((endpoints != null) && !endpoints.isEmpty()) { for (Object endpoint : endpoints) { deserializeEndpoint( (JSONObject) endpoint, conferenceIQ); } } }
public static void deserializeChannelBundles( JSONArray channelBundles, ColibriConferenceIQ conferenceIQ) { if ((channelBundles != null) && !channelBundles.isEmpty()) { for (Object channelBundle : channelBundles) { deserializeChannelBundle( (JSONObject) channelBundle, conferenceIQ); } } }
public static void deserializeSctpConnections( JSONArray sctpConnections, ColibriConferenceIQ.Content contentIQ) { if ((sctpConnections != null) && !sctpConnections.isEmpty()) { for (Object sctpConnection : sctpConnections) { deserializeSctpConnection( (JSONObject) sctpConnection, contentIQ); } } }
public static void deserializeCandidates( JSONArray candidates, IceUdpTransportPacketExtension transportIQ) { if ((candidates != null) && !candidates.isEmpty()) { for (Object candidate : candidates) { deserializeCandidate( (JSONObject) candidate, CandidatePacketExtension.class, transportIQ); } } }
private boolean replaceKeyArray(JSONObject payload, String toKey, String[] fromKeys) { for (String fromKey : fromKeys) { if (payload.containsKey(fromKey)) { JSONArray value = (JSONArray) payload.remove(fromKey); if (value != null && !value.isEmpty()) { payload.put(toKey, value.get(0)); _LOG.trace("[Metron] Added {} to {}", toKey, payload); return true; } } } return false; }
public static void deserializeSSRCs( JSONArray ssrcs, ColibriConferenceIQ.Channel channelIQ) { if ((ssrcs != null) && !ssrcs.isEmpty()) { for (Object ssrc : ssrcs) { int ssrcIQ; try { ssrcIQ = deserializeSSRC(ssrc); } catch (NumberFormatException nfe) { continue; } channelIQ.addSSRC(ssrcIQ); } } }
if (list == null || list.isEmpty()) { log("No answer"); return null;
private List<String> getChoices(JSONArray choiceObjs) { List<String> choices = new LinkedList<String>(); if (choiceObjs == null || choiceObjs.isEmpty()) { return choices; } for (Object choiceObj : choiceObjs) { choices.add((String) choiceObj); } return choices; }
private void addQueueMessages(JSONObject json, List<String> queueMessages, String queueName, String queueValue, String headerMessage, String emptyMessage) { JSONArray queueDumpArray = (JSONArray) json.get(queueName); queueMessages.add(headerMessage); for (Object o : queueDumpArray) { JSONObject entry = (JSONObject) o; if (entry.get(queueValue) != null) { String value = (String) entry.get(queueValue); queueMessages.add(value); } } if (queueDumpArray.isEmpty()) { queueMessages.add(emptyMessage); } }
/** * Translate "$type": the feature type we need This key may be used with the "==", "!=", "in", * and "!in" operators. Possible values are "Point", "LineString", and "Polygon". * * @return */ public Set<SemanticType> semanticTypeIdentifiers() { if (json == null || json.isEmpty()) { return semanticTypeIdentifiersDefaults(); } Set<SemanticType> semanticTypes = semanticTypeIdentifiers(json); return semanticTypes.isEmpty() ? semanticTypeIdentifiersDefaults() : semanticTypes; }
public Void call() throws Exception { URL url = createURL(RestConstants.ADMIN_TIME_ZONES_RESOURCE, Collections.EMPTY_MAP); HttpURLConnection conn = (HttpURLConnection) url.openConnection(); conn.setRequestMethod("GET"); assertEquals(HttpServletResponse.SC_OK, conn.getResponseCode()); assertTrue(conn.getHeaderField("content-type").startsWith(RestConstants.JSON_CONTENT_TYPE)); JSONObject json = (JSONObject) JSONValue.parse(new InputStreamReader(conn.getInputStream())); assertTrue(json.containsKey(JsonTags.AVAILABLE_TIME_ZONES)); JSONArray array = (JSONArray) json.get(JsonTags.AVAILABLE_TIME_ZONES); assertFalse(array.isEmpty()); return null; } });