@Test public void maybeCreateFromUpdatedAssetCreatesForAssetWithContentAndNoExistingBrowseNode() { List<BrowsePaths> assetPath = toBrowsePaths(singletonList("asset")); Asset asset = createAsset("asset", "assetId", "otherFormat", null); EntityId assetId = asset.getEntityMetadata().getId(); when(browseNodeStore.assetNodeExists(asset)).thenReturn(false); when(defaultBrowseNodeGenerator.computeAssetPaths(asset, null)).thenReturn(assetPath); when(defaultBrowseNodeGenerator.computeComponentPaths(asset, null)).thenReturn(emptyList()); manager.maybeCreateFromUpdatedAsset(REPOSITORY_NAME, assetId, asset); verify(browseNodeStore).assetNodeExists(asset); verify(browseNodeStore) .createAssetNode(REPOSITORY_NAME, "otherFormat", toBrowsePaths(singletonList(asset.name())), asset); verifyNoMoreInteractions(browseNodeStore); }
public void maybeCreateFromUpdatedAsset(final String repositoryName, final EntityId assetId, final Asset asset) { checkNotNull(assetId); if (asset.blobRef() == null) { log.trace("asset {} has no content, not creating browse node", assetId); } else if (browseNodeStore.assetNodeExists(asset)) { log.trace("browse node already exists for {} on update", assetId); } else { log.trace("adding browse node for {} on update", assetId); createFromAsset(repositoryName, asset); } }
OrientBrowseNodeManager extends ComponentSupport { public void maybeCreateFromUpdatedAsset(final String repositoryName, final EntityId assetId, final Asset asset) { checkNotNull(assetId); if (asset.blobRef() == null) { log.trace("asset {} has no content, not creating browse node", assetId); } else if (browseNodeStore.assetNodeExists(asset)) { log.trace("browse node already exists for {} on update", assetId); } else { log.trace("adding browse node for {} on update", assetId); createFromAsset(repositoryName, asset); } } }
OrientBrowseNodeManager extends ComponentSupport { public void maybeCreateFromUpdatedAsset(final String repositoryName, final EntityId assetId, final Asset asset) { checkNotNull(assetId); if (asset.blobRef() == null) { log.trace("asset {} has no content, not creating browse node", assetId); } else if (browseNodeStore.assetNodeExists(asset)) { log.trace("browse node already exists for {} on update", assetId); } else { log.trace("adding browse node for {} on update", assetId); createFromAsset(repositoryName, asset); } } @Inject  OrientBrowseNodeManager(
      final OrientBrowseNodeStore browseNodeStore,
      final ComponentStore componentStore,
      final Map<String, BrowseNodeGenerator> pathGenerators); }
OrientBrowseNodeManager extends ComponentSupport { public void maybeCreateFromUpdatedAsset(final String repositoryName, final EntityId assetId, final Asset asset) { checkNotNull(assetId); if (asset.blobRef() == null) { log.trace("asset {} has no content, not creating browse node", assetId); } else if (browseNodeStore.assetNodeExists(asset)) { log.trace("browse node already exists for {} on update", assetId); } else { log.trace("adding browse node for {} on update", assetId); createFromAsset(repositoryName, asset); } } @Inject  OrientBrowseNodeManager(
      final OrientBrowseNodeStore browseNodeStore,
      final ComponentStore componentStore,
      final Map<String, BrowseNodeGenerator> pathGenerators); void createFromAsset(final String repositoryName, final Asset asset); void maybeCreateFromUpdatedAsset(final String repositoryName, final EntityId assetId, final Asset asset); void createFromAssets(final Repository repository, final Iterable<Asset> assets); void deleteAssetNode(final Asset asset); void deleteComponentNode(final Component component); void deleteByRepository(final String repositoryName); }
OrientBrowseNodeManager extends ComponentSupport { public void maybeCreateFromUpdatedAsset(final String repositoryName, final EntityId assetId, final Asset asset) { checkNotNull(assetId); if (asset.blobRef() == null) { log.trace("asset {} has no content, not creating browse node", assetId); } else if (browseNodeStore.assetNodeExists(asset)) { log.trace("browse node already exists for {} on update", assetId); } else { log.trace("adding browse node for {} on update", assetId); createFromAsset(repositoryName, asset); } } @Inject  OrientBrowseNodeManager(
      final OrientBrowseNodeStore browseNodeStore,
      final ComponentStore componentStore,
      final Map<String, BrowseNodeGenerator> pathGenerators); void createFromAsset(final String repositoryName, final Asset asset); void maybeCreateFromUpdatedAsset(final String repositoryName, final EntityId assetId, final Asset asset); void createFromAssets(final Repository repository, final Iterable<Asset> assets); void deleteAssetNode(final Asset asset); void deleteComponentNode(final Component component); void deleteByRepository(final String repositoryName);  }