Tabnine Logo
Content.maintainLastModified
Code IndexAdd Tabnine to your IDE (free)

How to use
maintainLastModified
method
in
org.sonatype.nexus.repository.view.Content

Best Java code snippets using org.sonatype.nexus.repository.view.Content.maintainLastModified (Showing top 12 results out of 315)

origin: org.sonatype.nexus.plugins/nexus-repository-maven

private void putAssetPayload(final StorageTx tx,
  final Asset asset,
  final AssetBlob assetBlob,
  @Nullable final AttributesMap contentAttributes)
  throws IOException
{
 tx.attachBlob(asset, assetBlob);
 Content.applyToAsset(asset, Content.maintainLastModified(asset, contentAttributes));
}
origin: org.sonatype.nexus.plugins/nexus-repository-npm

private void saveAsset(final StorageTx tx,
            final Asset asset,
            final AssetBlob assetBlob,
            final AssetKind kind,
            @Nullable final AttributesMap contentAttributes)
{
 asset.formatAttributes().set(P_ASSET_KIND, kind.name());
 tx.attachBlob(asset, assetBlob);
 Content.applyToAsset(asset, Content.maintainLastModified(asset, contentAttributes));
 tx.saveAsset(asset);
}
origin: org.sonatype.nexus.plugins/nexus-repository-npm

/**
 * Save repository root asset & create blob from an input stream.
 *
 * @return blob content
 */
@Nonnull
public static Content saveRepositoryRoot(final StorageTx tx,
                     final Asset asset,
                     final Supplier<InputStream> contentSupplier,
                     final Content content) throws IOException
{
 Content.applyToAsset(asset, Content.maintainLastModified(asset, content.getAttributes()));
 final AssetBlob assetBlob = storeContent(tx, asset, contentSupplier, AssetKind.REPOSITORY_ROOT);
 tx.saveAsset(asset);
 return toContent(asset, assetBlob.getBlob());
}
origin: org.sonatype.nexus.plugins/nexus-repository-npm

/**
 * Save repository root asset & create blob from a temporary blob.
 *
 * @return blob content
 */
@Nonnull
static Content saveRepositoryRoot(final StorageTx tx,
                 final Asset asset,
                 final TempBlob tempBlob,
                 final Content content) throws IOException
{
 Content.applyToAsset(asset, Content.maintainLastModified(asset, content.getAttributes()));
 AssetBlob assetBlob = storeContent(tx, asset, tempBlob, AssetKind.REPOSITORY_ROOT);
 tx.saveAsset(asset);
 return toContent(asset, assetBlob.getBlob());
}
origin: org.sonatype.nexus.plugins/nexus-repository-raw

@Override
@TransactionalStoreBlob
public Asset put(final String path, final AssetBlob assetBlob, @Nullable final AttributesMap contentAttributes) {
 StorageTx tx = UnitOfWork.currentTx();
 Asset asset = getOrCreateAsset(getRepository(), path, RawCoordinatesHelper.getGroup(path), path);
 tx.attachBlob(asset, assetBlob);
 Content.applyToAsset(asset, Content.maintainLastModified(asset, contentAttributes));
 tx.saveAsset(asset);
 return asset;
}
origin: sonatype-nexus-community/nexus-repository-helm

/**
 * Save an asset and create blob.
 *
 * @return blob content
 */
public Content saveAsset(final StorageTx tx,
             final Asset asset,
             final Supplier<InputStream> contentSupplier,
             final String contentType,
             @Nullable final AttributesMap contentAttributes) throws IOException
{
 Content.applyToAsset(asset, Content.maintainLastModified(asset, contentAttributes));
 AssetBlob assetBlob = tx.setBlob(
   asset, asset.name(), contentSupplier, HASH_ALGORITHMS, null, contentType, false
 );
 asset.markAsDownloaded();
 tx.saveAsset(asset);
 return toContent(asset, assetBlob.getBlob());
}
origin: org.sonatype.nexus.plugins/nexus-repository-npm

@TransactionalStoreBlob
protected Asset savePackageRootToCache(final NpmPackageId packageId, final NestedAttributesMap result) throws IOException {
 StorageTx tx = UnitOfWork.currentTx();
 Asset asset = getAsset(tx, packageId);
 AttributesMap contentAttributes = maintainLastModified(asset, null);
 maintainCacheInfo(contentAttributes);
 applyToAsset(asset, contentAttributes);
 savePackageRoot(tx, asset, result);
 return asset;
}
origin: org.sonatype.nexus.plugins/nexus-repository-raw

@TransactionalStoreBlob
protected Content doPutContent(final String path, final TempBlob tempBlob, final Payload payload)
  throws IOException
{
 StorageTx tx = UnitOfWork.currentTx();
 Asset asset = getOrCreateAsset(getRepository(), path, RawCoordinatesHelper.getGroup(path), path);
 AttributesMap contentAttributes = null;
 if (payload instanceof Content) {
  contentAttributes = ((Content) payload).getAttributes();
 }
 Content.applyToAsset(asset, Content.maintainLastModified(asset, contentAttributes));
 AssetBlob assetBlob = tx.setBlob(
   asset,
   path,
   tempBlob,
   null,
   payload.getContentType(),
   false
 );
 tx.saveAsset(asset);
 return toContent(asset, assetBlob.getBlob());
}
origin: sonatype-nexus-community/nexus-repository-composer

