Codota Logo
Content.maintainLastModified
Code IndexAdd Codota 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)

  • Common ways to obtain Content
private void myMethod () {
Content c =
  • Codota IconBlob blob;Asset asset;new Content(new BlobPayload(blob, asset.requireContentType()))
  • Smart code suggestions by Codota
}
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

  • Reading from database using SQL prepared statement
  • scheduleAtFixedRate (ScheduledExecutorService)
  • getSharedPreferences (Context)
  • startActivity (Activity)
  • Pointer (com.sun.jna)
    An abstraction for a native pointer data type. A Pointer instance represents, on the Java side, a na
  • PrintStream (java.io)
    A PrintStream adds functionality to another output stream, namely the ability to print representatio
  • Runnable (java.lang)
    Represents a command that can be executed. Often used to run code in a different Thread.
  • MessageFormat (java.text)
    MessageFormat provides a means to produce concatenated messages in language-neutral way. Use this to
  • Deque (java.util)
    A linear collection that supports element insertion and removal at both ends. The name deque is shor
  • Loader (org.hibernate.loader)
    Abstract superclass of object loading (and querying) strategies. This class implements useful common
Codota Logo
  • Products

    Search for Java codeSearch for JavaScript codeEnterprise
  • IDE Plugins

    IntelliJ IDEAWebStormAndroid StudioEclipseVisual Studio CodePyCharmSublime TextPhpStormVimAtomGoLandRubyMineEmacsJupyter
  • Company

    About UsContact UsCareers
  • Resources

    FAQBlogCodota Academy Plugin user guide Terms of usePrivacy policyJava Code IndexJavascript Code Index
Get Codota for your IDE now