All Downloads are FREE. Search and download functionalities are using the official Maven repository.

org.sonar.updatecenter.mojo.CompatibilityMatrix Maven / Gradle / Ivy

/*
 * SonarSource :: Update Center :: Maven Plugin
 * Copyright (C) 2010 SonarSource
 * [email protected]
 *
 * This program is free software; you can redistribute it and/or
 * modify it under the terms of the GNU Lesser General Public
 * License as published by the Free Software Foundation; either
 * version 3 of the License, or (at your option) any later version.
 *
 * This program is distributed in the hope that it will be useful,
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
 * Lesser General Public License for more details.
 *
 * You should have received a copy of the GNU Lesser General Public
 * License along with this program; if not, write to the Free Software
 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02
 */
package org.sonar.updatecenter.mojo;

import java.text.SimpleDateFormat;
import java.util.ArrayList;
import java.util.Date;
import java.util.HashMap;
import java.util.List;
import java.util.Locale;
import java.util.Map;

public class CompatibilityMatrix {

  private List sqVersions = new ArrayList();
  private List plugins = new ArrayList();

  public List getSqVersions() {
    return sqVersions;
  }

  public List getPlugins() {
    return plugins;
  }

  public static class SQVersion {
    private final String displayVersion;
    private final String realVersion;
    private final boolean isLts;
    private final Date releaseDate;

    public SQVersion(String displayVersion, String realVersion, boolean isLts, Date releaseDate) {
      this.displayVersion = displayVersion;
      this.realVersion = realVersion;
      this.isLts = isLts;
      this.releaseDate = releaseDate;
    }

    public String getDisplayVersion() {
      return displayVersion;
    }

    public String getRealVersion() {
      return realVersion;
    }

    public boolean isLts() {
      return isLts;
    }

    public String getReleaseDate() {
      return releaseDate != null ? formatDate(releaseDate) : null;
    }

    private static String formatDate(Date date) {
      return (new SimpleDateFormat("MMM yyyy", Locale.ENGLISH)).format(date);
    }
  }

  public static class Plugin {

    private final String name;
    private final String homepageUrl;
    private final Map compatibleVersionBySqVersion = new HashMap();

    public Plugin(String name, String homepageUrl) {
      this.name = name;
      this.homepageUrl = homepageUrl;
    }

    public String getName() {
      return name;
    }

    public String getHomepageUrl() {
      return homepageUrl;
    }

    public Map getCompatibleVersionBySqVersion() {
      return compatibleVersionBySqVersion;
    }

    public boolean supports(String sqVersion) {
      return compatibleVersionBySqVersion.containsKey(sqVersion);
    }

    public String supportedVersion(String sqVersion) {
      return compatibleVersionBySqVersion.get(sqVersion);
    }

  }

}




© 2015 - 2025 Weber Informatics LLC | Privacy Policy