Asserts the process instance with the provided id is active, i.e. the process instance is not ended.

@param processInstanceId
the process instance's id to check for. May not be <code>null</code>
506115
public static final void assertProcessActive(final String processInstanceId) {
        Validate.notNull(processInstanceId);

        apiCallback.debug(LogMessage.PROCESS_1, processInstanceId);
        try {
            getProcessInstanceAssertable().processIsActive(processInstanceId);
        } catch (final AssertionError ae) {
            apiCallback.fail(ae, LogMessage.ERROR_PROCESS_1, processInstanceId);
        }
    }
508433
func (s *GetCurrentMetricDataInput) SetInstanceId(v string) *GetCurrentMetricDataInput {
	s.InstanceId = &v
	return s
}
332592
func (s *RecordLifecycleActionHeartbeatInput) SetInstanceId(v string) *RecordLifecycleActionHeartbeatInput {
	s.InstanceId = &v
	return s
}
393613
@Override
    public ProcessInstanceLog findProcessInstance(long processInstanceId) {
        EntityManager em = getEntityManager();
        Object newTx = joinTransaction(em);
        try {
        	return (ProcessInstanceLog) em
        	        .createQuery("FROM ProcessInstanceLog p WHERE p.processInstanceId = :processInstanceId")
        	        .setParameter("processInstanceId", processInstanceId).getSingleResult();
        } catch (NoResultException e) {
        	return null;
        } finally {
        	closeEntityManager(em, newTx);
        }
    }
1269670
func (s *UnassignInstanceInput) SetInstanceId(v string) *UnassignInstanceInput {
	s.InstanceId = &v
	return s
}
1240197
public static ProcessUtil getInstance() {

    if (instance == null) {
      synchronized (ProcessUtilImpl.class) {
        if (instance == null) {
          ProcessUtilImpl util = new ProcessUtilImpl();
          util.initialize();
          instance = util;
        }
      }
    }
    return instance;
  }
455371
def is_instance_running(self, instance_id):
        
        self._init_az_api()
        # Here, it's always better if we update the instance.
        vm = self._get_vm(instance_id, force_reload=True)
        # FIXME: should we rather check `vm.instance_view.statuses`
        # and search for `.code == "PowerState/running"`? or
        # `vm.instance_view.vm_agent.statuses` and search for `.code
        # == 'ProvisioningState/suceeded'`?
        return vm.provisioning_state == u'Succeeded'
859543
private ArrayList<ProcessInstance> getProcessInstances(Long process_id) {
        String getProInstances = "select * from PROCESS_INSTANCE where process_id=? and END_DT is null and (status_cd=7 or status_cd=2)"; // Workstatus 2,7

        DatabaseAccess db = new DatabaseAccess(null);
        final ArrayList<ProcessInstance> processVoList = new ArrayList<ProcessInstance>();
        try {
            db.openConnection();
            Object[] args = new Object[1];
            args[0] = process_id;

            ResultSet rs = db.runSelect(getProInstances, args);
            while (rs.next()) {
                ProcessInstance processInstVO = new ProcessInstance();
                processInstVO.setId(rs.getLong(1));
                processInstVO.setProcessId(rs.getLong(2));
                processInstVO.setStartDate(StringHelper.dateToString(rs.getTimestamp(8)));
                processInstVO.setOwnerId(rs.getLong(4));
                processInstVO.setMasterRequestId(rs.getString(15));
                processInstVO.setActivities(getProcessInstanceActivity(rs.getLong(1)));
                processVoList.add(processInstVO);
            }
        }
        catch (SQLException ex) {
            logger.severeException(ex.getMessage(), ex);
        }
        finally {
            db.closeConnection();
        }

        return processVoList;
    }
672831
@Override
    public List<VariableInstanceLog> findVariableInstances(long processInstanceId) {
        EntityManager em = getEntityManager();
        Query query = em
            .createQuery("FROM VariableInstanceLog v WHERE v.processInstanceId = :processInstanceId ORDER BY date")
                .setParameter("processInstanceId", processInstanceId);
        return executeQuery(query, em, VariableInstanceLog.class);
    }
255935
public List<TaskSummary> getTasksByStatusByProcessInstanceId(
			long processInstanceId, List<Status> status, String language) {
		return executor.execute(new GetTasksByStatusByProcessInstanceIdCommand(processInstanceId, status));
	}
623463
@Override
    public InstanceInfo getInstanceByAppAndId(String appName, String id) {
        return this.getInstanceByAppAndId(appName, id, true);
    }
581901
public void removeEventWaitForActivityInstance(Long activityInstanceId, String reason) throws SQLException {
        String query = "delete from EVENT_WAIT_INSTANCE where EVENT_WAIT_INSTANCE_OWNER_ID=?";
        db.runUpdate(query, activityInstanceId);
        this.recordEventHistory("All Events", EventLog.SUBCAT_DEREGISTER,
                OwnerType.ACTIVITY_INSTANCE, activityInstanceId, reason);
        if (db.isMySQL())  //Commit since JMS message to resume activity was already sent, in case next activity to notify causes deadlock
            db.commit();
    }
467503
func (s *GetCommandInvocationOutput) SetInstanceId(v string) *GetCommandInvocationOutput {
	s.InstanceId = &v
	return s
}
270827
public static Long getProcessInstanceId(Command<?> command) {
		if (command instanceof ProcessInstanceIdCommand) {
			return ((ProcessInstanceIdCommand) command).getProcessInstanceId();
		} 

        return null;
		
	}
834354
@Override
    public List<ProcessInstanceLog> findSubProcessInstances(long processInstanceId) {
        EntityManager em = getEntityManager();
        Query query = em
            .createQuery("FROM ProcessInstanceLog p WHERE p.parentProcessInstanceId = :processInstanceId")
                .setParameter("processInstanceId", processInstanceId);
        return executeQuery(query, em, ProcessInstanceLog.class);
    }
264314
public void fireBeforeCaseCancelled(String caseId, CaseFileInstance caseFile, List<Long> processInstanceIds) {
        final Iterator<CaseEventListener> iter = getEventListenersIterator();

        if (iter.hasNext()) {
            final CaseCancelEvent event = new CaseCancelEvent(identityProvider.getName(), caseId, caseFile, processInstanceIds);

            do{
                iter.next().beforeCaseCancelled(event);
            } while (iter.hasNext());
        }
    }
1186992
@Transactional
	public ProcessInstance launch(String processName, Object context, String comment,
			String bundleName, ProcessInstance processInstance) {
		ProcessDefinition processDefinition = getProcessDefinition(processName);
		if (processDefinition == null) {
			throw new WorkflowException("Failed to find process definition named "+processName);
		}
		Object mergedContext = getContextDAO().mergeContext(context);
		processInstance.setComment(comment==null?" ":comment);
		processInstance.setBundleName(bundleName);
		processInstance.setObjectInstance(getContextDAO().createContextDescriptor(mergedContext));
		if (!ContextUtils.getContextClass(processInstance.getObjectInstance()).equals(mergedContext.getClass())) {
			throw new WorkflowException("Context object does not match process context in "+processName);
		}
		processDefinition.startProcess(processInstance);

		ProcessInstance processInstanceRet = getWorkflowDAO().mergeProcessInstance(processInstance);
		getWorkflowDAO().flush();
		return processInstanceRet;
	}