@Test public void testNameBlobDigest() { DefaultBlobDispatcher dispatcher = dispatcherWith("blob:digest=foo"); Blob blob = mock(Blob.class); when(blob.getDigest()).thenReturn("bar"); assertEquals(DEFAULT, dispatcher.getProviderId(null, blob, null)); when(blob.getDigest()).thenReturn("foo"); assertEquals(CUSTOM, dispatcher.getProviderId(null, blob, null)); }
protected String getProviderId(Document doc, Blob blob, String blobXPath) { if (useRepositoryName) { return doc.getRepositoryName(); } NEXT_RULE: for (Rule rule : rules) { for (Clause clause : rule.clauses) { Object value; try { value = getValue(doc, blob, blobXPath, clause); } catch (PropertyNotFoundException e) { continue NEXT_RULE; } value = convert(value); if (!match(value, clause)) { continue NEXT_RULE; } } return rule.providerId; } return defaultProviderId; }
DefaultBlobDispatcher implements BlobDispatcher { protected String getProviderId(Document doc, Blob blob, String blobXPath) { if (useRepositoryName) { return doc.getRepositoryName(); } NEXT_RULE: for (Rule rule : rules) { for (Clause clause : rule.clauses) { Object value; try { value = getValue(doc, blob, blobXPath, clause); } catch (PropertyNotFoundException e) { continue NEXT_RULE; } value = convert(value); if (!match(value, clause)) { continue NEXT_RULE; } } return rule.providerId; } return defaultProviderId; } }
DefaultBlobDispatcher implements BlobDispatcher { protected String getProviderId(Document doc, Blob blob, String blobXPath) { if (useRepositoryName) { return doc.getRepositoryName(); } NEXT_RULE: for (Rule rule : rules) { for (Clause clause : rule.clauses) { Object value; try { value = getValue(doc, blob, blobXPath, clause); } catch (PropertyNotFoundException e) { continue NEXT_RULE; } value = convert(value); if (!match(value, clause)) { continue NEXT_RULE; } } return rule.providerId; } return defaultProviderId; }  }
DefaultBlobDispatcher implements BlobDispatcher { protected String getProviderId(Document doc, Blob blob, String blobXPath) { if (useRepositoryName) { return doc.getRepositoryName(); } NEXT_RULE: for (Rule rule : rules) { for (Clause clause : rule.clauses) { Object value; try { value = getValue(doc, blob, blobXPath, clause); } catch (PropertyNotFoundException e) { continue NEXT_RULE; } value = convert(value); if (!match(value, clause)) { continue NEXT_RULE; } } return rule.providerId; } return defaultProviderId; }  @Override void initialize(Map<String, String> properties); @Override Collection<String> getBlobProviderIds(); @Override String getBlobProvider(String repositoryName); @Override BlobDispatch getBlobProvider(Document doc, Blob blob, String xpath); @Override void notifyChanges(Document doc, Set<String> xpaths); @Override void notifyMakeRecord(Document doc); @Override void notifyAfterCopy(Document doc); @Override void notifyBeforeRemove(Document doc); }
DefaultBlobDispatcher implements BlobDispatcher { protected String getProviderId(Document doc, Blob blob, String blobXPath) { if (useRepositoryName) { return doc.getRepositoryName(); } NEXT_RULE: for (Rule rule : rules) { for (Clause clause : rule.clauses) { Object value; try { value = getValue(doc, blob, blobXPath, clause); } catch (PropertyNotFoundException e) { continue NEXT_RULE; } value = convert(value); if (!match(value, clause)) { continue NEXT_RULE; } } return rule.providerId; } return defaultProviderId; }  @Override void initialize(Map<String, String> properties); @Override Collection<String> getBlobProviderIds(); @Override String getBlobProvider(String repositoryName); @Override BlobDispatch getBlobProvider(Document doc, Blob blob, String xpath); @Override void notifyChanges(Document doc, Set<String> xpaths); @Override void notifyMakeRecord(Document doc); @Override void notifyAfterCopy(Document doc); @Override void notifyBeforeRemove(Document doc);  }