use of org.sonatype.nexus.orient.entity.AttachedEntityMetadata in project nexus-public by sonatype.
the class ComponentEntityAdapter 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);
// prefetch any lazy/linked fields that the extensions want to capture
componentEntityAdapterExtensions.forEach(d -> d.prefetchFields(document));
switch(eventKind) {
case CREATE:
return new ComponentCreatedEvent(metadata, repositoryName);
case UPDATE:
return new ComponentUpdatedEvent(metadata, repositoryName);
case DELETE:
return new ComponentDeletedEvent(metadata, repositoryName);
default:
return null;
}
}
use of org.sonatype.nexus.orient.entity.AttachedEntityMetadata in project nexus-public by sonatype.
the class OrientKeyStoreDataEntityAdapter method newEvent.
@Nullable
@Override
public EntityEvent newEvent(final ODocument document, final EventKind eventKind) {
EntityMetadata metadata = new AttachedEntityMetadata(this, document);
String name = document.field(P_NAME);
EntityEvent event;
switch(eventKind) {
case CREATE:
event = new OrientKeyStoreDataCreatedEvent(metadata, name);
break;
case UPDATE:
event = new OrientKeyStoreDataUpdatedEvent(metadata, name);
break;
default:
event = null;
}
if (event != null) {
log.debug("Emitted {} event for key store {} with metadata {}", eventKind, name, metadata);
}
return event;
}
use of org.sonatype.nexus.orient.entity.AttachedEntityMetadata in project nexus-public by sonatype.
the class PurgeUnusedFacetImplTest method mockBucket.
private Bucket 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);
Bucket bucket = mock(Bucket.class);
when(bucket.getEntityMetadata()).thenReturn(entityMetadata);
return bucket;
}
use of org.sonatype.nexus.orient.entity.AttachedEntityMetadata in project nexus-public by sonatype.
the class OrientMetadataRebuilderTest method mockBucketEntityMetadata.
private static EntityMetadata mockBucketEntityMetadata() {
EntityAdapter owner = mock(EntityAdapter.class);
ODocument document = mock(ODocument.class);
when(document.getIdentity()).thenReturn(new ORecordId(1, 1));
return new AttachedEntityMetadata(owner, document);
}
Aggregations