Java Code Examples for org.apache.sqoop.model.MJob#setLastUpdateDate()
The following examples show how to use
org.apache.sqoop.model.MJob#setLastUpdateDate() .
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: JobBean.java From sqoop-on-spark with Apache License 2.0 | 5 votes |
private MJob restoreJob(Object obj) { JSONObject object = (JSONObject) obj; long fromConnectorId = (Long) object.get(FROM_CONNECTOR_ID); long toConnectorId = (Long) object.get(TO_CONNECTOR_ID); long fromConnectionId = (Long) object.get(FROM_LINK_ID); long toConnectionId = (Long) object.get(TO_LINK_ID); JSONArray fromConfigJson = (JSONArray) object.get(FROM_CONFIG_VALUES); JSONArray toConfigJson = (JSONArray) object.get(TO_CONFIG_VALUES); JSONArray driverConfigJson = (JSONArray) object.get(DRIVER_CONFIG_VALUES); List<MConfig> fromConfig = restoreConfigList(fromConfigJson); List<MConfig> toConfig = restoreConfigList(toConfigJson); List<MConfig> driverConfig = restoreConfigList(driverConfigJson); MJob job = new MJob( fromConnectorId, toConnectorId, fromConnectionId, toConnectionId, new MFromConfig(fromConfig), new MToConfig(toConfig), new MDriverConfig(driverConfig) ); job.setPersistenceId((Long) object.get(ID)); job.setName((String) object.get(NAME)); job.setEnabled((Boolean) object.get(ENABLED)); job.setCreationUser((String) object.get(CREATION_USER)); job.setCreationDate(new Date((Long) object.get(CREATION_DATE))); job.setLastUpdateUser((String) object.get(UPDATE_USER)); job.setLastUpdateDate(new Date((Long) object.get(UPDATE_DATE))); return job; }
Example 2
Source File: BeanTestUtil.java From sqoop-on-spark with Apache License 2.0 | 5 votes |
public static MJob createJob(String connectorName, String jobName, Long jobId, Date created, Date updated) { MJob job = BeanTestUtil.getJob(connectorName); job.setName(jobName); job.setPersistenceId(jobId); job.setCreationDate(created); job.setLastUpdateDate(updated); job.setEnabled(false); return job; }
Example 3
Source File: CommonRepositoryHandler.java From sqoop-on-spark with Apache License 2.0 | 4 votes |
private List<MJob> loadJobs(PreparedStatement stmt, Connection conn) throws SQLException { List<MJob> jobs = new ArrayList<MJob>(); ResultSet rsJob = null; PreparedStatement fromConfigFetchStmt = null; PreparedStatement toConfigFetchStmt = null; PreparedStatement driverConfigfetchStmt = null; PreparedStatement jobInputFetchStmt = null; try { rsJob = stmt.executeQuery(); // Note: Job does not hold a explicit reference to the driver since every // job has the same driver long driverId = this.findDriver(MDriver.DRIVER_NAME, conn).getPersistenceId(); fromConfigFetchStmt = conn.prepareStatement(crudQueries.getStmtSelectConfigForConfigurable()); toConfigFetchStmt = conn.prepareStatement(crudQueries.getStmtSelectConfigForConfigurable()); driverConfigfetchStmt = conn.prepareStatement(crudQueries.getStmtSelectConfigForConfigurable()); jobInputFetchStmt = conn.prepareStatement(crudQueries.getStmtFetchJobInput()); while(rsJob.next()) { long fromConnectorId = rsJob.getLong(1); long toConnectorId = rsJob.getLong(2); long id = rsJob.getLong(3); String name = rsJob.getString(4); long fromLinkId = rsJob.getLong(5); long toLinkId = rsJob.getLong(6); boolean enabled = rsJob.getBoolean(7); String createBy = rsJob.getString(8); Date creationDate = rsJob.getTimestamp(9); String updateBy = rsJob.getString(10); Date lastUpdateDate = rsJob.getTimestamp(11); fromConfigFetchStmt.setLong(1, fromConnectorId); toConfigFetchStmt.setLong(1,toConnectorId); driverConfigfetchStmt.setLong(1, driverId); jobInputFetchStmt.setLong(1, id); jobInputFetchStmt.setLong(3, id); // FROM entity configs List<MConfig> fromConnectorLinkConfig = new ArrayList<MConfig>(); List<MConfig> fromConnectorFromJobConfig = new ArrayList<MConfig>(); List<MConfig> fromConnectorToJobConfig = new ArrayList<MConfig>(); loadConnectorConfigs(fromConnectorLinkConfig, fromConnectorFromJobConfig, fromConnectorToJobConfig, fromConfigFetchStmt, jobInputFetchStmt, 2, conn); // TO entity configs List<MConfig> toConnectorLinkConfig = new ArrayList<MConfig>(); List<MConfig> toConnectorFromJobConfig = new ArrayList<MConfig>(); List<MConfig> toConnectorToJobConfig = new ArrayList<MConfig>(); List<MConfig> driverConfig = new ArrayList<MConfig>(); loadConnectorConfigs(toConnectorLinkConfig, toConnectorFromJobConfig, toConnectorToJobConfig, toConfigFetchStmt, jobInputFetchStmt, 2, conn); loadDriverConfigs(driverConfig, driverConfigfetchStmt, jobInputFetchStmt, 2, conn); MJob job = new MJob( fromConnectorId, toConnectorId, fromLinkId, toLinkId, new MFromConfig(fromConnectorFromJobConfig), new MToConfig(toConnectorToJobConfig), new MDriverConfig(driverConfig)); job.setPersistenceId(id); job.setName(name); job.setCreationUser(createBy); job.setCreationDate(creationDate); job.setLastUpdateUser(updateBy); job.setLastUpdateDate(lastUpdateDate); job.setEnabled(enabled); jobs.add(job); } } finally { closeResultSets(rsJob); closeStatements(fromConfigFetchStmt, toConfigFetchStmt, driverConfigfetchStmt, jobInputFetchStmt); } return jobs; }