Java Code Examples for com.fasterxml.jackson.databind.JsonNode#findValue()

The following examples show how to use com.fasterxml.jackson.databind.JsonNode#findValue() . You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: ModelUtils.java    From openapi-generator with Apache License 2.0 8 votes vote down vote up
/**
 * Parse the OAS document at the specified location, get the swagger or openapi version
 * as specified in the source document, and return the version.
 * 
 * For OAS 2.0 documents, return the value of the 'swagger' attribute.
 * For OAS 3.x documents, return the value of the 'openapi' attribute.
 * 
 * @param openAPI the object that encapsulates the OAS document.
 * @param location the URL of the OAS document.
 * @param auths the list of authorization values to access the remote URL.
 * 
 * @return the version of the OpenAPI document.
 */
public static SemVer getOpenApiVersion(OpenAPI openAPI, String location, List<AuthorizationValue> auths) {
    String version;
    try {
        JsonNode document = readWithInfo(location, auths);
        JsonNode value = document.findValue("swagger");
        if (value == null) {
            // This is not a OAS 2.0 document.
            // Note: we cannot simply return the value of the "openapi" attribute
            // because the 2.0 to 3.0 converter always sets the value to '3.0'.
            value = document.findValue("openapi");
        }
        version = value.asText();
    } catch (Exception ex) {
        // Fallback to using the 'openapi' attribute.
        LOGGER.warn("Unable to read swagger/openapi attribute");
        version = openAPI.getOpenapi();
    }
    // Cache the OAS version in global settings so it can be looked up in the helper functions.
    //GlobalSettings.setProperty(openapiDocVersion, version);

    return new SemVer(version);
}
 
Example 2
Source File: SearchLookupRequest.java    From timely with Apache License 2.0 6 votes vote down vote up
@Override
public HttpPostRequest parseBody(String content) throws Exception {
    // Add the operation node to the json if it does not exist for proper
    // parsing
    JsonNode root = JsonUtil.getObjectMapper().readValue(content, JsonNode.class);
    JsonNode operation = root.findValue("operation");
    if (null == operation) {
        StringBuilder buf = new StringBuilder(content.length() + 10);
        // TODO building JSON by hand? ugh
        buf.append("{ \"operation\" : \"lookup\", ");
        int open = content.indexOf("{");
        buf.append(content.substring(open + 1));
        return JsonUtil.getObjectMapper().readValue(buf.toString(), SearchLookupRequest.class);
    }
    return JsonUtil.getObjectMapper().readValue(content, SearchLookupRequest.class);
}
 
Example 3
Source File: YoutubeChannelDeserializer.java    From streams with Apache License 2.0 6 votes vote down vote up
protected ChannelContentDetails.RelatedPlaylists setRelatedPlaylists(JsonNode node) {
  ChannelContentDetails.RelatedPlaylists playlists = new ChannelContentDetails.RelatedPlaylists();
  if (node == null) {
    return playlists;
  }
  if (node.findValue("favorites") != null) {
    playlists.setFavorites(node.get("favorites").asText());
  }
  if (node.findValue("likes") != null) {
    playlists.setLikes(node.get("likes").asText());
  }
  if (node.findValue("uploads") != null) {
    playlists.setUploads(node.get("uploads").asText());
  }
  return playlists;
}
 
Example 4
Source File: AbstractCommand.java    From mirror with Apache License 2.0 6 votes vote down vote up
@Override
public boolean matches(CommandResult commandResult) {
    if (!getCommandKind().equals(commandResult.getCommandKind())) {
        return false;
    }

    JsonNode key = commandResult.getJsonNode().get(getCommandTypeKey());
    if (key != null) {
        return getCommandTypeValue().equals(key.textValue());
    }
    key = commandResult.getNativeData();
    if (key != null) {
        key = key.findValue(getCommandTypeKey());
        if (key != null) {
            return getCommandTypeValue().equals(key.textValue());
        }
    }
    return false;
}
 
