Skip to Content
0
Former Member
Apr 03, 2007 at 05:53 AM

Technical exception from CO using simple API

10 Views

I tried to use background execution callable object to dynamically modify GP due date, and I got the following exception when calling notifManager.updateNotification()

Error#1#/System/Server#Plain###

Technical exception from CO using simple API

#

Here are my code:

            // Instantiate the runtime and notification managers
            IGPRuntimeManager rtManager = GPProcessFactory.getRuntimeManager();
            logger.errorT("rtManager=" + rtManager);

            // instantiate notification manager
            IGPNotificationManager notifManager =
                GPProcessFactory.getNotificationManager();
            logger.errorT("notifManager=" + notifManager);

            // get process instance information
            IGPProcessInstance process =
                rtManager.getProcessInstance(
                    executionContext.getProcessId(),
                    executionContext.getInitiator());
            logger.errorT("process=" + process);

            // retrieve a single notification instance
            Enumeration notifications = process.getNotificationInstances();
            IGPNotificationInstance notification = null;
            logger.errorT("notification(s)=" + notifications);
            while (notifications.hasMoreElements()) {
                notification =
                    (IGPNotificationInstance) notifications.nextElement();
                logger.errorT("notification=" + notification);
            }

            String notifID = notification.getNotificationID();
            String activityID = notification.getActivityInstanceID();
            boolean dueDate = notification.isDueDateNotification();
            long createDate = notification.getCreationDate();
            IGPDeadline oldDeadline = notification.getDeadline();

            logger.errorT("notifID=" + notifID);
            logger.errorT("activityID=" + activityID);
            logger.errorT("dueDate=" + dueDate);
            logger.errorT("createDate=" + createDate);
            logger.errorT("oldDeadline=" + oldDeadline.toString());

            // create a duration of one hour
            IGPDuration duration =
                GPNotificationFactory.createDuration(
                    1,
                    IGPDuration.DURATION_HOUR);

            // create a deadline with duration one hour (start date is current system time)
            IGPDeadline newDeadline =
                GPNotificationFactory.createDeadline(
                    IGPDeadline.DEADLINE_FROM_PROCESS_START,
                    duration,
                    System.currentTimeMillis(),
                    0);
            logger.errorT("newDeadline=" + oldDeadline.toString());

            // update the status – cancel the notification
            notifManager.updateNotificationStatus(
                executionContext.getProcessId(),
                activityID,
                notifID,
                IGPNotificationInstance.NOTIFICATION_STATUS_CANCELLED);
            logger.errorT("updateNotificationStatus OK");

            notifManager.updateNotification(
                executionContext.getProcessId(),
                activityID,
                notifID,
                newDeadline);
            logger.errorT("updateNotification OK");

            executionContext.processingComplete();

In addition to that, is it possible to dynamically modify due dates set in action level? I've set due date on both process and action levels, but it seems the notification manager only retrieves notification instances in process level.

Thanks in advance!