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; }
/** * Set the title for this manifest * * @param title : The new title */ public void setTitle(String title) { getJsonObject().put("title", title); }
/** * Set the title for this node. * * @param title : The new title */ public void setTitle(String title) { getJsonObject().put("title", title); } }
/** * Set the description for this manifest * * @param description : The new description */ public void setDescription(String description) { getJsonObject().put("description", description); }
/** * Set the ID for this node. * * @param id : The new ID */ public void setId(String id) { getJsonObject().put("id", id); }
private JsonObject createNewOrder(JsonSimple response, String type) { JsonObject order = response.writeObject("orders", -1); order.put("type", type); return order; }
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) {
private JsonObject createNewOrder(JsonSimple response, String type) { JsonObject order = response.writeObject("orders", -1); order.put("type", type); return order; }
/** * Set the type of this manifest * * @param type : The new type */ public void setType(String type) { getJsonObject().put("packageType", type); }
/** * Set the 'viewId' node for this manifest * * @param viewId : The new viewId */ public void setViewId(String viewId) { getJsonObject().put("viewId", viewId); } }
/** * Set the hidden flag for this node. * * @param hidden : The new flag */ public void setHidden(boolean hidden) { getJsonObject().put("hidden", hidden); }
/** * 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()); }
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) {
/** * Creation of new Orders with appropriate default nodes * */ private JsonObject newIndex(JsonSimple response, String oid) { JsonObject order = createNewOrder(response, TransactionManagerQueueConsumer.OrderType.INDEXER.toString()); order.put("oid", oid); return order; }
/** * Generate an order to add a message to the System's audit log * * @param response The response to add an order to * @param oid The object ID we are logging * @param message The message we want to log */ private void audit(JsonSimple response, String oid, String message) { JsonObject order = newSubscription(response, oid); JsonObject messageObject = (JsonObject) order.get("message"); messageObject.put("eventType", message); }
/** * Creation of new Orders with appropriate default nodes * */ private JsonObject newIndex(JsonSimple response, String oid) { JsonObject order = createNewOrder(response, TransactionManagerQueueConsumer.OrderType.INDEXER.toString()); order.put("oid", oid); return order; } private JsonObject newMessage(JsonSimple response, String target) {
@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(); }