Example 5
Source File: Platform2MosaicTranslator.java    From Mosaic with Apache License 2.0 6 votes vote down vote up
public static PlatformLayoutMap[] readFlexLayout(String json) {
	PlatformLayoutMap[] map = null;
	try {
		ObjectMapper om = new ObjectMapper();
		JsonNode root = om.readTree(json);
		JsonNode layoutNode = root.findValue("layout");
		if(layoutNode == null) {
			throw new IllegalArgumentException(
				"JSON string passed in did not contain layout node, or was not a complete json object.");
		}
		
		String processedString = processEscapesSequences(layoutNode.toString());
		System.out.println(processedString);
		map = om.readValue(processedString, PlatformLayoutMap[].class);
		for(PlatformLayoutMap pm : map) {
			System.out.println(pm.getName());
		}
	}catch(Exception e) {
		e.printStackTrace();
	}
	
	return map;
}
 
Example 6
Source File: ArrayNode.java    From lams with GNU General Public License v2.0 5 votes vote down vote up
@Override
public JsonNode findValue(String fieldName)
{
    for (JsonNode node : _children) {
        JsonNode value = node.findValue(fieldName);
        if (value != null) {
            return value;
        }
    }
    return null;
}
 
Example 7
Source File: QueueManager.java    From conductor with Apache License 2.0 5 votes vote down vote up
private String getValue(String fieldName, JsonNode json) {
	JsonNode node = json.findValue(fieldName);
	if(node == null) {
		return null;
	}
	return node.textValue();
}
 
Example 8
Source File: SuggestRequest.java    From timely with Apache License 2.0 5 votes vote down vote up
@Override
public HttpPostRequest parseBody(String content) throws Exception {
    // Add the operation node to the json if it does not exist for proper
    // parsing
    JsonNode root = JsonUtil.getObjectMapper().readValue(content, JsonNode.class);
    JsonNode operation = root.findValue("operation");
    if (null == operation) {
        StringBuilder buf = new StringBuilder(content.length() + 10);
        buf.append("{ \"operation\" : \"suggest\", ");
        int open = content.indexOf("{");
        buf.append(content.substring(open + 1));
        return JsonUtil.getObjectMapper().readValue(buf.toString(), SuggestRequest.class);
    }
    return JsonUtil.getObjectMapper().readValue(content, SuggestRequest.class);
}
 
Example 9
Source File: CiscoNxosDeviceDescription.java    From onos with Apache License 2.0 5 votes vote down vote up
@Override
public DeviceDescription discoverDeviceDetails() {
    DriverHandler handler = handler();
    RestSBController controller = checkNotNull(handler.get(RestSBController.class));
    DeviceId deviceId = handler.data().deviceId();

    ArrayList<String> cmd = new ArrayList<>();
    cmd.add(SHOW_VERSION_CMD);

    String req = NxApiRequest.generate(cmd, NxApiRequest.CommandType.CLI);

    String response = NxApiRequest.post(controller, deviceId, req);

    String mrf = UNKNOWN;
    String hwVer = UNKNOWN;
    String swVer = UNKNOWN;
    String serialNum = UNKNOWN;

    try {
        ObjectMapper om = new ObjectMapper();
        JsonNode json = om.readTree(response);

        JsonNode body = json.findValue("body");
        if (body != null) {
            mrf = body.get(MANUFACTURER).asText();
            hwVer = body.get(CHASSIS_ID).asText();
            swVer = body.get(KICKSTART_VER).asText();
        }
    } catch (IOException e) {
        log.error("Failed to to retrieve Device Information {}", e);
    }

    DeviceService deviceService = checkNotNull(handler().get(DeviceService.class));
    Device device = deviceService.getDevice(deviceId);
    return new DefaultDeviceDescription(device.id().uri(), Device.Type.SWITCH,
            mrf, hwVer, swVer, serialNum,
            new ChassisId(), (SparseAnnotations) device.annotations());
}
 
