use of com.ibm.jbatch.container.jobinstance.JobInstanceImpl in project Payara by payara.
the class PostgresPersistenceManager method createJobInstance.
/*
* (non-Javadoc)
*
* @see com.ibm.jbatch.container.services.IPersistenceManagerService#
* createJobInstance(java.lang.String, java.lang.String, java.lang.String,
* java.util.Properties)
*/
@Override
public JobInstance createJobInstance(String name, String apptag, String jobXml) {
Connection conn = null;
PreparedStatement statement = null;
ResultSet rs = null;
JobInstanceImpl jobInstance = null;
try {
conn = getConnection();
statement = conn.prepareStatement(queryStrings.get(CREATE_JOB_INSTANCE), statement.RETURN_GENERATED_KEYS);
statement.setString(1, name);
statement.setString(2, apptag);
statement.executeUpdate();
rs = statement.getGeneratedKeys();
if (rs.next()) {
long jobInstanceID = rs.getLong(1);
jobInstance = new JobInstanceImpl(jobInstanceID, jobXml);
jobInstance.setJobName(name);
}
} catch (SQLException e) {
throw new PersistenceException(e);
} finally {
cleanupConnection(conn, rs, statement);
}
return jobInstance;
}
use of com.ibm.jbatch.container.jobinstance.JobInstanceImpl in project Payara by payara.
the class HazelcastPersistenceService method createJobInstance.
@Override
public JobInstance createJobInstance(String name, String apptag, String jobXml) {
long id = jobInstanceIdGenerator.newId();
JobInstanceImpl result = new JobInstanceImpl(id);
return null;
}
use of com.ibm.jbatch.container.jobinstance.JobInstanceImpl in project Payara by payara.
the class JBatchJDBCPersistenceManager method createJobInstance.
/*
* (non-Javadoc)
*
* @see com.ibm.jbatch.container.services.IPersistenceManagerService#
* createJobInstance(java.lang.String, java.lang.String, java.lang.String,
* java.util.Properties)
*/
@Override
public JobInstance createJobInstance(String name, String apptag, String jobXml) {
Connection conn = null;
PreparedStatement statement = null;
ResultSet rs = null;
JobInstanceImpl jobInstance = null;
try {
conn = getConnection();
statement = conn.prepareStatement(queryStrings.get(CREATE_JOB_INSTANCE), new String[] { "JOBINSTANCEID" });
statement.setString(1, name);
statement.setString(2, apptag);
statement.executeUpdate();
rs = statement.getGeneratedKeys();
if (rs.next()) {
long jobInstanceID = rs.getLong(1);
jobInstance = new JobInstanceImpl(jobInstanceID, jobXml);
jobInstance.setJobName(name);
}
} catch (SQLException e) {
throw new PersistenceException(e);
} finally {
cleanupConnection(conn, rs, statement);
}
return jobInstance;
}
use of com.ibm.jbatch.container.jobinstance.JobInstanceImpl in project Payara by payara.
the class PostgresPersistenceManager method createSubJobInstance.
@Override
public JobInstance createSubJobInstance(String name, String apptag) {
Connection conn = null;
PreparedStatement statement = null;
ResultSet rs = null;
JobInstanceImpl jobInstance = null;
try {
conn = getConnection();
statement = conn.prepareStatement(queryStrings.get(CREATE_SUB_JOB_INSTANCE), statement.RETURN_GENERATED_KEYS);
statement.setString(1, name);
statement.setString(2, apptag);
statement.executeUpdate();
rs = statement.getGeneratedKeys();
if (rs.next()) {
long jobInstanceID = rs.getLong(1);
jobInstance = new JobInstanceImpl(jobInstanceID);
jobInstance.setJobName(name);
}
} catch (SQLException e) {
throw new PersistenceException(e);
} finally {
cleanupConnection(conn, rs, statement);
}
return jobInstance;
}
use of com.ibm.jbatch.container.jobinstance.JobInstanceImpl in project Payara by payara.
the class JBatchJDBCPersistenceManager method createSubJobInstance.
/*
* (non-Javadoc)
*
* @see com.ibm.jbatch.container.services.IPersistenceManagerService#
* createJobInstance(java.lang.String, java.lang.String, java.lang.String,
* java.util.Properties)
*/
@Override
public JobInstance createSubJobInstance(String name, String apptag) {
Connection conn = null;
PreparedStatement statement = null;
ResultSet rs = null;
JobInstanceImpl jobInstance = null;
try {
conn = getConnection();
statement = conn.prepareStatement(queryStrings.get(CREATE_SUB_JOB_INSTANCE), new String[] { "JOBINSTANCEID" });
statement.setString(1, name);
statement.setString(2, apptag);
statement.executeUpdate();
rs = statement.getGeneratedKeys();
if (rs.next()) {
long jobInstanceID = rs.getLong(1);
jobInstance = new JobInstanceImpl(jobInstanceID);
jobInstance.setJobName(name);
}
} catch (SQLException e) {
throw new PersistenceException(e);
} finally {
cleanupConnection(conn, rs, statement);
}
return jobInstance;
}
Aggregations