public Response submitJobReturnResponse(String action, XJob job, String sessionHandleString) throws JAXBException, IOException, ParseException, DatatypeConfigurationException { MapBuilder map = new MapBuilder("sessionid", sessionHandleString); if (action != null) { map.put("action", action); } JAXBElement<XJob> xmlJob = new ObjectFactory().createJob(job); GenericEntity<JAXBElement<XJob>> entry = new GenericEntity<JAXBElement<XJob>>(xmlJob){}; Response response = this.exec("post", SCHEDULER_JOBS_URL, servLens, null, map, MediaType.APPLICATION_XML_TYPE, MediaType.APPLICATION_XML, entry); return response; }
/** * Update the XJob into the job table * * @param id * @param job * @param modifiedOn * @return the number of rows updated * @throws SQLException */ public int updateJob(String id, XJob job, long modifiedOn) throws SQLException { String updateSQL = "UPDATE " + JOB_TABLE + " SET " + COLUMN_JOB + "=?, " + COLUMN_MODIFIED_ON + "=? " + " WHERE " + COLUMN_ID + "=?"; JAXBElement<XJob> xmlJob = jobFactory.createJob(job); return runner.update(updateSQL, ToXMLString.toString(xmlJob), modifiedOn, id); }
/** * Inserts the Job info object into job table * * @param jobInfo * @return number of rows inserted. * @throws SQLException */ public int insertIntoJobTable(SchedulerJobInfo jobInfo) throws SQLException { String insertSQL = "INSERT INTO " + JOB_TABLE + " VALUES(?,?,?,?,?,?,?)"; JAXBElement<XJob> xmlJob = jobFactory.createJob(jobInfo.getJob()); return runner.update(insertSQL, jobInfo.getId().toString(), ToXMLString.toString(xmlJob), jobInfo.getUserName(), jobInfo.getJobState().name(), jobInfo.getCreatedOn(), jobInfo.getModifiedOn(), jobInfo.getJob().getName()); }
public LensAPIResult updateJob(XJob job, String jobHandle, String sessionHandleString) throws JAXBException, IOException, ParseException, DatatypeConfigurationException { MapBuilder map = new MapBuilder("sessionid", sessionHandleString); JAXBElement<XJob> xmlJob = new ObjectFactory().createJob(job); Response response = this.exec("put", SCHEDULER_JOBS_URL + "/" + jobHandle, servLens, null, map, MediaType.APPLICATION_XML_TYPE, MediaType.APPLICATION_XML, ToXMLString.toString(xmlJob)); AssertUtil.assertSucceededResponse(response); return response.readEntity(LensAPIResult.class); }