Example 10
Source File: CiscoNxosPortStatistics.java    From onos with Apache License 2.0 5 votes vote down vote up
private DefaultPortStatistics buildStatisticsFromResponse(String response,
                                                          PortNumber portNumber,
                                                          DeviceId deviceId) {
    DefaultPortStatistics defaultPortStatistics = null;

    try {
        ObjectMapper om = new ObjectMapper();
        JsonNode json = om.readTree(response);
        JsonNode res = json.get(RESULT);
        JsonNode deviceInterface = res.findValue(ROW_INTERFACE);
        long packetsReceived = deviceInterface.get(ETH_INPKTS).asLong();
        long packetsSent = deviceInterface.get(ETH_OUTPKTS).asLong();
        long bytesReceived = deviceInterface.get(ETH_INBYTES).asLong();
        long bytesSent = deviceInterface.get(ETH_OUTBYTES).asLong();
        long packetsRxDropped = deviceInterface.get(ETH_INERR).asLong();
        long packetsTxDropped = deviceInterface.get(ETH_OUTERR).asLong();
        long packetsRxErrors = deviceInterface.get(ETH_INERR1).asLong();
        long packetsTxErrors = deviceInterface.get(ETH_OUTERR1).asLong();

        DefaultPortStatistics.Builder builder = DefaultPortStatistics.builder();
        defaultPortStatistics = builder.setPort(portNumber)
                .setPacketsReceived(packetsReceived)
                .setPacketsSent(packetsSent)
                .setBytesReceived(bytesReceived)
                .setBytesSent(bytesSent)
                .setPacketsRxDropped(packetsRxDropped)
                .setPacketsTxDropped(packetsTxDropped)
                .setPacketsRxErrors(packetsRxErrors)
                .setPacketsTxErrors(packetsTxErrors)
                .setDeviceId(deviceId)
                .build();

    } catch (IOException e) {
        log.error("Cannot read or process NxApi response: {}", e.toString());
    }

    log.debug("Port statistics: {}", defaultPortStatistics);
    return defaultPortStatistics;
}
 
Example 11
Source File: AbstractCommand.java    From mirror with Apache License 2.0 5 votes vote down vote up
private JsonNode jsonNodeValue(JsonNode node, String key) {
    if (node != null) {
        JsonNode keyNode = node.findValue(key);
        if (keyNode != null) {
            return keyNode;
        }
    }
    return null;
}
 
Example 12
Source File: FreeMarkerTemplateUtils.java    From cloudbreak with Apache License 2.0 5 votes vote down vote up
public String getFieldValue(String armTemplate, String fieldName) {
    JsonNode node = convertStringTemplateToJson(armTemplate);
    JsonNode foundNode = node.findValue(fieldName);
    if (foundNode.isValueNode()) {
        return foundNode.asText();
    }
    return null;
}
 
Example 13
Source File: AuthHeaderStrategyMount.java    From spring-cloud-huawei with Apache License 2.0 5 votes vote down vote up
@Override
public void createAuthHeaders() {
  try {
    String content = new String(
        Files.readAllBytes(Paths.get(DEFAULT_SECRET_AUTH_PATH, DEFAULT_SECRET_AUTH_NAME)),
        "UTF-8");
    JsonNode data = JsonUtils.OBJ_MAPPER.readTree(content);
    JsonNode authNode = data.findValue("auth");
    decode(authNode);
  } catch (Exception e) {
    LOGGER.warn("read auth info from dockerconfigjson failed.", e);
  }
}
 
Example 14
Source File: ResourcePatch.java    From katharsis-framework with Apache License 2.0 5 votes vote down vote up
private String extractAttributesFromResourceAsJson(Resource resource) throws IOException{

        JsonApiResponse response = new JsonApiResponse();
        response.setEntity(resource);
        // deserialize using the objectMapper so it becomes json-api
        String newRequestBody = objectMapper.writeValueAsString(resource);
        JsonNode node = objectMapper.readTree(newRequestBody);
        JsonNode attributes = node.findValue("attributes");
        return objectMapper.writeValueAsString(attributes);

    }
 
Example 15
Source File: ServiceNowMetaDataExtension.java    From syndesis with Apache License 2.0 5 votes vote down vote up
/**
 * Determine the hierarchy of a table by inspecting the super_class attribute.
 */
@SuppressWarnings("PMD.SignatureDeclareThrowsException")
private static List<String> getObjectHierarchy(MetaContext context) throws Exception {
    List<String> hierarchy = new ArrayList<>();
    String query = String.format("name=%s", context.getObjectName());

    while (true) {
        Optional<JsonNode> response = context.getClient().reset()
            .types(MediaType.APPLICATION_JSON_TYPE)
            .path(NOW)
            .path(context.getConfiguration().getApiVersion())
            .path(TABLE)
            .path(SYS_DB_OBJECT)
            .query(SYSPARM_EXCLUDE_REFERENCE_LINK, "true")
            .query(SYSPARM_FIELDS, "name%2Csuper_class")
            .query(SYSPARM_QUERY, query)
            .trasform(HttpMethod.GET, ServiceNowMetaDataExtension::findResultNode);

        if (response.isPresent()) {
            final JsonNode node = response.get();
            final JsonNode nameNode = node.findValue("name");
            final JsonNode classNode = node.findValue("super_class");

            if (nameNode != null && classNode != null) {
                query = String.format("sys_id=%s", classNode.textValue());
                hierarchy.add(0, nameNode.textValue());
            } else {
                break;
            }
        } else {
            break;
        }
    }

    return hierarchy;
}
 
