org.n52.janmayen.Json.loadString()方法的使用及代码示例

x33g5p2x  于2022-01-22 转载在 其他  
字(11.7k)|赞(0)|评价(0)|浏览(150)

本文整理了Java中org.n52.janmayen.Json.loadString()方法的一些代码示例,展示了Json.loadString()的具体用法。这些代码示例主要来源于Github/Stackoverflow/Maven等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。Json.loadString()方法的具体详情如下:
包路径:org.n52.janmayen.Json
类名称:Json
方法名:loadString

Json.loadString介绍

暂无

代码示例

代码示例来源:origin: org.n52.arctic-sea/svalbard-json-common

public ProcessingReport validate(String json, String schema)
    throws IOException {
  return validate(Json.loadString(json), schema);
}

代码示例来源:origin: org.n52.arctic-sea/svalbard-json-common

public boolean isValid(String json, String schema)
    throws IOException {
  return isValid(Json.loadString(json), schema);
}

代码示例来源:origin: 52North/SOS

@ResponseStatus(HttpStatus.NO_CONTENT)
@RequestMapping(value="/edit", method = RequestMethod.POST, consumes = MediaType.APPLICATION_JSON_VALUE)
public void setOfferingExtensionSettings(
    @RequestBody final String settings) throws NoSuchExtensionException, NoSuchOfferingException,
    OwsExceptionReport, IOException {
  JsonNode request = Json.loadString(settings);
  final String offeringId = request.path(OFFERING).asText();
  final String extensionId = request.path(IDENTIFIER).asText();
  if (request.has(DISABLED_PROPERTY)) {
    getCapabilitiesExtensionService().disableOfferingExtension(offeringId, extensionId, request.path(DISABLED_PROPERTY).asBoolean());
  }
}

代码示例来源:origin: org.n52.sensorweb.sos/admin-controller

@ResponseStatus(HttpStatus.NO_CONTENT)
@RequestMapping(value="/{identifier}", method = RequestMethod.POST, consumes = MediaType.APPLICATION_JSON_VALUE)
public void setCapabilitiesExtensionSettings(
    @PathVariable("identifier") String identifier,
    @RequestBody String settings) throws NoSuchExtensionException, NoSuchOfferingException, IOException {
  JsonNode request = Json.loadString(settings);
  if (request.has(DISABLED_PROPERTY)) {
    getCapabilitiesExtensionService().disableCapabilitiesExtension(identifier, request.path(DISABLED_PROPERTY).asBoolean());
  }
}

代码示例来源:origin: org.n52.sensorweb.sos/admin-controller

@ResponseBody
@ResponseStatus(HttpStatus.NO_CONTENT)
@RequestMapping(method = RequestMethod.POST, consumes = MediaType.APPLICATION_JSON_VALUE)
public void setCurrentCapabilities(@RequestBody String json) throws SQLException,
                                  ConfigurationError,
                                  OwsExceptionReport,
                                  NoSuchExtensionException,
                                  IOException {
  String id = null;
  JsonNode node = Json.loadString(json);
  if (node.path(CURRENT).isTextual()) {
    id = node.path(CURRENT).asText();
  }
  setSelectedStaticCapabilities(id);
}

代码示例来源:origin: org.n52.sensorweb.sos/admin-controller

@ResponseStatus(HttpStatus.NO_CONTENT)
  @RequestMapping(value="/delete", method = RequestMethod.DELETE, consumes = MediaType.APPLICATION_JSON_VALUE)
  public void deleteOfferingExtension(
      @RequestBody final String requestJson) throws NoSuchExtensionException, NoSuchOfferingException,
      OwsExceptionReport, IOException {
    JsonNode request = Json.loadString(requestJson);
    final String offeringId = request.path(OFFERING).asText();
    final String extensionId = request.path(IDENTIFIER).asText();
    getCapabilitiesExtensionService().deleteOfferingExtension(offeringId, extensionId);
  }
}

代码示例来源:origin: org.n52.sensorweb.sos/admin-controller

@ResponseStatus(HttpStatus.NO_CONTENT)
@RequestMapping(value="/edit", method = RequestMethod.POST, consumes = MediaType.APPLICATION_JSON_VALUE)
public void setOfferingExtensionSettings(
    @RequestBody final String settings) throws NoSuchExtensionException, NoSuchOfferingException,
    OwsExceptionReport, IOException {
  JsonNode request = Json.loadString(settings);
  final String offeringId = request.path(OFFERING).asText();
  final String extensionId = request.path(IDENTIFIER).asText();
  if (request.has(DISABLED_PROPERTY)) {
    getCapabilitiesExtensionService().disableOfferingExtension(offeringId, extensionId, request.path(DISABLED_PROPERTY).asBoolean());
  }
}

代码示例来源:origin: 52North/SOS

