@Override public UUID getUuid() { String encodedUuid = getElementContent(UUID_ELEMENT_NAME, element); return Helpers.uuidFromBase64(encodedUuid); }
@Override public UUID read(InputNode inputNode) throws Exception { String value = inputNode.getValue(); if (value == null || value.equals("")) { return UUID.randomUUID(); } return Helpers.uuidFromBase64(value); }
@Override public UUID getUuid() { return Helpers.uuidFromBase64(DomHelper.getElementContent(DomHelper.UUID_ELEMENT_NAME, element)); }
@Override public boolean isRecycleBin() { String UUIDcontent = getElementContent(RECYCLE_BIN_UUID_ELEMENT_NAME, database.dbMeta); if (UUIDcontent != null){ UUID uuid = Helpers.uuidFromBase64(UUIDcontent); return uuid.equals(this.getUuid()); } return false; }
@Override public DomGroupWrapper getRecycleBin() { String UUIDcontent = getElementContent(RECYCLE_BIN_UUID_ELEMENT_NAME, dbMeta); if (UUIDcontent != null){ final UUID uuid = Helpers.uuidFromBase64(UUIDcontent); if (uuid.getLeastSignificantBits() != 0 && uuid.getMostSignificantBits() != 0) { for (DomGroupWrapper g: getRootGroup().getGroups()) { if (g.getUuid().equals(uuid)) { return g; } } // the recycle bin seems to have been lost, better create another one } // uuid was 0 i.e. there isn't one } // no recycle bin group set up if (!isRecycleBinEnabled()) { return null; } DomGroupWrapper g = newGroup(); g.setName("Recycle Bin"); getRootGroup().addGroup(g); ensureElementContent(RECYCLE_BIN_UUID_ELEMENT_NAME, dbMeta, base64FromUuid(g.getUuid())); touchElement(RECYCLE_BIN_CHANGED_ELEMENT_NAME, dbMeta); return g; }