Example 16
Source File: ElasticSearchFilterTest.java    From timbuctoo with GNU General Public License v3.0 5 votes vote down vote up
private void testElaborate(String query) throws Exception {
  // test elaborate with and without token.

  JsonNode node = eSearch.elaborateQuery(query, null, 5);

  JsonNode sizeNode = node.findValue("size");
  assertThat(sizeNode.asInt(), equalTo(5));
  assertThat(node.has("search_after"), equalTo(false));
  JsonNode sortNode = node.findValue("sort");
  Iterator<JsonNode> sortIter = sortNode.elements();
  String expectedSort1 = "{\"balance\":\"asc\"}";
  String expectedSort2 = "{\"" + ElasticSearchFilter.UNIQUE_FIELD_NAME + "\":\"desc\"}";
  assertThat(sortIter.next().toString(), equalTo(expectedSort1));
  assertThat(sortIter.next().toString(), equalTo(expectedSort2));
  String expectedSort = expectedSort1 + "," + expectedSort2;
  String expected = "{\"size\":5,\"query\":{\"match\":{\"gender\":\"F\"}},\"sort\":[" + expectedSort + "]}";
  assertThat(node.toString(), equalTo(expected));

  expected = "{\"size\":6,\"query\":{\"match\":{\"gender\":\"F\"}},\"sort\":[" + expectedSort + "]," +
      "\"from\":49223}";
  node = eSearch.elaborateQuery(query, "49223", 6);

  sizeNode = node.findValue("size");
  assertThat(sizeNode.asInt(), equalTo(6));
  JsonNode searchAfterNode = node.findValue("from");
  assertThat(searchAfterNode.toString(), equalTo("49223"));
  sortNode = node.findValue("sort");
  sortIter = sortNode.elements();
  assertThat(sortIter.next().toString(), equalTo(expectedSort1));
  assertThat(sortIter.next().toString(), equalTo(expectedSort2));
  assertThat(node.toString(), equalTo(expected));
}
 
Example 17
Source File: FunnelTest.java    From KeenClient-Java with MIT License 4 votes vote down vote up
private List<FunnelStep> buildFunnelStepsFromRequestJson(JsonNode requestJson) {

        JsonNode stepsJson = requestJson.findValue("steps");

        // Construct a list of funnel steps based on provided data
        List<FunnelStep> funnelSteps = new ArrayList<FunnelStep>();

        for (JsonNode stepJson : stepsJson) {
            Timeframe timeframe = null;
            List<Filter> filters = null;
            Boolean inverted = null;
            Boolean optional = null;
            Boolean withActors = null;

            if (stepJson.has(KeenQueryConstants.TIMEFRAME) &&
                    stepJson.has(KeenQueryConstants.TIMEZONE)) {
                timeframe = new RelativeTimeframe(
                        stepJson.get(KeenQueryConstants.TIMEFRAME).asText(),
                        stepJson.get(KeenQueryConstants.TIMEZONE).asText());
            } else if(stepJson.has(KeenQueryConstants.TIMEFRAME)) {
                JsonNode timeframeJson = stepJson.get(KeenQueryConstants.TIMEFRAME);
                if (!timeframeJson.isObject()) {
                    timeframe = new RelativeTimeframe(timeframeJson.asText());
                } else {
                    throw new IllegalStateException(
                            "Building absolute timeframes isn't supported by this method.");
                }
            }

            if (stepJson.has(KeenQueryConstants.FILTERS)) {
                JsonNode filterListJson = stepJson.get(KeenQueryConstants.FILTERS);

                for (JsonNode filterJson : filterListJson) {
                    if (null == filters) {
                        filters = new LinkedList<Filter>();
                    }
                    filters.add(
                            new Filter(
                                    filterJson.get(KeenQueryConstants.PROPERTY_NAME).asText(),
                                    stringToFilterOperator(filterJson.get(KeenQueryConstants.OPERATOR).asText()),
                                    filterJson.get(KeenQueryConstants.PROPERTY_VALUE).asText()
                            )
                    );
                }
            }

            if (stepJson.has(KeenQueryConstants.INVERTED)) {
                inverted = stepJson.get(KeenQueryConstants.INVERTED).asBoolean();
            }

            if (stepJson.has(KeenQueryConstants.OPTIONAL)) {
                optional = stepJson.get(KeenQueryConstants.OPTIONAL).asBoolean();
            }

            if (stepJson.has(KeenQueryConstants.WITH_ACTORS)) {
                withActors = stepJson.get(KeenQueryConstants.WITH_ACTORS).asBoolean();
            }

            FunnelStep step = new FunnelStep(
                    stepJson.get(KeenQueryConstants.EVENT_COLLECTION).asText(),
                    stepJson.get(KeenQueryConstants.ACTOR_PROPERTY).asText(),
                    timeframe,
                    filters,
                    inverted,
                    optional,
                    withActors
            );

            funnelSteps.add(step);
        }

        return funnelSteps;
    }
 