@TransactionalStoreBlob
protected Content doPutMetadata(final String path,
                final TempBlob tempBlob,
                final Payload payload,
                final AssetKind assetKind)
  throws IOException
{
 StorageTx tx = UnitOfWork.currentTx();
 Asset asset = getOrCreateAsset(path);
 asset.formatAttributes().set(P_ASSET_KIND, assetKind.toString());
 if (payload instanceof Content) {
  Content.applyToAsset(asset, Content.maintainLastModified(asset, ((Content) payload).getAttributes()));
 }
 AssetBlob assetBlob = tx.setBlob(
   asset,
   path,
   tempBlob,
   null,
   payload.getContentType(),
   false
 );
 tx.saveAsset(asset);
 return toContent(asset, assetBlob.getBlob());
}
origin: org.sonatype.nexus.plugins/nexus-repository-npm

@TransactionalStoreBlob
protected Content doPutPackageRoot(final NpmPackageId packageId,
                  final NestedAttributesMap packageRoot,
                  final Content content,
                  final boolean mergePackageRoot) throws IOException
{
 log.debug("Storing package: {}", packageId);
 StorageTx tx = UnitOfWork.currentTx();
 Bucket bucket = tx.findBucket(getRepository());
 NestedAttributesMap newPackageRoot =  packageRoot;
   
 Asset asset = NpmFacetUtils.findPackageRootAsset(tx, bucket, packageId);
 if (asset == null) {
  asset = tx.createAsset(bucket, getRepository().getFormat()).name(packageId.id());
 }
 else if (mergePackageRoot) {
  newPackageRoot = mergeNewRootWithExistingRoot(tx, newPackageRoot, asset);
 }
 
 Content.applyToAsset(asset, Content.maintainLastModified(asset, content.getAttributes()));
 NpmFacetUtils.savePackageRoot(tx, asset, newPackageRoot);
 // we must have the round-trip to equip record with _rev rewrite the URLs (ret val is served to client)
 NestedAttributesMap storedPackageRoot = NpmFacetUtils.loadPackageRoot(tx, asset);
 NpmMetadataUtils.rewriteTarballUrl(getRepository().getName(), storedPackageRoot);
 return NpmFacetUtils.toContent(asset, storedPackageRoot);
}
origin: sonatype-nexus-community/nexus-repository-composer

Content.applyToAsset(asset, Content.maintainLastModified(asset, ((Content) payload).getAttributes()));
origin: sonatype-nexus-community/nexus-repository-apt

@Override
@TransactionalStoreBlob
public Content put(String path, Payload content) throws IOException {
 StorageFacet storageFacet = facet(StorageFacet.class);
 try (final TempBlob tembBlob = storageFacet.createTempBlob(content, FacetHelper.hashAlgorithms)) {
  StorageTx tx = UnitOfWork.currentTx();
  Bucket bucket = tx.findBucket(getRepository());
  Asset asset = tx.findAssetWithProperty(P_NAME, path, bucket);
  if (asset == null) {
   asset = tx.createAsset(bucket, getRepository().getFormat()).name(path);
  }
  AttributesMap contentAttributes = null;
  if (content instanceof Content) {
   contentAttributes = ((Content) content).getAttributes();
  }
  Content.applyToAsset(asset, Content.maintainLastModified(asset, contentAttributes));
  AssetBlob blob = tx.setBlob(
    asset,
    path,
    tembBlob,
    FacetHelper.hashAlgorithms,
    null,
    content.getContentType(),
    false);
  tx.saveAsset(asset);
  return FacetHelper.toContent(asset, blob.getBlob());
 }
}
org.sonatype.nexus.repository.viewContentmaintainLastModified

Javadoc

Maintains the "last modified" attribute of the content by setting it to "now". It accepts nulls, and the returned instance will have changes applied. Never returns null.

Popular methods of Content

  • <init>
  • getAttributes
  • applyToAsset
    Applies non-format specific content attributes onto passed in Asset from passed in AttributesMap(usu
  • extractFromAsset
    Extracts non-format specific content attributes into the passed in AttributesMap (usually originatin
  • findAsset
    Finds fresh Asset instance from passed in TX by entity ID of the Asset used to create passed in Cont
  • openInputStream
  • getContentType
  • close
  • getSize

Popular in Java

  • Start an intent from android
  • getSupportFragmentManager (FragmentActivity)
  • startActivity (Activity)
  • getSharedPreferences (Context)
  • Graphics2D (java.awt)
    This Graphics2D class extends the Graphics class to provide more sophisticated control overgraphics
  • InputStream (java.io)
    A readable source of bytes.Most clients will use input streams that read data from the file system (
  • SimpleDateFormat (java.text)
    Formats and parses dates in a locale-sensitive manner. Formatting turns a Date into a String, and pa
  • SSLHandshakeException (javax.net.ssl)
    The exception that is thrown when a handshake could not be completed successfully.
  • JTextField (javax.swing)
  • Join (org.hibernate.mapping)
  • Top 12 Jupyter Notebook extensions
Tabnine Logo
  • Products

    Search for Java codeSearch for JavaScript code
  • IDE Plugins

    IntelliJ IDEAWebStormVisual StudioAndroid StudioEclipseVisual Studio CodePyCharmSublime TextPhpStormVimGoLandRubyMineEmacsJupyter NotebookJupyter LabRiderDataGripAppCode
  • Company

    About UsContact UsCareers
  • Resources

    FAQBlogTabnine AcademyTerms of usePrivacy policyJava Code IndexJavascript Code Index
Get Tabnine for your IDE now