@ResponseStatus(HttpStatus.NO_CONTENT)
@RequestMapping(value="/{identifier}", method = RequestMethod.POST, consumes = MediaType.APPLICATION_JSON_VALUE)
public void setCapabilitiesExtensionSettings(
    @PathVariable("identifier") String identifier,
    @RequestBody String settings) throws NoSuchExtensionException, NoSuchOfferingException, IOException {
  JsonNode request = Json.loadString(settings);
  if (request.has(DISABLED_PROPERTY)) {
    getCapabilitiesExtensionService().disableCapabilitiesExtension(identifier, request.path(DISABLED_PROPERTY).asBoolean());
  }
}

代码示例来源:origin: 52North/SOS

@ResponseBody
@ResponseStatus(HttpStatus.NO_CONTENT)
@RequestMapping(method = RequestMethod.POST, consumes = MediaType.APPLICATION_JSON_VALUE)
public void setCurrentCapabilities(@RequestBody String json) throws SQLException,
                                  ConfigurationError,
                                  OwsExceptionReport,
                                  NoSuchExtensionException,
                                  IOException {
  String id = null;
  JsonNode node = Json.loadString(json);
  if (node.path(CURRENT).isTextual()) {
    id = node.path(CURRENT).asText();
  }
  setSelectedStaticCapabilities(id);
}

代码示例来源:origin: 52North/SOS

@ResponseStatus(HttpStatus.NO_CONTENT)
  @RequestMapping(value="/delete", method = RequestMethod.DELETE, consumes = MediaType.APPLICATION_JSON_VALUE)
  public void deleteOfferingExtension(
      @RequestBody final String requestJson) throws NoSuchExtensionException, NoSuchOfferingException,
      OwsExceptionReport, IOException {
    JsonNode request = Json.loadString(requestJson);
    final String offeringId = request.path(OFFERING).asText();
    final String extensionId = request.path(IDENTIFIER).asText();
    getCapabilitiesExtensionService().deleteOfferingExtension(offeringId, extensionId);
  }
}

代码示例来源:origin: 52North/SOS

@ResponseBody
@RequestMapping(value = ControllerConstants.Paths.ADMIN_BINDINGS_JSON_ENDPOINT, method = RequestMethod.POST, consumes = ControllerConstants.MEDIA_TYPE_APPLICATION_JSON)
public void change(@RequestBody String request) throws IOException {
  JsonNode json = Json.loadString(request);
  if (json.has(JSONConstants.BINDING_KEY)) {
    BindingKey key = getKey(json.path(JSONConstants.BINDING_KEY).asText());
    this.bindingRepository.setActive(key, json.path(JSONConstants.ACTIVE_KEY).asBoolean());
  } else {
    throw new JSONException("Invalid JSON");
  }
}

代码示例来源:origin: org.n52.sensorweb.sos/admin-controller

@ResponseBody
@RequestMapping(value = ControllerConstants.Paths.ADMIN_BINDINGS_JSON_ENDPOINT, method = RequestMethod.POST, consumes = ControllerConstants.MEDIA_TYPE_APPLICATION_JSON)
public void change(@RequestBody String request) throws IOException {
  JsonNode json = Json.loadString(request);
  if (json.has(JSONConstants.BINDING_KEY)) {
    BindingKey key = getKey(json.path(JSONConstants.BINDING_KEY).asText());
    this.bindingRepository.setActive(key, json.path(JSONConstants.ACTIVE_KEY).asBoolean());
  } else {
    throw new JSONException("Invalid JSON");
  }
}

代码示例来源:origin: org.n52.sensorweb.sos/admin-controller

@ResponseBody
  @RequestMapping(value = ControllerConstants.Paths.ADMIN_OPERATIONS_JSON_ENDPOINT,
          method = RequestMethod.POST,
          consumes = ControllerConstants.MEDIA_TYPE_APPLICATION_JSON)
  public void change(@RequestBody String request) throws JSONException, IOException {
    JsonNode json = Json.loadString(request);
    String service = json.path(JSONConstants.SERVICE_KEY).asText();
    String version = json.path(JSONConstants.VERSION_KEY).asText();
    String operation = json.path(JSONConstants.OPERATION_KEY).asText();
    boolean active = json.path(JSONConstants.ACTIVE_KEY).asBoolean();

    OwsServiceKey sokt = new OwsServiceKey(service, version);
    RequestOperatorKey rokt = new RequestOperatorKey(sokt, operation);
    this.requestOperatorRepository.setActive(rokt, active);
  }
}

代码示例来源:origin: 52North/SOS

@ResponseStatus(HttpStatus.NO_CONTENT)
@RequestMapping(value="/save", method = RequestMethod.POST, consumes = MediaType.APPLICATION_JSON_VALUE)
public void saveOfferingExtension(@RequestBody final String extensionJson)
    throws XmlException, NoSuchOfferingException, OwsExceptionReport, IOException {
  JsonNode request = Json.loadString(extensionJson);
  final String offeringId = request.path(OFFERING).asText();
  final String extensionId = request.path(IDENTIFIER).asText();
  final String extensionContent = request.path(EXTENSION_PROPERTY).asText();
  checkOffering(offeringId);
  XmlObject.Factory.parse(extensionContent);
  getCapabilitiesExtensionService().saveOfferingExtension(offeringId, extensionId, extensionContent);
}

