Search in sources :

Example 6 with EndPoint

use of org.bimserver.endpoints.EndPoint in project BIMserver by opensourceBIM.

the class NotificationRegistryServiceImpl method registerChangeProgressOnProject.

@Override
public void registerChangeProgressOnProject(Long endPointId, Long poid) throws ServerException, UserException {
    if (endPointId == null) {
        throw new UserException("No endpoint given");
    }
    ChangeProgressTopicOnProjectTopic changeProgressOnProjectTopic = getBimServer().getNotificationsManager().getChangeProgressOnProjectTopic(poid);
    EndPoint endPoint = getEndPoint(endPointId);
    try {
        changeProgressOnProjectTopic.register(endPoint);
    } catch (TopicRegisterException e) {
        handleException(e);
    }
}
Also used : TopicRegisterException(org.bimserver.notifications.TopicRegisterException) UserException(org.bimserver.shared.exceptions.UserException) EndPoint(org.bimserver.endpoints.EndPoint) ChangeProgressTopicOnProjectTopic(org.bimserver.notifications.ChangeProgressTopicOnProjectTopic)

Example 7 with EndPoint

use of org.bimserver.endpoints.EndPoint in project BIMserver by opensourceBIM.

the class NotificationRegistryServiceImpl method unregisterProgressHandler.

@Override
public void unregisterProgressHandler(Long topicId, Long endPointId) throws UserException, ServerException {
    EndPoint endPoint = getEndPoint(endPointId);
    ProgressTopic progressTopic = getBimServer().getNotificationsManager().getProgressTopic(topicId);
    if (progressTopic == null) {
        throw new UserException("Topic with id " + topicId + " not found");
    }
    try {
        progressTopic.unregister(endPoint);
    } catch (TopicRegisterException e) {
        handleException(e);
    }
}
Also used : ProgressTopic(org.bimserver.notifications.ProgressTopic) TopicRegisterException(org.bimserver.notifications.TopicRegisterException) EndPoint(org.bimserver.endpoints.EndPoint) UserException(org.bimserver.shared.exceptions.UserException)

Example 8 with EndPoint

use of org.bimserver.endpoints.EndPoint in project BIMserver by opensourceBIM.

the class NotificationRegistryServiceImpl method registerChangeProgressOnRevision.

@Override
public void registerChangeProgressOnRevision(Long endPointId, Long poid, Long roid) throws ServerException, UserException {
    ChangeProgressTopicOnRevisionTopic changeProgressOnProjectTopic = getBimServer().getNotificationsManager().getChangeProgressOnRevisionTopic(poid, roid);
    EndPoint endPoint = getEndPoint(endPointId);
    try {
        changeProgressOnProjectTopic.register(endPoint);
    } catch (TopicRegisterException e) {
        handleException(e);
    }
}
Also used : TopicRegisterException(org.bimserver.notifications.TopicRegisterException) ChangeProgressTopicOnRevisionTopic(org.bimserver.notifications.ChangeProgressTopicOnRevisionTopic) EndPoint(org.bimserver.endpoints.EndPoint)

Example 9 with EndPoint

use of org.bimserver.endpoints.EndPoint in project BIMserver by opensourceBIM.

the class NotificationRegistryServiceImpl method registerProgressHandler.

@Override
public void registerProgressHandler(Long topicId, Long endPointId) throws UserException {
    if (endPointId == null) {
        throw new UserException("No EndpointId given");
    }
    EndPoint endPoint = getEndPoint(endPointId);
    if (endPoint == null) {
        throw new UserException("Endpoint with id " + endPointId + " not found");
    }
    ProgressTopic progressTopic = getBimServer().getNotificationsManager().getProgressTopic(topicId);
    if (progressTopic == null) {
        throw new UserException("Topic with id " + topicId + " not found");
    }
    try {
        progressTopic.register(endPoint);
        LongActionState lastProgress = progressTopic.getLastProgress();
        if (lastProgress != null && lastProgress.getState() == ActionState.FINISHED) {
            LoggerFactory.getLogger(NotificationRegistryInterface.class).debug("Sending update directly for topic " + progressTopic.getKey().getId());
        // TODO!!
        // progressTopic.stageProgressUpdate(ate, title)updateProgress(lastProgress);
        } else {
            LoggerFactory.getLogger(NotificationRegistryInterface.class).debug("NOT Sending update directly for topic " + progressTopic.getKey().getId());
        }
    } catch (TopicRegisterException e) {
        throw new UserException(e);
    }
}
Also used : ProgressTopic(org.bimserver.notifications.ProgressTopic) TopicRegisterException(org.bimserver.notifications.TopicRegisterException) SLongActionState(org.bimserver.interfaces.objects.SLongActionState) LongActionState(org.bimserver.models.store.LongActionState) UserException(org.bimserver.shared.exceptions.UserException) EndPoint(org.bimserver.endpoints.EndPoint) NotificationRegistryInterface(org.bimserver.shared.interfaces.NotificationRegistryInterface)

Example 10 with EndPoint

use of org.bimserver.endpoints.EndPoint in project BIMserver by opensourceBIM.

the class NotificationRegistryServiceImpl method unregisterChangeProgressOnProject.

@Override
public void unregisterChangeProgressOnProject(Long endPointId, Long poid) throws ServerException, UserException {
    ChangeProgressTopicOnProjectTopic changeProgressOnProjectTopic = getBimServer().getNotificationsManager().getChangeProgressOnProjectTopic(poid);
    EndPoint endPoint = getEndPoint(endPointId);
    try {
        changeProgressOnProjectTopic.unregister(endPoint);
    } catch (TopicRegisterException e) {
        handleException(e);
    }
}
Also used : TopicRegisterException(org.bimserver.notifications.TopicRegisterException) EndPoint(org.bimserver.endpoints.EndPoint) ChangeProgressTopicOnProjectTopic(org.bimserver.notifications.ChangeProgressTopicOnProjectTopic)

Aggregations

EndPoint (org.bimserver.endpoints.EndPoint)12 TopicRegisterException (org.bimserver.notifications.TopicRegisterException)11 UserException (org.bimserver.shared.exceptions.UserException)4 ChangeProgressTopicOnProjectTopic (org.bimserver.notifications.ChangeProgressTopicOnProjectTopic)2 ChangeProgressTopicOnRevisionTopic (org.bimserver.notifications.ChangeProgressTopicOnRevisionTopic)2 ChangeProgressTopicOnServerTopic (org.bimserver.notifications.ChangeProgressTopicOnServerTopic)2 ProgressTopic (org.bimserver.notifications.ProgressTopic)2 BimserverDatabaseException (org.bimserver.BimserverDatabaseException)1 SConverter (org.bimserver.interfaces.SConverter)1 SLongActionState (org.bimserver.interfaces.objects.SLongActionState)1 LongActionState (org.bimserver.models.store.LongActionState)1 NewExtendedDataOnRevisionTopic (org.bimserver.notifications.NewExtendedDataOnRevisionTopic)1 NewExtendedDataOnRevisionTopicKey (org.bimserver.notifications.NewExtendedDataOnRevisionTopicKey)1 NewRevisionOnSpecificProjectTopic (org.bimserver.notifications.NewRevisionOnSpecificProjectTopic)1 NewRevisionOnSpecificProjectTopicKey (org.bimserver.notifications.NewRevisionOnSpecificProjectTopicKey)1 NewRevisionTopic (org.bimserver.notifications.NewRevisionTopic)1 ServerException (org.bimserver.shared.exceptions.ServerException)1 NotificationRegistryInterface (org.bimserver.shared.interfaces.NotificationRegistryInterface)1