use of org.sonatype.nexus.common.collect.AttributesMap in project nexus-repository-r by sonatype-nexus-community.
the class RRestoreFacetImpl method restore.
@Override
@TransactionalTouchBlob
public void restore(final AssetBlob assetBlob, final String path) throws IOException {
StorageTx tx = UnitOfWork.currentTx();
RFacet facet = facet(RFacet.class);
Asset asset;
if (componentRequired(path)) {
Map<String, String> attributes;
try (InputStream is = assetBlob.getBlob().getInputStream()) {
attributes = extractDescriptionFromArchive(path, is);
}
Component component = facet.findOrCreateComponent(tx, path, attributes);
asset = facet.findOrCreateAsset(tx, component, path, attributes);
} else {
asset = facet.findOrCreateAsset(tx, path);
}
tx.attachBlob(asset, assetBlob);
Content.applyToAsset(asset, Content.maintainLastModified(asset, new AttributesMap()));
tx.saveAsset(asset);
}
Aggregations