Search in sources :

Example 6 with AttachedEntityMetadata

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

the class PurgeUnusedSnapshotsFacetImplTest method mockBucket.

private void mockBucket() {
    EntityAdapter owner = mock(EntityAdapter.class);
    ODocument document = mock(ODocument.class);
    ORID orID = new ORecordId(1, 1);
    when(document.getIdentity()).thenReturn(orID);
    EntityMetadata entityMetadata = new AttachedEntityMetadata(owner, document);
    when(bucket.getEntityMetadata()).thenReturn(entityMetadata);
}
Also used : AttachedEntityMetadata(org.sonatype.nexus.orient.entity.AttachedEntityMetadata) EntityMetadata(org.sonatype.nexus.common.entity.EntityMetadata) EntityAdapter(org.sonatype.nexus.orient.entity.EntityAdapter) BucketEntityAdapter(org.sonatype.nexus.repository.storage.BucketEntityAdapter) ComponentEntityAdapter(org.sonatype.nexus.repository.storage.ComponentEntityAdapter) AttachedEntityMetadata(org.sonatype.nexus.orient.entity.AttachedEntityMetadata) ORID(com.orientechnologies.orient.core.id.ORID) ORecordId(com.orientechnologies.orient.core.id.ORecordId) ODocument(com.orientechnologies.orient.core.record.impl.ODocument)

Example 7 with AttachedEntityMetadata

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

the class OrientAnonymousConfigurationEntityAdapter method newEvent.

@Override
@Nullable
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 OrientAnonymousConfigurationCreatedEvent(metadata);
        case UPDATE:
            return new OrientAnonymousConfigurationUpdatedEvent(metadata);
        case DELETE:
            return new OrientAnonymousConfigurationDeletedEvent(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 8 with AttachedEntityMetadata

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

the class OrientRealmConfigurationEntityAdapter method newEvent.

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

Example 9 with AttachedEntityMetadata

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

the class OrientEmailConfigurationEntityAdapter 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 OrientEmailConfigurationCreatedEvent(metadata);
        case UPDATE:
            return new OrientEmailConfigurationUpdatedEvent(metadata);
        case DELETE:
            return new OrientEmailConfigurationDeletedEvent(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 10 with AttachedEntityMetadata

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

the class OrientRoutingRuleEntityAdapter method newEvent.

@Nullable
@Override
public EntityEvent newEvent(final ODocument document, final EventKind eventKind) {
    final EntityMetadata metadata = new AttachedEntityMetadata(this, document);
    log.trace("newEvent: eventKind: {}, metadata: {}", eventKind, metadata);
    switch(eventKind) {
        case UPDATE:
            return new OrientRoutingRuleUpdatedEvent(metadata);
        case DELETE:
            return new OrientRoutingRuleDeletedEvent(metadata);
        default:
            return super.newEvent(document, eventKind);
    }
}
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)

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