Esempio n. 1
0
  /**
   * Get NOS Details
   *
   * @param objectKey
   * @return
   */
  @Deprecated /*deprecated - changed to get nos detail by build request key and device*/
  @RequestMapping(value = "/rest/getnosinfo", method = RequestMethod.GET)
  public NOSInfo getNOSDetails(
      @RequestParam("series") String seriesName,
      @RequestParam("nos") String nosName,
      @RequestParam("dev") String deviceName) {
    try {
      NOSSeries series = seriesDAO.getByName(seriesName);
      if (series == null) return null;
      Artifact a = artDao.getByNameAndSeries(nosName, series.getId());
      if (a == null) return null;
      Device device = deviceDAO.getByName(deviceName);
      if (device == null) return null;
      ArtifactInfo artifactInfo =
          artifactInfoDAO.getByDeviceIdArtifactId(device.getId(), a.getId());
      if (artifactInfo == null) return null;
      SysVerInfo sysVerInfo = new SysVerInfo();
      sysVerInfo.setSys(artifactInfo.getSysInfo());
      sysVerInfo.setVer(artifactInfo.getVerInfo());
      BuildRequest history = historyDAO.getById(a.getBuildRequestId());
      NOSInfo n = new NOSInfo();
      n.setId(a.getId());
      n.setBmt(a.getBmtNumber());
      n.setBuildno(a.getBuildNumber());
      n.setCategory(series.getCategory());
      n.setDump(a.getAttachedDumpFile());
      n.setFilesize(a.getFileSize());
      n.setHash(a.getFileHash());
      n.setLocation(a.getFileLocation());
      n.setMajor(a.getVersionMajor());
      n.setMinor(a.getVersionMinor());
      n.setName(a.getFileName());
      n.setOsInfo(Utils.toJson(sysVerInfo));
      n.setResized(a.getIsResized());
      n.setType(a.getType());
      if (history != null) {
        n.setSrcRev(history.getSourceRev());
        n.setSrcUrl(history.getSourceUrl());
        if (requestMap.contains(history.getRequestKey()))
          requestMap.remove(history.getRequestKey());
      }

      return n;
    } catch (Exception e) {
      logger.error("Error in NosRepoRestController.getNOSDetails(): ", e);
    }
    return null;
  }
Esempio n. 2
0
 private NOSInfo mapResultSetNOSInfo(ResultSet rs) throws SQLException {
   NOSInfo n = new NOSInfo();
   n.setId(rs.getLong("id"));
   n.setBmt(rs.getString("bmt_number"));
   n.setBuildno(rs.getString("build_number"));
   n.setCategory(rs.getString("category"));
   n.setDump(rs.getString("attached_dump_file"));
   n.setFilesize(rs.getInt("file_size"));
   n.setHash(rs.getString("file_hash"));
   n.setLocation(rs.getString("file_location"));
   n.setMajor(rs.getString("version_major"));
   n.setMinor(rs.getString("version_minor"));
   n.setName(rs.getString("file_name"));
   SysVerInfo sysVerInfo = new SysVerInfo();
   sysVerInfo.setSys(rs.getString("sys_info"));
   sysVerInfo.setVer(rs.getString("ver_info"));
   n.setOsInfo(Utils.toJson(sysVerInfo));
   n.setResized(rs.getBoolean("is_resized"));
   n.setType(rs.getString("type"));
   n.setSrcRev(rs.getString("source_rev"));
   n.setSrcUrl(rs.getString("source_url"));
   return n;
 }