/** * Joins the strings in {@code joinees}, separated by {@code joiner}. * * For example, {@code list} contains the strings {@code "a"}, {@code "b"}, * and {@code "c"}. To combine these strings as "a/b/c", use * {@code join("/", list)}. * * @param joiner The string to use as the delimiter between each element. * @param joinees The array of strings to join. * @return The combined strings in {@code joinees} separated by the * {@code joiner} delimiter. */ public static String join(String joiner, String[] joinees) { return join(joiner, Arrays.asList(joinees)); }
/** * Sets the values for the specified field name, with the assumption that * the value delimiter is a comma (,). * * @param key The field name. * @param values The delimited set of values. */ void putArray(String key, String[] values) { arrayValues.put(key, values); // For backward compatibility with the Map interface super.put(key, Util.join(",", values)); }
/** * Sets the regular expressions (regexes) that are compared to registry * event types for this Windows Registry input. Only types that match * at least one regex are monitored. * * @param regexes An array of regex strings for event types. */ public void setType(String[] regexes) { String val = Util.join("|", regexes); setCacheValue("type", val); }
/** * Sets the list of slaves that are members of this license pool. * * @param slaves The array of slaves. To accept all slaves, use an * array with a single asterisk element ("*"). */ public void setSlaves(String[] slaves) { setSlaves(Util.join(",", slaves)); } }
@Override JsonElement toJson() { JsonObject root = new JsonObject(); addCommonFields(root); root.add("attributeName", new JsonPrimitive(this.getAttributeName())); root.add("attributeOwner", new JsonPrimitive(Util.join(".", this.getAttributeOwnerLineage()))); if (sortDirection == SortDirection.ASCENDING) { root.add("limitType", new JsonPrimitive("lowest")); } else if (sortDirection == SortDirection.DESCENDING) { root.add("limitType", new JsonPrimitive("highest")); } root.add("limitAmount", new JsonPrimitive(this.limit)); root.add("statsFn", new JsonPrimitive(this.statsFunction.toString())); return root; } }
/** * Add keys common to all row splits to a JSON serialization. * * @param obj JSON serialization to modify. */ protected void addCommonFields(JsonObject obj) { DataModelField field = this.dataModelObject.getField(this.fieldName); obj.addProperty("fieldName", this.fieldName); obj.addProperty("owner", Util.join(".", field.getOwnerLineage())); obj.addProperty("type", field.getType().toString()); obj.addProperty("label", this.label); }
/** * @return a JSON serialization of this object. */ JsonObject toJson() { JsonObject root = new JsonObject(); DataModelField f = this.dataModelObject.getField(fieldName); root.addProperty("fieldName", this.fieldName); root.addProperty("owner", Util.join(".", f.getOwnerLineage())); root.addProperty("type", f.getType().toString()); root.addProperty("label", this.label); root.addProperty("sparkline", false); // Not properly implemented in core yet. root.addProperty("value", this.statsFunction.toString()); return root; } }
protected void addCommonFields(JsonObject obj) { DataModelField field = this.owner.getField(this.fieldName); obj.addProperty("fieldName", this.fieldName); obj.addProperty("owner", Util.join(".", field.getOwnerLineage())); obj.addProperty("type", field.getType().toString()); }
/** * Called by subclasses to add the fields common to all subclasses to JSON serializations. * * @param root a JsonObject instance representing a serialization of this object. */ protected void addCommonFields(JsonObject root) { root.addProperty("fieldName", this.fieldName); root.addProperty("owner", Util.join(".", this.dataModelObject.getField(fieldName).getOwnerLineage())); root.addProperty("type", this.getType().toString()); } }
/** * {@inheritDoc} */ @Override public void update() { // If not present in the update keys, add required attributes as long // as one pre-existing update pair exists if (toUpdate.size() > 0 && !toUpdate.containsKey("baseline")) { setCacheValue("baseline", getBaseline()); } if (toUpdate.size() > 0 && !toUpdate.containsKey("hive")) { setCacheValue("hive", getHive()); } if (toUpdate.size() > 0 && !toUpdate.containsKey("proc")) { setCacheValue("proc", getProc()); } if (toUpdate.size() > 0 && !toUpdate.containsKey("type")) { setCacheValue("type", Util.join("|", getType())); } super.update(); } }
/** * {@inheritDoc} */ @Override public void update(Map<String, Object> args) { // Add required arguments if not already present if (!args.containsKey("baseline")) { args = Args.create(args).add("baseline", getBaseline()); } if (!args.containsKey("hive")) { args = Args.create(args).add("hive", getHive()); } if (!args.containsKey("proc")) { args = Args.create(args).add("proc", getProc()); } if (!args.containsKey("type")) { args = Args.create(args).add("type", Util.join("|", getType())); } super.update(args); }