public Metadata encodeMetadata() { Metadata meta = new Metadata(); meta.put(FN_START, mStart.getDateTimePartString(false)); if (mHasEnd) meta.put(FN_END, mEnd.getDateTimePartString(false)); else meta.put(FN_DURATION, mDuration); return meta; }
private static String getEncodedMetadata(ScheduledTask task) { boolean hasProperties = false; Metadata metadata = new Metadata(); Set<String> keys = task.getPropertyNames(); for (String key : keys) { hasProperties = true; metadata.put(key, task.getProperty(key)); } if (!hasProperties) { return null; } return metadata.toString(); }