use of org.activiti.engine.impl.util.json.JSONObject in project Activiti by Activiti.
the class TimerActivateProcessDefinitionHandler method execute.
public void execute(JobEntity job, String configuration, ExecutionEntity execution, CommandContext commandContext) {
JSONObject cfgJson = new JSONObject(configuration);
String processDefinitionId = job.getProcessDefinitionId();
boolean activateProcessInstances = getIncludeProcessInstances(cfgJson);
ActivateProcessDefinitionCmd activateProcessDefinitionCmd = new ActivateProcessDefinitionCmd(processDefinitionId, null, activateProcessInstances, null, job.getTenantId());
activateProcessDefinitionCmd.execute(commandContext);
}
use of org.activiti.engine.impl.util.json.JSONObject in project Activiti by Activiti.
the class TimerEventHandler method createConfiguration.
public static String createConfiguration(String id, Expression endDate, Expression calendarName) {
JSONObject cfgJson = new JSONObject();
cfgJson.put(PROPERTYNAME_TIMER_ACTIVITY_ID, id);
if (endDate != null) {
cfgJson.put(PROPERTYNAME_END_DATE_EXPRESSION, endDate.getExpressionText());
}
if (calendarName != null) {
cfgJson.put(PROPERTYNAME_CALENDAR_NAME_EXPRESSION, calendarName.getExpressionText());
}
return cfgJson.toString();
}
use of org.activiti.engine.impl.util.json.JSONObject in project Activiti by Activiti.
the class TimerEventHandler method setActivityIdToConfiguration.
public String setActivityIdToConfiguration(String jobHandlerConfiguration, String activityId) {
try {
JSONObject cfgJson = new JSONObject(jobHandlerConfiguration);
cfgJson.put(PROPERTYNAME_TIMER_ACTIVITY_ID, activityId);
return cfgJson.toString();
} catch (JSONException ex) {
return jobHandlerConfiguration;
}
}
use of org.activiti.engine.impl.util.json.JSONObject in project Activiti by Activiti.
the class TimerEventHandler method hasRealActivityId.
/**
* Before Activiti 5.21, the jobHandlerConfiguration would have as activityId the process definition key
* (as only one timer start event was supported). In >= 5.21, this changed and in >= 5.21 the activityId
* is the REAL activity id. It can be recognized by having the 'processDefinitionKey' in the configuration.
* A < 5.21 job would not have that.
*/
public static boolean hasRealActivityId(String jobHandlerConfiguration) {
try {
JSONObject cfgJson = new JSONObject(jobHandlerConfiguration);
Object processDefinitionKey = cfgJson.get(PROPERTYNAME_PROCESS_DEFINITION_KEY);
if (processDefinitionKey != null) {
return processDefinitionKey.toString().length() > 0;
}
} catch (JSONException ex) {
return false;
}
return false;
}
use of org.activiti.engine.impl.util.json.JSONObject in project Activiti by Activiti.
the class TimerEventHandler method setProcessDefinitionKeyToConfiguration.
public String setProcessDefinitionKeyToConfiguration(String jobHandlerConfiguration, String activityId) {
try {
JSONObject cfgJson = new JSONObject(jobHandlerConfiguration);
cfgJson.put(PROPERTYNAME_PROCESS_DEFINITION_KEY, activityId);
return cfgJson.toString();
} catch (JSONException ex) {
return jobHandlerConfiguration;
}
}
Aggregations