
net.customware.license.jira.JiraLicenseParam Maven / Gradle / Ivy
The newest version!
package net.customware.license.jira;
import java.util.Collection;
import java.util.List;
import net.customware.license.atlassian.AtlassianLicenseParam;
import net.customware.license.atlassian.DefaultLicenseContext;
import net.customware.license.atlassian.LicenseContext;
import net.customware.license.jira.prefs.JiraSystemPreferences;
import com.atlassian.license.LicenseType;
import com.atlassian.license.applications.jira.JiraLicenseTypeStore;
public abstract class JiraLicenseParam extends AtlassianLicenseParam {
private static final List LICENSE_TYPES;
static {
LICENSE_TYPES = new java.util.ArrayList();
LICENSE_TYPES.addAll(new JiraLicenseTypeStore().getAllLicenses());
}
public static LicenseType findLicenseType(int id) {
for (LicenseType type : LICENSE_TYPES) {
if (type.getType() == id)
return type;
}
return null;
}
@Override
public LicenseType getLicenseType(int id) {
return JiraLicenseParam.findLicenseType(id);
}
public static Collection findLicenseTypes() {
return LICENSE_TYPES;
}
private static LicenseContext LICENSE_CONTEXT = new DefaultLicenseContext(JiraLicenseTypeStore.APPLICATION_NAME);
/**
* Returns the LicenseContext for
*
* @return
*/
public static LicenseContext getLicenseContext() {
return LICENSE_CONTEXT;
}
/**
* Constructs a new JIRA license provider, with the license being stored in
* the system-wide preferences node.
*/
public JiraLicenseParam() {
}
@Override
protected void postInit() {
super.postInit();
requireLicensePerServer();
}
protected void requireLicensePerServer() {
setPreferences(new JiraSystemPreferences().nodeForPackage(getClass()));
}
}
© 2015 - 2025 Weber Informatics LLC | Privacy Policy