Example #1
0
 public boolean exists(String resourceNameOrId) {
   Fragment f = getAsXml();
   return f.elementExists(
       format(
           "/node()/*[local-name(.) = 'list-items']/node()[*[local-name(.) = 'task-path'] = '%s']",
           resourceNameOrId));
 }
Example #2
0
 public String getTaskIdForTaskPath(String taskPath) {
   Fragment f = getAsXml();
   String xpath =
       "/node()/*[local-name(.) = 'list-items']/node()"
           + "[*[local-name(.) = 'task-path'] = '%s']/*[local-name(.) = 'idref']";
   xpath = String.format(xpath, taskPath);
   String id = f.getElementValue(xpath);
   if (id == null) {
     throw new RuntimeException(
         "Could not find a scheduled task with a task-path of: " + taskPath);
   }
   return id;
 }