@Test public void testGetByteId() throws DecoderException { String id = "1234567890123456789012345678901234567890"; String superid = "aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa"; String extraid = "bbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbb"; assertEquals(id, Hex.encodeHexString(DeltaJournal.getByteId(id + "_id").get(0))); assertEquals(id, Hex.encodeHexString(DeltaJournal.getByteId(superid + "_id" + id + "_id").get(0))); assertEquals(superid, Hex.encodeHexString(DeltaJournal.getByteId(superid + "_id" + id + "_id").get(1))); assertEquals(superid, Hex.encodeHexString(DeltaJournal.getByteId(extraid + "_id" + superid + "_id" + id + "_id").get(1))); assertEquals(extraid, Hex.encodeHexString(DeltaJournal.getByteId(extraid + "_id" + superid + "_id" + id + "_id").get(2))); }
public static List<byte[]> getByteId(String id) { try { List<byte[]> result = new ArrayList<byte[]>(); int idLength = id.length(); if(idLength < 43) { LOG.error("Short ID encountered: {}", id); return Arrays.asList(id.getBytes()); } for(String idPart: id.split("_id")){ if(!idPart.isEmpty()){ idPart = idPart.replaceAll("[^\\p{XDigit}]", ""); result.add(0, Hex.decodeHex(idPart.toCharArray())); } } return result; } catch (DecoderException e) { LOG.error("Decoder exception while decoding {}", id, e); return Arrays.asList(id.getBytes()); } }
DeltaJournal implements InitializingBean { public static List<byte[]> getByteId(String id) { try { List<byte[]> result = new ArrayList<byte[]>(); int idLength = id.length(); if(idLength < 43) { LOG.error("Short ID encountered: {}", id); return Arrays.asList(id.getBytes()); } for(String idPart: id.split("_id")){ if(!idPart.isEmpty()){ idPart = idPart.replaceAll("[^\\p{XDigit}]", ""); result.add(0, Hex.decodeHex(idPart.toCharArray())); } } return result; } catch (DecoderException e) { LOG.error("Decoder exception while decoding {}", id, e); return Arrays.asList(id.getBytes()); } } }
DeltaJournal implements InitializingBean { public static List<byte[]> getByteId(String id) { try { List<byte[]> result = new ArrayList<byte[]>(); int idLength = id.length(); if(idLength < 43) { LOG.error("Short ID encountered: {}", id); return Arrays.asList(id.getBytes()); } for(String idPart: id.split("_id")){ if(!idPart.isEmpty()){ idPart = idPart.replaceAll("[^\\p{XDigit}]", ""); result.add(0, Hex.decodeHex(idPart.toCharArray())); } } return result; } catch (DecoderException e) { LOG.error("Decoder exception while decoding {}", id, e); return Arrays.asList(id.getBytes()); } }  }
DeltaJournal implements InitializingBean { public static List<byte[]> getByteId(String id) { try { List<byte[]> result = new ArrayList<byte[]>(); int idLength = id.length(); if(idLength < 43) { LOG.error("Short ID encountered: {}", id); return Arrays.asList(id.getBytes()); } for(String idPart: id.split("_id")){ if(!idPart.isEmpty()){ idPart = idPart.replaceAll("[^\\p{XDigit}]", ""); result.add(0, Hex.decodeHex(idPart.toCharArray())); } } return result; } catch (DecoderException e) { LOG.error("Decoder exception while decoding {}", id, e); return Arrays.asList(id.getBytes()); } }  @Override void afterPropertiesSet(); void journal(Collection<String> ids, String collection, boolean isDelete); static List<byte[]> getByteId(String id); static String getEntityId(Map<String, Object> deltaRecord); void journal(String id, String collection, boolean isDelete); void journalCollapsedSubDocs(Collection<String> ids, String collection); void journalPurge(long timeOfPurge); Iterator<Map<String, Object>> findDeltaRecordBetween(final long start, final long end); void removeDeltaJournals(String tenant, long cleanUptoTime); }
DeltaJournal implements InitializingBean { public static List<byte[]> getByteId(String id) { try { List<byte[]> result = new ArrayList<byte[]>(); int idLength = id.length(); if(idLength < 43) { LOG.error("Short ID encountered: {}", id); return Arrays.asList(id.getBytes()); } for(String idPart: id.split("_id")){ if(!idPart.isEmpty()){ idPart = idPart.replaceAll("[^\\p{XDigit}]", ""); result.add(0, Hex.decodeHex(idPart.toCharArray())); } } return result; } catch (DecoderException e) { LOG.error("Decoder exception while decoding {}", id, e); return Arrays.asList(id.getBytes()); } }  @Override void afterPropertiesSet(); void journal(Collection<String> ids, String collection, boolean isDelete); static List<byte[]> getByteId(String id); static String getEntityId(Map<String, Object> deltaRecord); void journal(String id, String collection, boolean isDelete); void journalCollapsedSubDocs(Collection<String> ids, String collection); void journalPurge(long timeOfPurge); Iterator<Map<String, Object>> findDeltaRecordBetween(final long start, final long end); void removeDeltaJournals(String tenant, long cleanUptoTime); static final String DELTA_COLLECTION; static final String PURGE; }