use of org.jkiss.dbeaver.model.struct.DBSObjectState in project dbeaver by serge-rider.
the class JobRunHandler method runJob.
public static boolean runJob(DBRProgressMonitor monitor, DBCCompileLog compileLog, OracleSchedulerJob job) throws DBCException {
final DBEPersistAction[] compileActions = job.getRunActions();
if (ArrayUtils.isEmpty(compileActions)) {
return true;
}
try (JDBCSession session = DBUtils.openUtilSession(monitor, job, "Run '" + job.getName() + "'")) {
boolean success = true;
for (DBEPersistAction action : compileActions) {
final String script = action.getScript();
compileLog.trace(script);
if (monitor.isCanceled()) {
break;
}
try {
try (DBCStatement dbStat = session.prepareStatement(DBCStatementType.SCRIPT, script, false, false, false)) {
action.beforeExecute(session);
dbStat.executeStatement();
}
action.afterExecute(session, null);
} catch (DBCException e) {
action.afterExecute(session, e);
throw e;
}
if (action instanceof OracleObjectPersistAction) {
if (!logObjectErrors(session, compileLog, job, ((OracleObjectPersistAction) action).getObjectType())) {
success = false;
}
}
}
final DBSObjectState oldState = job.getObjectState();
job.refreshObjectState(monitor);
if (job.getObjectState() != oldState) {
job.getDataSource().getContainer().fireEvent(new DBPEvent(DBPEvent.Action.OBJECT_UPDATE, job));
}
return success;
}
}
Aggregations