
net.customware.license.jira.JiraLicenseParam Maven / Gradle / Ivy
package net.customware.license.jira;
import java.util.Collection;
import java.util.List;
import net.customware.license.atlassian.DefaultLicenseContext;
import net.customware.license.atlassian.LicenseContext;
import net.customware.license.jira.prefs.JiraSystemPreferences;
import net.customware.license.support.simple.SimpleLicenseParam;
import com.atlassian.license.LicenseType;
import com.atlassian.license.applications.jira.JiraLicenseTypeStore;
public abstract class JiraLicenseParam extends SimpleLicenseParam {
private static final List LICENSE_TYPES;
static {
LICENSE_TYPES = new java.util.ArrayList();
LICENSE_TYPES.add( JiraLicenseTypeStore.JIRA_ENTERPRISE_ACADEMIC );
LICENSE_TYPES.add( JiraLicenseTypeStore.JIRA_ENTERPRISE_COMMUNITY );
LICENSE_TYPES.add( JiraLicenseTypeStore.JIRA_ENTERPRISE_DEMONSTRATION );
LICENSE_TYPES.add( JiraLicenseTypeStore.JIRA_ENTERPRISE_DEVELOPER );
LICENSE_TYPES.add( JiraLicenseTypeStore.JIRA_ENTERPRISE_EVALUATION );
LICENSE_TYPES.add( JiraLicenseTypeStore.JIRA_ENTERPRISE_FULL_LICENSE );
LICENSE_TYPES.add( JiraLicenseTypeStore.JIRA_ENTERPRISE_OPEN_SOURCE );
LICENSE_TYPES.add( JiraLicenseTypeStore.JIRA_PROFESSIONAL_ACADEMIC );
LICENSE_TYPES.add( JiraLicenseTypeStore.JIRA_PROFESSIONAL_COMMUNITY );
LICENSE_TYPES.add( JiraLicenseTypeStore.JIRA_PROFESSIONAL_DEMONSTRATION );
LICENSE_TYPES.add( JiraLicenseTypeStore.JIRA_PROFESSIONAL_DEVELOPER );
LICENSE_TYPES.add( JiraLicenseTypeStore.JIRA_PROFESSIONAL_EVALUATION );
LICENSE_TYPES.add( JiraLicenseTypeStore.JIRA_PROFESSIONAL_FULL_LICENSE );
LICENSE_TYPES.add( JiraLicenseTypeStore.JIRA_PROFESSIONAL_OPEN_SOURCE );
LICENSE_TYPES.add( JiraLicenseTypeStore.JIRA_STANDARD_ACADEMIC );
LICENSE_TYPES.add( JiraLicenseTypeStore.JIRA_STANDARD_COMMUNITY );
LICENSE_TYPES.add( JiraLicenseTypeStore.JIRA_STANDARD_DEMONSTRATION );
LICENSE_TYPES.add( JiraLicenseTypeStore.JIRA_STANDARD_DEVELOPER );
LICENSE_TYPES.add( JiraLicenseTypeStore.JIRA_STANDARD_EVALUATION );
LICENSE_TYPES.add( JiraLicenseTypeStore.JIRA_STANDARD_FULL_LICENSE );
LICENSE_TYPES.add( JiraLicenseTypeStore.JIRA_STANDARD_OPEN_SOURCE );
}
public static LicenseType findLicenseType( int id ) {
for ( LicenseType type : LICENSE_TYPES ) {
if ( type.getType() == id )
return type;
}
return null;
}
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() {
}
/**
* Initialises the parameters to use the system preferences by default. May
* be overridden in the {@link #init()} method by calling
* {@link #requireLicensePerUser()} or
* {@link #setPreferences(java.util.prefs.Preferences)}.
*/
@Override protected void preInit() {
requireLicensePerServer();
}
protected void requireLicensePerServer() {
setPreferences( new JiraSystemPreferences() );
}
}
© 2015 - 2025 Weber Informatics LLC | Privacy Policy