Search in sources :

Example 1 with BackupDataEvent

use of org.marvec.pusher.data.BackupDataEvent in project engine by Lumeer.

the class AbstractContextualTask method createEventForView.

private Event createEventForView(final View view, final String userId, final String suffix) {
    final String projectId = daoContextSnapshot.getSelectedWorkspace().getProject().map(Project::getId).orElse("");
    final View mappedView = viewAdapter.mapViewData(getDaoContextSnapshot().getOrganization(), getDaoContextSnapshot().getProject(), view.copy(), userId, projectId);
    final PusherFacade.ObjectWithParent message = new PusherFacade.ObjectWithParent(getAppId(), mappedView, getDaoContextSnapshot().getOrganizationId(), getDaoContextSnapshot().getProjectId());
    injectCorrelationId(message);
    return new BackupDataEvent(PusherFacade.PRIVATE_CHANNEL_PREFIX + userId, View.class.getSimpleName() + suffix, message, getResourceId(mappedView, null), null);
}
Also used : BackupDataEvent(org.marvec.pusher.data.BackupDataEvent) PusherFacade(io.lumeer.core.facade.PusherFacade) View(io.lumeer.api.model.View)

Example 2 with BackupDataEvent

use of org.marvec.pusher.data.BackupDataEvent in project engine by Lumeer.

the class AbstractContextualTask method createEventForDocument.

private Event createEventForDocument(final Document document, final String userId, final String suffix) {
    final String projectId = daoContextSnapshot.getSelectedWorkspace().getProject().map(Project::getId).orElse("");
    final Document mappedDocument = documentAdapter.mapDocumentData(new Document(document), userId, projectId);
    if (PusherFacade.REMOVE_EVENT_SUFFIX.equals(suffix)) {
        return createEventForRemove(Document.class.getSimpleName(), getResourceId(mappedDocument, mappedDocument.getCollectionId()), userId);
    }
    final PusherFacade.ObjectWithParent message = new PusherFacade.ObjectWithParent(getAppId(), mappedDocument, getDaoContextSnapshot().getOrganizationId(), getDaoContextSnapshot().getProjectId());
    injectCorrelationId(message);
    return new BackupDataEvent(PusherFacade.PRIVATE_CHANNEL_PREFIX + userId, Document.class.getSimpleName() + suffix, message, getResourceId(mappedDocument, mappedDocument.getCollectionId()), null);
}
Also used : BackupDataEvent(org.marvec.pusher.data.BackupDataEvent) PusherFacade(io.lumeer.core.facade.PusherFacade) Document(io.lumeer.api.model.Document)

Example 3 with BackupDataEvent

use of org.marvec.pusher.data.BackupDataEvent in project engine by Lumeer.

the class AbstractContextualTask method createEventForCollection.

private Event createEventForCollection(final Collection collection, final String userId, final String suffix) {
    final String projectId = daoContextSnapshot.getSelectedWorkspace().getProject().map(Project::getId).orElse("");
    final Collection mappedCollection = collectionAdapter.mapCollectionComputedProperties(collection.copy(), userId, projectId);
    final PusherFacade.ObjectWithParent message = new PusherFacade.ObjectWithParent(getAppId(), mappedCollection, getDaoContextSnapshot().getOrganizationId(), getDaoContextSnapshot().getProjectId());
    injectCorrelationId(message);
    return new BackupDataEvent(PusherFacade.PRIVATE_CHANNEL_PREFIX + userId, Collection.class.getSimpleName() + suffix, message, getResourceId(mappedCollection, null), null);
}
Also used : BackupDataEvent(org.marvec.pusher.data.BackupDataEvent) PusherFacade(io.lumeer.core.facade.PusherFacade) Collection(io.lumeer.api.model.Collection)

Aggregations

PusherFacade (io.lumeer.core.facade.PusherFacade)3 BackupDataEvent (org.marvec.pusher.data.BackupDataEvent)3 Collection (io.lumeer.api.model.Collection)1 Document (io.lumeer.api.model.Document)1 View (io.lumeer.api.model.View)1