create activity FINISH, ABORT, RESUME, CORRECT, ERROR and any event type that can be specified in
designer configuration for events.

@param ai
@param eventType
@param masterRequestId
@param compCode
@return
323161
public static InternalEvent createActivityNotifyMessage(ActivityInstance ai,
            Integer eventType, String masterRequestId, String compCode) {
        InternalEvent event = new InternalEvent();
        event.workId = ai.getActivityId();
        event.transitionInstanceId = null;
        event.eventType = eventType;
        event.ownerType = OwnerType.PROCESS_INSTANCE;
        event.ownerId = ai.getProcessInstanceId();
        event.masterRequestId = masterRequestId;
        event.workInstanceId = ai.getId();
        event.completionCode = compCode;
        return event;
    }
68681
public void onClick(MenuItemClickEvent event) {
		FeatureTransaction featureTransaction = mapModel.getFeatureEditor().getFeatureTransaction();
		if (featureTransaction != null) {
			List<Activity> activities = new ArrayList<Activity>();
			activities.add(new ValidationActivity());
			activities.add(new CommitActivity());
			WorkflowProcessor processor = new SequenceProcessor(new MapModelWorkflowContext());
			processor.setDefaultErrorHandler(new WorkflowErrorHandler() {

				public void handleError(WorkflowContext context, Throwable throwable) {
					SC.warn(I18nProvider.getGlobal().saveEditingAborted() + throwable.getMessage());
				}
			});
			processor.setActivities(activities);
			processor.doActivities(mapModel);

			// Cleaning up duties: controller and MapWidget (if they're present)
			if (controller != null) {
				controller.cleanup();
			}
			if (mapWidget != null) {
				mapWidget.render(featureTransaction, RenderGroup.VECTOR, RenderStatus.DELETE);
			}
			mapModel.getFeatureEditor().stopEditing();
		}
	}
1026792
private Event newEvent(final String id, final Exception error) {
        return new EventFactorySupport().event(this, id, new LocalAttributeMap<>("error", error));
    }
539145
private void cmdCreateMappingActionPerformed(java.awt.event.ActionEvent evt) {// GEN-FIRST:event_cmdCreateMappingActionPerformed
		// Stop any editing action and save whatever in the text field
		if (!pnlPropertyEditorList.isEmpty() && pnlPropertyEditorList.isEditing()) {
			pnlPropertyEditorList.stopCellEditing();
		}
		try {
			// Prepare the mapping source
			String source = txtQueryEditor.getText();

			if (source.isEmpty()) {
				JOptionPane.showMessageDialog(this, "ERROR: The SQL source cannot be empty", "Error", JOptionPane.ERROR_MESSAGE);
				return;
			}
			String subjectTargetString = predicateSubjectMap.getTargetMapping();
			if(subjectTargetString.equals(":")){
				JOptionPane.showMessageDialog(this, "ERROR: Focus on URI cannot be empty", "Error", JOptionPane.ERROR_MESSAGE);
				return;
			}
			// Prepare the mapping target
			List<MapItem> predicateObjectMapsList = pnlPropertyEditorList.getPredicateObjectMapsList();
			ImmutableList<TargetAtom> target = prepareTargetQuery(predicateSubjectMap, predicateObjectMapsList);

			if (target.isEmpty()) {
				JOptionPane.showMessageDialog(this, "ERROR: The target cannot be empty. Add a class or a property", "Error", JOptionPane.ERROR_MESSAGE);
				return;
			}
			// Create the mapping axiom
			SQLPPTriplesMap mappingAxiom = new OntopNativeSQLPPTriplesMap(MAPPING_FACTORY.getSQLQuery(source), target);
			obdaModel.addTriplesMap(mappingAxiom, false);

			// Clear the form afterwards
			clearForm();
		} catch (DuplicateMappingException e) {
			DialogUtils.showQuickErrorDialog(null, e, "Duplicate mapping identification.");
			return;
		} catch (NullPointerException e) {
			DialogUtils.showQuickErrorDialog(null, new Exception("Data source has not been defined."));
			return;
		} catch (RuntimeException e) {
			DialogUtils.showQuickErrorDialog(null, e, "Empty property mapping.");
			return;
		}
	}
