@Override public List<Job> listJobs(UUID subscriptionId, String serviceName) throws AzureCmdException { String[] cmd = new String[] { "mobile", "job", "list", "--json", "-s", subscriptionId.toString(), serviceName, }; String json = AzureCommandHelper.getInstance().consoleExec(cmd); CustomJsonSlurper slurper = new CustomJsonSlurper(); List<Map<String, Object>> tempRes = (List<Map<String, Object>>) slurper.parseText(json); List<Job> res = new ArrayList<Job>(); for (Map<String, Object> item : tempRes) { Job j = new Job(); j.setAppName(item.get("appName").toString()); j.setName(item.get("name").toString()); j.setEnabled(item.get("status").equals("enabled")); j.setId(UUID.fromString(item.get("id").toString())); if (item.get("intervalPeriod") != null) { j.setIntervalPeriod((Integer) item.get("intervalPeriod")); j.setIntervalUnit(item.get("intervalUnit").toString()); } res.add(j); } return res; }
public Job getEditingJob() { Job job = new Job(); job.setId(id); job.setName(jobNameTextField.getText()); job.setEnabled(enabledCheckBox.isSelected()); if (scheduledRadioButton.isSelected()) { job.setIntervalUnit(Job.getUnits()[intervalUnitComboBox.getSelectedIndex()]); job.setIntervalPeriod(parseInt(intervalFormattedTextField.getText())); } return job; }