Search in sources :

Example 1 with ProgressNotification

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()));
    }
}
Also used : GregorianCalendar(java.util.GregorianCalendar) ProgressNotification(org.bimserver.notifications.ProgressNotification) ActionState(org.bimserver.models.store.ActionState) LongActionState(org.bimserver.models.store.LongActionState)

Example 2 with ProgressNotification

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()));
    }
}
Also used : ProgressNotification(org.bimserver.notifications.ProgressNotification)

Example 3 with ProgressNotification

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();
}
Also used : ProgressNotification(org.bimserver.notifications.ProgressNotification)

Example 4 with ProgressNotification

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();
    }
}
Also used : BimserverDatabaseException(org.bimserver.BimserverDatabaseException) ProgressTopic(org.bimserver.notifications.ProgressTopic) DatabaseSession(org.bimserver.database.DatabaseSession) ProgressNotification(org.bimserver.notifications.ProgressNotification)

Aggregations

ProgressNotification (org.bimserver.notifications.ProgressNotification)4 GregorianCalendar (java.util.GregorianCalendar)1 BimserverDatabaseException (org.bimserver.BimserverDatabaseException)1 DatabaseSession (org.bimserver.database.DatabaseSession)1 ActionState (org.bimserver.models.store.ActionState)1 LongActionState (org.bimserver.models.store.LongActionState)1 ProgressTopic (org.bimserver.notifications.ProgressTopic)1