use of org.bimserver.notifications.ProgressNotification in project BIMserver by opensourceBIM.
the class LongAction method changeActionState.
protected void changeActionState(ActionState actiontState, String title, int progress) {
ActionState oldState = this.actionState;
if (actiontState == ActionState.FINISHED) {
stop = new GregorianCalendar();
}
int oldProgress = this.progress.get();
String oldTitle = this.title;
this.title = title;
this.progress.set(progress);
this.actionState = actiontState;
if (oldState != actiontState || progress != oldProgress || !oldTitle.equals(title)) {
if (title != null && oldTitle != null && !title.equals(oldTitle)) {
stage++;
}
bimServer.getNotificationsManager().notify(new ProgressNotification(bimServer, progressTopic, getState()));
}
}
use of org.bimserver.notifications.ProgressNotification in project BIMserver by opensourceBIM.
the class LongAction method updateProgress.
public void updateProgress(String title, int progress) {
int oldProgress = this.progress.get();
String oldTitle = this.title;
this.title = title;
this.progress.set(progress);
if (progress != oldProgress || !oldTitle.equals(title)) {
if (!title.equals(oldTitle)) {
stage++;
}
bimServer.getNotificationsManager().notify(new ProgressNotification(bimServer, progressTopic, getState()));
}
}
use of org.bimserver.notifications.ProgressNotification in project BIMserver by opensourceBIM.
the class LongAction method done.
protected void done() {
bimServer.getNotificationsManager().notify(new ProgressNotification(bimServer, progressTopic, getState()));
latch.countDown();
}
use of org.bimserver.notifications.ProgressNotification in project BIMserver by opensourceBIM.
the class NotificationRegistryServiceImpl method updateProgressTopic.
@Override
public void updateProgressTopic(Long topicId, SLongActionState state) throws UserException, ServerException {
DatabaseSession session = getBimServer().getDatabase().createSession();
try {
ProgressTopic topic = getBimServer().getNotificationsManager().getProgressTopic(topicId);
ProgressNotification progressNotification = new ProgressNotification(getBimServer(), topic, getBimServer().getSConverter().convertFromSObject(state));
getBimServer().getNotificationsManager().addToQueue(progressNotification);
} catch (BimserverDatabaseException e) {
handleException(e);
} finally {
session.close();
}
}
Aggregations