Search in sources :

Example 1 with AttachedEntityMetadata

use of org.sonatype.nexus.orient.entity.AttachedEntityMetadata in project nexus-public by sonatype.

the class OrientHttpClientConfigurationEntityAdapter method newEvent.

@Nullable
@Override
public EntityEvent newEvent(final ODocument document, final EventKind eventKind) {
    EntityMetadata metadata = new AttachedEntityMetadata(this, document);
    log.debug("Emitted {} event with metadata {}", eventKind, metadata);
    switch(eventKind) {
        case CREATE:
            return new OrientHttpClientConfigurationCreatedEvent(metadata);
        case UPDATE:
            return new OrientHttpClientConfigurationUpdatedEvent(metadata);
        case DELETE:
            return new OrientHttpClientConfigurationDeletedEvent(metadata);
        default:
            return null;
    }
}
Also used : EntityMetadata(org.sonatype.nexus.common.entity.EntityMetadata) AttachedEntityMetadata(org.sonatype.nexus.orient.entity.AttachedEntityMetadata) AttachedEntityMetadata(org.sonatype.nexus.orient.entity.AttachedEntityMetadata) Nullable(javax.annotation.Nullable)

Example 2 with AttachedEntityMetadata

use of org.sonatype.nexus.orient.entity.AttachedEntityMetadata in project nexus-public by sonatype.

the class OrientConfigurationEntityAdapter method newEvent.

@Nullable
@Override
public EntityEvent newEvent(final ODocument document, final EventKind eventKind) {
    final EntityMetadata metadata = new AttachedEntityMetadata(this, document);
    final String repositoryName = document.field(P_REPOSITORY_NAME);
    log.trace("newEvent: eventKind: {}, repositoryName: {}, metadata: {}", eventKind, repositoryName, metadata);
    switch(eventKind) {
        case CREATE:
            return new OrientConfigurationCreatedEvent(metadata, repositoryName);
        case UPDATE:
            return new OrientConfigurationUpdatedEvent(metadata, repositoryName);
        case DELETE:
            return new OrientConfigurationDeletedEvent(metadata, repositoryName);
        default:
            return null;
    }
}
Also used : EntityMetadata(org.sonatype.nexus.common.entity.EntityMetadata) AttachedEntityMetadata(org.sonatype.nexus.orient.entity.AttachedEntityMetadata) AttachedEntityMetadata(org.sonatype.nexus.orient.entity.AttachedEntityMetadata) Nullable(javax.annotation.Nullable)

Example 3 with AttachedEntityMetadata

use of org.sonatype.nexus.orient.entity.AttachedEntityMetadata in project nexus-public by sonatype.

the class OrientBlobStoreConfigurationEntityAdapter method newEvent.

@Nullable
@Override
public EntityEvent newEvent(final ODocument document, final EventKind eventKind) {
    final EntityMetadata metadata = new AttachedEntityMetadata(this, document);
    final String name = document.field(P_NAME);
    log.trace("newEvent: eventKind: {}, name: {}, metadata: {}", eventKind, name, metadata);
    switch(eventKind) {
        case CREATE:
            return new OrientBlobStoreConfigurationCreatedEvent(metadata, name);
        case UPDATE:
            return new OrientBlobStoreConfigurationUpdatedEvent(metadata, name);
        case DELETE:
            return new OrientBlobStoreConfigurationDeletedEvent(metadata, name);
        default:
            return null;
    }
}
Also used : EntityMetadata(org.sonatype.nexus.common.entity.EntityMetadata) AttachedEntityMetadata(org.sonatype.nexus.orient.entity.AttachedEntityMetadata) AttachedEntityMetadata(org.sonatype.nexus.orient.entity.AttachedEntityMetadata) Nullable(javax.annotation.Nullable)

Example 4 with AttachedEntityMetadata

use of org.sonatype.nexus.orient.entity.AttachedEntityMetadata in project nexus-public by sonatype.

the class AssetEntityAdapter method newEvent.