955556
public EventSubscriptionEntity createSubscriptionForExecution(ExecutionEntity execution) {
    EventSubscriptionEntity eventSubscriptionEntity = new EventSubscriptionEntity(execution, eventType);

    String eventName = resolveExpressionOfEventName(execution);
    eventSubscriptionEntity.setEventName(eventName);
    if (activityId != null) {
      ActivityImpl activity = execution.getProcessDefinition().findActivity(activityId);
      eventSubscriptionEntity.setActivity(activity);
    }

    eventSubscriptionEntity.insert();
    LegacyBehavior.removeLegacySubscriptionOnParent(execution, eventSubscriptionEntity);

    return eventSubscriptionEntity;
  }
1213125
private DevVarLongStringArray subcribeIDLInEventString(final String eventTypeAndIDL, final String deviceName,
                                                           final String objName) throws DevFailed {
        // event name like "idl5_archive" or "archive"
        String event = eventTypeAndIDL;
        int idlversion = EventManager.MINIMUM_IDL_VERSION;
        if (eventTypeAndIDL.contains(EventManager.IDL_LATEST)) {
            idlversion = DeviceImpl.SERVER_VERSION;
            event = eventTypeAndIDL.substring(eventTypeAndIDL.indexOf("_") + 1, eventTypeAndIDL.length());
        }
        final EventType eventType = EventType.getEvent(event);
        logger.debug("event subscription/confirmation for {}, attribute/pipe {} with type {} and IDL {}", new Object[]{
                deviceName, objName, eventType, idlversion});
        final Pair<PipeImpl, AttributeImpl> result = findSubscribers(eventType, deviceName, objName);
        return subscribeEvent(eventType, deviceName, idlversion, result.getRight(), result.getLeft());
    }
591804
def get_master_event(opts, sock_dir, listen=True, io_loop=None, raise_errors=False, keep_loop=False):
    '''
    
    '''
    # TODO: AIO core is separate from transport
    if opts['transport'] in ('zeromq', 'tcp', 'detect'):
        return MasterEvent(sock_dir, opts, listen=listen, io_loop=io_loop, raise_errors=raise_errors, keep_loop=keep_loop)
762790
private void cmdCancelOperationActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_cmdCancelOperationActionPerformed
		try {
			monitor.cancel();
		} 
		catch (Exception e) {
            OptionPaneUtils.showPrettyMessageDialog(null, e.getMessage(), "Error", JOptionPane.ERROR_MESSAGE);
		}
	}
548853
protected void processStop(Endpoint endpoint, EventTypeEnum eventType) {
        if (!sendLifecycleEvent) {
            return;
        }

        Event event = createEvent(endpoint, eventType);
        monitoringServiceClient.putEvents(Collections.singletonList(event));
        if (LOG.isLoggable(Level.INFO)) {
            LOG.info("Send " + eventType + " event to SAM Server successful!");
        }
    }
932072
public void setEventInstanceId(int v) {
    if (Event_Type.featOkTst && ((Event_Type)jcasType).casFeat_eventInstanceId == null)
      jcasType.jcas.throwFeatMissing("eventInstanceId", "de.unihd.dbs.uima.types.heideltime.Event");
    jcasType.ll_cas.ll_setIntValue(addr, ((Event_Type)jcasType).casFeatCode_eventInstanceId, v);}
1198478
public boolean addEventExecution(EventExecution eventExecution) {
        boolean added = executionDAO.addEventExecution(eventExecution);
        if (added) {
            indexDAO.addEventExecution(eventExecution);
        }
        return added;
    }
