content: // Licensed to the Apache Software Foundation (ASF) under one
  // or more contributor license agreements.  See the NOTICE file
  // distributed with this work for additional information
  // regarding copyright ownership.  The ASF licenses this file
  // to you under the Apache License, Version 2.0 (the
  // "License"); you may not use this file except in compliance
  // with the License.  You may obtain a copy of the License at
  //
  //   http://www.apache.org/licenses/LICENSE-2.0
  //
  // Unless required by applicable law or agreed to in writing,
  // software distributed under the License is distributed on an
  // "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
  // KIND, either express or implied.  See the License for the
  // specific language governing permissions and limitations
  // under the License.
  
  package org.apache.cloudstack.backup.veeam.api;
  
  import java.util.List;
  
  import com.fasterxml.jackson.dataformat.xml.annotation.JacksonXmlElementWrapper;
  import com.fasterxml.jackson.dataformat.xml.annotation.JacksonXmlProperty;
  import com.fasterxml.jackson.dataformat.xml.annotation.JacksonXmlRootElement;
  
  @JacksonXmlRootElement(localName = "Job")
  public class Job {
  
      @JacksonXmlProperty(localName = "Name", isAttribute = true)
      private String name;
  
      @JacksonXmlProperty(localName = "Href", isAttribute = true)
      private String href;
  
      @JacksonXmlProperty(localName = "Type", isAttribute = true)
      private String type;
  
      @JacksonXmlProperty(localName = "UID", isAttribute = true)
      private String uid;
  
      @JacksonXmlProperty(localName = "Link")
      @JacksonXmlElementWrapper(localName = "Links")
      private List<Link> link;
  
      @JacksonXmlProperty(localName = "Platform")
      private String platform;
  
      @JacksonXmlProperty(localName = "Description")
      private String description;
  
      @JacksonXmlProperty(localName = "NextRun")
      private String nextRun;
  
      @JacksonXmlProperty(localName = "JobType")
      private String jobType;
  
      @JacksonXmlProperty(localName = "ScheduleEnabled")
      private Boolean scheduleEnabled;
  
      @JacksonXmlProperty(localName = "ScheduleConfigured")
      private Boolean scheduleConfigured;
  
      public String getName() {
          return name;
      }
  
      public void setName(String name) {
          this.name = name;
      }
  
      public String getHref() {
          return href;
      }
  
      public void setHref(String href) {
          this.href = href;
      }
  
      public String getType() {
          return type;
      }
  
      public void setType(String type) {
          this.type = type;
      }
  
      public String getUid() {
          return uid;
      }
  
      public String getId() {
          return uid.replace("urn:veeam:Job:", "");
      }
  
      public void setUid(String uid) {
          this.uid = uid;
      }
  
      public List<Link> getLink() {
          return link;
      }
  
      public void setLink(List<Link> link) {
          this.link = link;
      }
  
      public String getPlatform() {
          return platform;
      }
  
      public void setPlatform(String platform) {
          this.platform = platform;
      }
  
      public String getDescription() {
          return description;
      }
  
      public void setDescription(String description) {
          this.description = description;
      }
  
      public String getNextRun() {
          return nextRun;
      }
  
      public void setNextRun(String nextRun) {
          this.nextRun = nextRun;
      }
  
      public String getJobType() {
          return jobType;
      }
  
      public void setJobType(String jobType) {
          this.jobType = jobType;
      }
  
      public String getBackupServerId() {
          for (final Link l : link) {
              if (l.getType().equals("BackupServerReference")) {
                  return "" + l.getHref().split("backupServers/")[1];
              }
          }
          return null;
      }
  
      public Boolean getScheduleEnabled() {
          return scheduleEnabled;
      }
  
      public void setScheduleEnabled(String scheduleEnabled) {
          this.scheduleEnabled = Boolean.valueOf(scheduleEnabled);
      }
  
      public Boolean getScheduleConfigured() {
          return scheduleConfigured;
      }
  
      public void setScheduleConfigured(String scheduleConfigured) {
          this.scheduleConfigured = Boolean.valueOf(scheduleConfigured);
      }
  }
  