/** * Create a new empty node * */ public ManifestNode() { super(new JsonObject()); }
/** * Wrap a JsonObject in this class * * @param newJsonObject : The JsonObject to wrap */ public JsonSimple(JsonObject newJsonObject) { substitueProperties = true; if (newJsonObject == null) { newJsonObject = new JsonObject(); } jsonObject = newJsonObject; }
/** * Creates an empty JSON object * * @throws IOException if there was an error during creation */ public JsonSimple() { substitueProperties = true; jsonObject = new JsonObject(); }
@Override public Map<?, ?> createObjectContainer() { return new JsonObject(); } };
/** * Creates a JSON object from the specified string * * @param jsonIn a JSON string * @throws IOException if there was an error parsing the string */ public JsonSimple(String jsonString) throws IOException { substitueProperties = true; if (jsonString == null) { jsonObject = new JsonObject(); } else { parse(jsonString); } }
/** * Creates a JSON object from the specified input stream * * @param jsonIn a JSON stream * @throws IOException if there was an error parsing or reading the stream */ public JsonSimple(InputStream jsonIn) throws IOException { substitueProperties = true; if (jsonIn == null) { jsonObject = new JsonObject(); } else { // Stream the data into a string parse(IOUtils.toString(jsonIn, "UTF-8")); jsonIn.close(); } }
/** * Creates a JSON object from the specified file * * @param jsonFile a JSON file * @throws IOException if there was an error parsing or reading the file */ public JsonSimple(File jsonFile) throws IOException { substitueProperties = true; if (jsonFile == null) { jsonObject = new JsonObject(); } else { InputStream is = new FileInputStream(jsonFile); String json = IOUtils.toString(is, "UTF-8"); is.close(); parse(json); } }
protected JsonObject getSuccessResponse(String oid) { JsonObject jsonObject = new JsonObject(); jsonObject.put("code", 200); if (oid != null) { jsonObject.put("oid", oid); } return jsonObject; }
@SuppressWarnings("unchecked") public void updateAndSaveKeys(@SuppressWarnings("rawtypes") JSONArray keys) throws IOException { JsonObject jsonObject = new JsonObject(); JsonObject apiJsonObject = new JsonObject(); apiJsonObject.put("clients", keys); jsonObject.put("api", apiJsonObject); FileUtils.writeStringToFile(this.apiKeysFile, new JsonSimple(jsonObject).toString(true)); this.clients = keys; initialiseKeyMap(); }
private JsonObject newMessage(JsonSimple response, String target) { JsonObject order = createNewOrder(response, TransactionManagerQueueConsumer.OrderType.MESSAGE.toString()); order.put("target", target); order.put("message", new JsonObject()); return order; }
private JsonObject newMessage(JsonSimple response, String target) { JsonObject order = createNewOrder(response, TransactionManagerQueueConsumer.OrderType.MESSAGE.toString()); order.put("target", target); order.put("message", new JsonObject()); return order; } private JsonObject newSubscription(JsonSimple response, String oid) {
/** * Send the notification out on the broadcast topic * * @param oid Object id * @param status Status of the object * @param message Message to be sent */ private void sendNotification(String oid, String status, String message) throws JMSException { JsonObject jsonMessage = new JsonObject(); jsonMessage.put("id", oid); jsonMessage.put("idType", "object"); jsonMessage.put("status", status); jsonMessage.put("message", message); TextMessage msg = session.createTextMessage(jsonMessage.toString()); // producer.send(broadcast, msg); }
/** * Send the notification out on the broadcast topic * * @param oid Object Id * @param status Status of the object * @param message Message to be sent */ private void sendNotification(String oid, String status, String message) throws JMSException { JsonObject jsonMessage = new JsonObject(); jsonMessage.put("id", oid); jsonMessage.put("idType", "object"); jsonMessage.put("status", status); jsonMessage.put("message", message); TextMessage msg = session.createTextMessage(jsonMessage.toString()); // producer.send(broadcast, msg); }
/** * Send the notification out on the broadcast topic * * @param oid Object id * @param status Status of the object * @param message Message to be sent */ private void sendNotification(String oid, String status, String message) throws JMSException { JsonObject jsonMessage = new JsonObject(); jsonMessage.put("id", oid); jsonMessage.put("idType", "object"); jsonMessage.put("status", status); jsonMessage.put("message", message); TextMessage msg = session.createTextMessage(jsonMessage.toString()); // producer.send(broadcast, msg); }
private JsonObject newTransform( JsonSimple response, String target, String oid) { JsonObject order = createNewOrder(response, TransactionManagerQueueConsumer.OrderType. TRANSFORMER.toString()); order.put("target", target); order.put("oid", oid); order.put("config", new JsonObject()); return order; } private JsonObject createNewOrder(JsonSimple response, String type) {
/** * Add a new document into the buffer, and check if submission is required * * @param document : The Solr document to add to the buffer. */ private void addToBuffer(String index, String document) { JsonObject message = new JsonObject(); message.put("event", "index"); message.put("index", index); message.put("document", document); sendToIndex(message.toString()); }
@ApiOperation(value = "gets the record's Object Metadata", tags="objectmeta") @ApiResponses({ @ApiResponse(code = 200, message = "The object metadata is returned"), @ApiResponse(code = 500, message = "General Error", response = Exception.class) }) @Get("json") public String getMetadataResource() throws StorageException, IOException { Storage storage = (Storage) ApplicationContextProvider.getApplicationContext().getBean("fascinatorStorage"); String oid = getAttribute("oid"); DigitalObject digitalObject = StorageUtils.getDigitalObject(storage, oid); Properties metadata = digitalObject.getMetadata(); JsonObject jsonObject = new JsonObject(); for (Object keyObject : metadata.keySet()) { jsonObject.put((String) keyObject, metadata.getProperty((String) keyObject)); } return new JsonSimple(jsonObject).toString(true); }
private JsonObject newTransform(JsonSimple response, String target, String oid) { JsonObject order = createNewOrder(response, TransactionManagerQueueConsumer.OrderType.TRANSFORMER .toString()); order.put("target", target); order.put("oid", oid); JsonObject config = systemConfig.getObject("transformerDefaults", target); if (config == null) { order.put("config", new JsonObject()); } else { order.put("config", config); } return order; }
private JsonObject newSubscription(JsonSimple response, String oid) { JsonObject order = createNewOrder(response, TransactionManagerQueueConsumer.OrderType.SUBSCRIBER.toString()); order.put("oid", oid); JsonObject message = new JsonObject(); message.put("oid", oid); message.put("context", "Curation"); message.put("eventType", "Sending test message"); message.put("user", "system"); order.put("message", message); return order; }
private JsonObject newSubscription(JsonSimple response, String oid) { JsonObject order = createNewOrder(response, TransactionManagerQueueConsumer.OrderType. SUBSCRIBER.toString()); order.put("oid", oid); JsonObject message = new JsonObject(); message.put("oid", oid); message.put("context", "Curation"); message.put("eventType", "Sending test message"); message.put("user", "system"); order.put("message", message); return order; } private JsonObject newTransform(