@Override
public EntityEvent newEvent(final ODocument document, final EventKind eventKind) {
    EntityMetadata metadata = new AttachedEntityMetadata(this, document);
    String repositoryName = ((ODocument) document.field(P_BUCKET)).field(P_REPOSITORY_NAME);
    ORID rid = document.field(P_COMPONENT, ORID.class);
    EntityId componentId = rid != null ? new AttachedEntityId(componentEntityAdapter, rid) : null;
    switch(eventKind) {
        case CREATE:
            return new AssetCreatedEvent(metadata, repositoryName, componentId);
        case UPDATE:
            return new AssetUpdatedEvent(metadata, repositoryName, componentId);
        case DELETE:
            return new AssetDeletedEvent(metadata, repositoryName, componentId);
        default:
            return null;
    }
}
Also used : EntityId(org.sonatype.nexus.common.entity.EntityId) AttachedEntityId(org.sonatype.nexus.orient.entity.AttachedEntityId) EntityMetadata(org.sonatype.nexus.common.entity.EntityMetadata) AttachedEntityMetadata(org.sonatype.nexus.orient.entity.AttachedEntityMetadata) AttachedEntityMetadata(org.sonatype.nexus.orient.entity.AttachedEntityMetadata) ORID(com.orientechnologies.orient.core.id.ORID) AttachedEntityId(org.sonatype.nexus.orient.entity.AttachedEntityId) ODocument(com.orientechnologies.orient.core.record.impl.ODocument)

Example 5 with AttachedEntityMetadata

use of org.sonatype.nexus.orient.entity.AttachedEntityMetadata in project nexus-public by sonatype.

the class BucketEntityAdapter method newEvent.

@Nullable
@Override
public EntityEvent newEvent(final ODocument document, final EventKind eventKind) {
    final EntityMetadata metadata = new AttachedEntityMetadata(this, document);
    final String repositoryName = document.field(P_REPOSITORY_NAME);
    log.debug("newEvent: eventKind: {}, repositoryName: {}, metadata: {}", eventKind, repositoryName, metadata);
    switch(eventKind) {
        case CREATE:
            return new BucketCreatedEvent(metadata, repositoryName);
        case UPDATE:
            return new BucketUpdatedEvent(metadata, repositoryName);
        case DELETE:
            return new BucketDeletedEvent(metadata, repositoryName);
        default:
            return null;
    }
}
Also used : BucketCreatedEvent(org.sonatype.nexus.repository.storage.internal.BucketCreatedEvent) BucketUpdatedEvent(org.sonatype.nexus.repository.storage.internal.BucketUpdatedEvent) BucketDeletedEvent(org.sonatype.nexus.repository.storage.internal.BucketDeletedEvent) EntityMetadata(org.sonatype.nexus.common.entity.EntityMetadata) AttachedEntityMetadata(org.sonatype.nexus.orient.entity.AttachedEntityMetadata) AttachedEntityMetadata(org.sonatype.nexus.orient.entity.AttachedEntityMetadata) Nullable(javax.annotation.Nullable)

Aggregations

AttachedEntityMetadata (org.sonatype.nexus.orient.entity.AttachedEntityMetadata)14 EntityMetadata (org.sonatype.nexus.common.entity.EntityMetadata)12 Nullable (javax.annotation.Nullable)8 ODocument (com.orientechnologies.orient.core.record.impl.ODocument)5 ORID (com.orientechnologies.orient.core.id.ORID)3 ORecordId (com.orientechnologies.orient.core.id.ORecordId)3 EntityAdapter (org.sonatype.nexus.orient.entity.EntityAdapter)3 ComponentEntityAdapter (org.sonatype.nexus.repository.storage.ComponentEntityAdapter)2 EntityEvent (org.sonatype.nexus.common.entity.EntityEvent)1 EntityId (org.sonatype.nexus.common.entity.EntityId)1 AttachedEntityId (org.sonatype.nexus.orient.entity.AttachedEntityId)1 Bucket (org.sonatype.nexus.repository.storage.Bucket)1 BucketEntityAdapter (org.sonatype.nexus.repository.storage.BucketEntityAdapter)1 BucketCreatedEvent (org.sonatype.nexus.repository.storage.internal.BucketCreatedEvent)1 BucketDeletedEvent (org.sonatype.nexus.repository.storage.internal.BucketDeletedEvent)1 BucketUpdatedEvent (org.sonatype.nexus.repository.storage.internal.BucketUpdatedEvent)1