代码示例来源:origin: org.n52.sensorweb.sos/admin-controller

@ResponseStatus(HttpStatus.NO_CONTENT)
@RequestMapping(value="/save", method = RequestMethod.POST, consumes = MediaType.APPLICATION_JSON_VALUE)
public void saveOfferingExtension(@RequestBody final String extensionJson)
    throws XmlException, NoSuchOfferingException, OwsExceptionReport, IOException {
  JsonNode request = Json.loadString(extensionJson);
  final String offeringId = request.path(OFFERING).asText();
  final String extensionId = request.path(IDENTIFIER).asText();
  final String extensionContent = request.path(EXTENSION_PROPERTY).asText();
  checkOffering(offeringId);
  XmlObject.Factory.parse(extensionContent);
  getCapabilitiesExtensionService().saveOfferingExtension(offeringId, extensionId, extensionContent);
}

代码示例来源:origin: 52North/SOS

@ResponseBody
  @RequestMapping(value = ControllerConstants.Paths.ADMIN_OPERATIONS_JSON_ENDPOINT,
          method = RequestMethod.POST,
          consumes = ControllerConstants.MEDIA_TYPE_APPLICATION_JSON)
  public void change(@RequestBody String request) throws JSONException, IOException {
    JsonNode json = Json.loadString(request);
    String service = json.path(JSONConstants.SERVICE_KEY).asText();
    String version = json.path(JSONConstants.VERSION_KEY).asText();
    String operation = json.path(JSONConstants.OPERATION_KEY).asText();
    boolean active = json.path(JSONConstants.ACTIVE_KEY).asBoolean();

    OwsServiceKey sokt = new OwsServiceKey(service, version);
    RequestOperatorKey rokt = new RequestOperatorKey(sokt, operation);
    this.requestOperatorRepository.setActive(rokt, active);
  }
}

代码示例来源:origin: org.n52.faroe/faroe

static MultilingualString decodeMultiLingualStringValue(String stringValue) {
  MultilingualString ms = new MultilingualString();
  if (!nullOrEmpty(stringValue)) {
    JsonNode json = Json.loadString(stringValue);
    Iterator<String> it = json.fieldNames();
    while (it.hasNext()) {
      String lang = it.next();
      String value = json.path(lang).asText();
      ms.addLocalization(LocaleHelper.decode(lang), value);
    }
  }
  return ms;
}

代码示例来源:origin: org.n52.sensorweb.sos/aqd-v10

@RequestMapping(method = RequestMethod.POST, consumes = "application/json")
@ResponseStatus(HttpStatus.NO_CONTENT)
public void save(@RequestBody String json) throws OwsExceptionReport, DecodingException {
  LOG.info("Saving {}", json);
  Decoder<ReportObligation, JsonNode> reportObligationDecoder = decoderRepository.getDecoder(new JsonDecoderKey(ReportObligation.class));
  Decoder<RelatedParty, JsonNode> relatedPartyDecoder = decoderRepository.getDecoder(new JsonDecoderKey(RelatedParty.class));
  JsonNode node = Json.loadString(json);
  RelatedParty relatedParty = relatedPartyDecoder.decode(node.path(AQDJSONConstants.REPORTING_AUTHORITY));
  reportObligationRepository.saveReportingAuthority(relatedParty);
  JsonNode obligations = node.path(AQDJSONConstants.REPORT_OBLIGATIONS);
  Iterator<String> it = obligations.fieldNames();
  while (it.hasNext()) {
    String id = it.next();
    ReportObligation reportObligation = reportObligationDecoder.decode(obligations.path(id));
    reportObligationRepository.saveReportObligation(ReportObligationType.valueOf(id), reportObligation);
  }
}

代码示例来源:origin: 52North/SOS

protected T decode(JSONFragment entity) throws OwsExceptionReport, DecodingException {
  Decoder<T, JsonNode> decoder = decoderRepository.getDecoder(new JsonDecoderKey(type));
  JsonNode node = Json.loadString(entity.getJSON());
  return decoder.decode(node);
}

代码示例来源:origin: org.n52.sensorweb.sos/admin-controller

@ResponseStatus(HttpStatus.NO_CONTENT)
@RequestMapping(method = RequestMethod.POST,
        consumes = MediaType.APPLICATION_JSON_VALUE)
public void update(@RequestBody String json)
    throws NoImplementationFoundException,
        JSONException,
        NoSuchIdentifierException,
        OwsExceptionReport,
        IOException {
  @SuppressWarnings("unchecked")
  T i18n = (T) encoder.decodeI18NMetadata(Json.loadString(json));
  LOGGER.debug("Updating I18N for {}", i18n.getIdentifier());
  checkIdentifier(i18n.getIdentifier());
  LOGGER.debug("Saving I18N: {}", i18n);
  getDao().saveMetadata(i18n);
  ContentCacheUpdate update = getContentCacheUpdate(i18n);
  getContentCacheController().update(update);
}

相关文章