use of edu.stanford.bmir.protege.web.shared.watches.Watch in project webprotege by protegeproject.
the class SetEntityWatchesActionHandler method execute.
@Nonnull
@Override
public SetEntityWatchesResult execute(@Nonnull SetEntityWatchesAction action, @Nonnull ExecutionContext executionContext) {
EventTag startTag = eventManager.getCurrentTag();
UserId userId = action.getUserId();
Set<Watch> watches = watchManager.getDirectWatches(action.getEntity(), userId);
for (Watch watch : watches) {
watchManager.removeWatch(watch);
}
for (Watch watch : action.getWatches()) {
watchManager.addWatch(watch);
}
return new SetEntityWatchesResult(eventManager.getEventsFromTag(startTag));
}
use of edu.stanford.bmir.protege.web.shared.watches.Watch in project webprotege by protegeproject.
the class WatchedChangesManager method getProjectChangesForWatches.
public ImmutableList<ProjectChange> getProjectChangesForWatches(Set<Watch> watches) {
Set<OWLEntity> superEntities = new HashSet<>();
Set<OWLEntity> directWatches = new HashSet<>();
for (Watch watch : watches) {
if (watch.getType() == BRANCH) {
OWLEntity entity = watch.getEntity();
superEntities.add(entity);
directWatches.add(entity);
} else {
directWatches.add(watch.getEntity());
}
}
if (superEntities.isEmpty() && directWatches.isEmpty()) {
return ImmutableList.of();
}
ImmutableList.Builder<ProjectChange> result = ImmutableList.builder();
List<Revision> revisionsCopy = changeManager.getRevisions();
for (Revision revision : revisionsCopy) {
for (OWLEntity watchedEntity : getWatchedEntities(superEntities, directWatches, revision)) {
ImmutableList<ProjectChange> changes = projectChangesManager.getProjectChangesForSubjectInRevision(watchedEntity, revision);
result.addAll(changes);
}
}
return result.build();
}
Aggregations