181918
@FFDCIgnore({WebApplicationException.class, IOException.class, NoSuitableMessageBodyWriterException.class})
    @Override
    public CompletionStage<?> send(OutboundSseEvent event) {
        final CompletableFuture<?> future = new CompletableFuture<>();

        if (!closed) {
            if (writer != null) {
                ByteArrayOutputStream os = null;
                try {
                    os = new ByteArrayOutputStream();
                    writer.writeTo(event, event.getClass(), null, new Annotation [] {}, event.getMediaType(), null, os);

                    String eventContents = os.toString();
                    if (TraceComponent.isAnyTracingEnabled() && tc.isDebugEnabled()) {
                        Tr.debug(tc, "send - sending " + eventContents);
                    }

                    if (!response.isCommitted()) {
                        response.setHeader("Content-Type", MediaType.SERVER_SENT_EVENTS);
                        response.flushBuffer();
                    }

                    //TODO: this seems like a bug, but most SSE clients seem to expect a named event
                    //      so for now, we will provide one if one is not provided by the user
                    if (event.getName() == null) {
                        response.getOutputStream().print("    UnnamedEvent\n");
                    }
                    response.getOutputStream().println(eventContents);
                    response.getOutputStream().flush();

                    return CompletableFuture.completedFuture(eventContents);
                } catch (NoSuitableMessageBodyWriterException ex) {
                    handleException(ex, future, event);
                    throw new IllegalArgumentException("No suitable message body writer for OutboundSseEvent created with data " + event.getData() + " and mediaType " + event.getMediaType() + ". The data contained within the OutboundSseEvent must match the mediaType."); 
                } catch (WebApplicationException ex) {
                    handleException(ex, future, event);
                } catch (IOException ex) {
                    handleException(ex, future, event);
                } finally {
                    if (os != null) {
                        try {
                            os.close();
                        } catch (IOException ex) {
                            //ignore
                        }
                    }
                }
            } else {  //no writer
                if (TraceComponent.isAnyTracingEnabled() && tc.isDebugEnabled()) {
                    Tr.debug(tc, "No MessageBodyWriter - returning null for event:  " + event);
                }
                future.complete(null);
            }  
        } else {
            if (TraceComponent.isAnyTracingEnabled() && tc.isDebugEnabled()) {
                Tr.debug(tc, "SseEventSink is closed - failed sending event:  " + event);
            }
            throw new IllegalStateException("SseEventSink is closed.");  
        }

        return future;
    }
991262
public void createAndEditNewElement(String contextId) {

        Runnable action = m_createFunctions.get(contextId);
        if (action != null) {
            action.run();
        } else {
            log("Could not execute create action for context id '" + contextId + "'");
        }
    }
855659
protected EventIdentificationType setEventIdentification(
            RFC3881EventOutcomeCodes outcome,
            RFC3881EventActionCodes action,
            CodedValueType id, CodedValueType[] type,
            List<CodedValueType> purposesOfUse) {
        EventIdentificationType eventBlock = new EventIdentificationType();

        eventBlock.setEventID(id);
        eventBlock.setEventDateTime(TimestampUtils.getRFC3881Timestamp(eventDateTime));
        if (!EventUtils.isEmptyOrNull(action)) {
            eventBlock.setEventActionCode(action.getCode());
        }
        if (!EventUtils.isEmptyOrNull(outcome)) {
            eventBlock.setEventOutcomeIndicator(outcome.getCode());
        }
        if (!EventUtils.isEmptyOrNull(type, true)) {
            eventBlock.getEventTypeCode().addAll(Arrays.asList(type));
        }
        eventBlock.setPurposesOfUse(purposesOfUse);

        getAuditMessage().setEventIdentification(eventBlock);

        return eventBlock;
    }
1151419
private void cmdExportResultActionPerformed(java.awt.event.ActionEvent evt) {// GEN-FIRST:event_buttonSaveResultsActionPerformed
		JFileChooser fileChooser = new JFileChooser(System.getProperty("user.dir"));
		fileChooser.setDialogTitle("Export to...");
		int response = fileChooser.showSaveDialog(this);
		if (response == JFileChooser.APPROVE_OPTION) {
			File targetFile = fileChooser.getSelectedFile();
			final String fileLocation = targetFile.getPath();
			if (canWrite(targetFile)) {
				Thread thread = new Thread() {
					public void run() {						
						getOBDASaveQueryToFileAction().run(fileLocation);
					}
				};
				thread.start();
			}
		}
	}
823497
function(eventType, activityId) {
      var attrsKey = this._event_attributes_key(eventType);
      return this._events.some(function (evt) {
          if (evt.eventType === eventType) {
             if (this.activityIdFor(evt[attrsKey].scheduledEventId) === activityId) {
                return true;
             }
          }
       }, this);
   }
791013
public void fireEntryCriteria(CmmnActivityExecution execution) {
    boolean manualActivation = evaluateManualActivationRule(execution);
    if (manualActivation) {
      execution.enable();

    } else {
      execution.start();
    }
  }