예제 #1
0
 public Document buildDriveResponseXML() throws HelixServiceException {
   Document document = DocumentHelper.createDocument();
   Element root = document.addElement("drives");
   List<Drive> drives = driveService.getDrives();
   if (drives != null) {
     for (Drive drive : drives) {
       Element element = root.addElement("drive");
       element.addAttribute("driveId", String.valueOf(drive.getIdDrive()));
       element.addAttribute("name", drive.getDriveName());
     }
   }
   return document;
 }
예제 #2
0
  public Document buildGetDriveInfoResponseXML(Integer driveId) throws HelixServiceException {
    Document document = DocumentHelper.createDocument();
    Element root = document.addElement("drive");
    Drive drive = driveService.getDrive(driveId);

    Element element = root.addElement("details");
    element.addAttribute("driveId", String.valueOf(drive.getIdDrive()));
    element.addAttribute("description", drive.getDriveName());
    if (drive.getDriveMonth() != null) {
      element.addAttribute("month", String.valueOf(drive.getDriveMonth()));
    }
    if (drive.getDriveYear() != null) {
      element.addAttribute("year", String.valueOf(drive.getDriveYear()));
    }
    element.addAttribute("inProcess", String.valueOf(drive.getFlInProcess()));
    return document;
  }