Example 18
Source File: ServiceNowMetaDataExtension.java    From syndesis with Apache License 2.0 4 votes vote down vote up
@SuppressWarnings("PMD.SignatureDeclareThrowsException")
private Optional<MetaData> tableList(MetaContext context) throws Exception {
    Optional<JsonNode> response = context.getClient().reset()
        .types(MediaType.APPLICATION_JSON_TYPE)
        .path(NOW)
        .path(context.getConfiguration().getApiVersion())
        .path(TABLE)
        .path(SYS_DB_OBJECT)
        .query(SYSPARM_EXCLUDE_REFERENCE_LINK, "true")
        .query(SYSPARM_FIELDS, "name%2Csys_id")
        .query(SYSPARM_QUERY, "name=sys_import_set_row")
        .trasform(HttpMethod.GET, ServiceNowMetaDataExtension::findResultNode);

    if (response.isPresent()) {
        final JsonNode node = response.get();
        final JsonNode sysId = node.findValue("sys_id");

        response = context.getClient().reset()
            .types(MediaType.APPLICATION_JSON_TYPE)
            .path(NOW)
            .path(context.getConfiguration().getApiVersion())
            .path(TABLE)
            .path(SYS_DB_OBJECT)
            .query(SYSPARM_EXCLUDE_REFERENCE_LINK, "true")
            .query(SYSPARM_FIELDS, "name%2Csys_name%2Csuper_class")
            .trasform(HttpMethod.GET, ServiceNowMetaDataExtension::findResultNode);

        if (response.isPresent()) {
            final ObjectNode root = context.getConfiguration().getOrCreateMapper().createObjectNode();

            processResult(response.get(), n -> {
                final JsonNode superClass = n.findValue("super_class");
                final JsonNode name = n.findValue("name");
                final JsonNode label = n.findValue("sys_name");

                if (superClass != null) {
                    final String impId = sysId != null ? sysId.textValue() : null;
                    final String superId = superClass.textValue();

                    if (impId != null && superId != null && ObjectHelper.equal(impId, superId)) {
                        LOGGER.debug("skip table: name={}, label={} because it refers to an import set", name, label);
                        return;
                    }
                }

                if (name != null && label != null) {
                    String key = name.textValue();
                    String val = label.textValue();

                    if (ObjectHelper.isEmpty(val)) {
                        val = key;
                    }

                    root.put(key, val);
                }
            });

            return Optional.of(
                MetaDataBuilder.on(getCamelContext())
                    .withAttribute(MetaData.CONTENT_TYPE, "application/json")
                    .withAttribute(MetaData.JAVA_TYPE, JsonNode.class)
                    .withAttribute("Meta-Context", ServiceNowConstants.RESOURCE_IMPORT)
                    .withPayload(root)
                    .build()
            );
        }
    }

    return Optional.empty();
}
 
