/** @return The :ID: or :ORIGINAL_ID: field of the payload. */ public String getNodeId() { preparePayload(); String id = payload.getId(); if (id == null) return constructOlpId(); return id; }
/** * This function prepares the payload field of this class. It will try to replace payloads of * agenda items with the real value of the original node. We have to do this to guarantee that * agenda items will have the full payload and that those payload can be edited correctly. */ private void preparePayload() { if (this.payload != null) { return; } if (this.cursor == null) { this.payload = new NodePayload(""); return; } String result = cursor.getString(cursor.getColumnIndex("payload")); if (result == null) { this.payload = new NodePayload(""); return; } this.payload = new NodePayload(result); if (!this.getFileName().equals("agendas.org")) return; String orgId = payload.getId(); if (orgId == null || orgId.startsWith("olp:")) { return; } if (result.indexOf(":ORIGINAL_ID:") != -1) { String realPayload = db.getNodePayloadReal(orgId); if (realPayload == null) return; db.updateNodeField(this, "payload", realPayload); this.cursor = db.getNode(this.getId()); this.payload = new NodePayload(realPayload); return; } }