Example 19
Source File: ServiceNowMetaDataExtension.java    From syndesis with Apache License 2.0 4 votes vote down vote up
@SuppressWarnings("PMD.SignatureDeclareThrowsException")
private Optional<MetaData> importSetList(MetaContext context) throws Exception {
    Optional<JsonNode> response = context.getClient().reset()
        .types(MediaType.APPLICATION_JSON_TYPE)
        .path(NOW)
        .path(context.getConfiguration().getApiVersion())
        .path(TABLE)
        .path(SYS_DB_OBJECT)
        .query(SYSPARM_EXCLUDE_REFERENCE_LINK, "true")
        .query(SYSPARM_FIELDS, "name%2Csys_id")
        .query(SYSPARM_QUERY, "name=sys_import_set_row")
        .trasform(HttpMethod.GET, ServiceNowMetaDataExtension::findResultNode);

    if (response.isPresent()) {
        final JsonNode node = response.get();
        final JsonNode sysId = node.findValue("sys_id");

        if (sysId == null) {
            throw new IllegalStateException("Unable to determine sys_id of sys_import_set_row");
        }

        response = context.getClient().reset()
            .types(MediaType.APPLICATION_JSON_TYPE)
            .path(NOW)
            .path(context.getConfiguration().getApiVersion())
            .path(TABLE)
            .path(SYS_DB_OBJECT)
            .query(SYSPARM_EXCLUDE_REFERENCE_LINK, "true")
            .query(SYSPARM_FIELDS, "name%2Csys_name")
            .queryF(SYSPARM_QUERY, "super_class=%s", sysId.textValue())
            .trasform(HttpMethod.GET, ServiceNowMetaDataExtension::findResultNode);

        if (response.isPresent()) {
            final ObjectNode root = context.getConfiguration().getOrCreateMapper().createObjectNode();

            processResult(response.get(), n -> {
                final JsonNode name = n.findValue("name");
                final JsonNode label = n.findValue("sys_name");

                if (name != null && label != null) {
                    root.put(name.textValue(), label.textValue());
                }
            });

            return Optional.of(
                MetaDataBuilder.on(getCamelContext())
                    .withAttribute(MetaData.CONTENT_TYPE, "application/json")
                    .withAttribute(MetaData.JAVA_TYPE, JsonNode.class)
                    .withPayload(root)
                    .build()
            );
        }
    }

    return Optional.empty();
}
 
Example 20
Source File: WeatherService.java    From ehcache3-samples with Apache License 2.0 4 votes vote down vote up
@CacheResult(cacheName = "weatherReports")
public WeatherReport retrieveWeatherReport(String location, LocalDate date) {

    if (stubWebServices) {
        return getFakeWeatherReport(location, date);
    }

    // resource call report gathered in the retrieveCoordinates service
    Coordinates coordinates = coordinatesService.retrieveCoordinates(location);

    Stopwatch stopwatch = Stopwatch.createStarted();

    String url = "https://api.darksky.net/forecast/" +
                 darkSkyApiKey + "/" +
                 coordinates.getLatitude() +
                 HttpUtil.utf8Encode(",") +
                 coordinates.getLongitude() +
                 HttpUtil.utf8Encode(",") +
                 date.atStartOfDay().toInstant(ZoneOffset.UTC).toEpochMilli() / 1000 + "?units=si";

    String responseAsString = "Never received";
    try {
        responseAsString = httpService.sendGet(url);
        JsonNode daily = objectMapper.readTree(responseAsString).findValue("daily");

        if(daily != null) {

            ArrayNode dataNode = (ArrayNode) daily.findValue("data");
            return new WeatherReport(
                date, location,
                dataNode.get(0).get("icon").asText(),
                dataNode.get(0).get("summary").asText(),
                dataNode.get(0).get("temperatureMin").asDouble(),
                dataNode.get(0).get("temperatureMax").asDouble());
        }
        else {
            return new WeatherReport(date, location, "unknown", "Unknown.", Double.NaN, Double.NaN);
        }
    }
    catch(Exception e) {
        throw new RuntimeException("Can't find weather report for " + location + " for this date : " + date + "\n call to " +
                                   url + " with darkskyapi response was : " + responseAsString, e);
    }
    finally {
        resourceCallService.addCall("Darksky Rest API", ResourceType.WEB_SERVICE, location + " on " + date, stopwatch.elapsed(TimeUnit.MILLISECONDS));
    }
}