
net.customware.license.atlassian.restriction.NodeCountRestriction Maven / Gradle / Ivy
The newest version!
package net.customware.license.atlassian.restriction;
import net.customware.license.support.simple.SimpleLicenseContent;
import net.customware.license.support.simple.SimpleRestrictionException;
public class NodeCountRestriction extends AbstractLicenseRestriction {
@Override
protected void checkRestriction(Object context, SimpleLicenseContent content, Object attributeValue) throws SimpleRestrictionException {
com.atlassian.license.License license = getLicense(context);
Number maxNodes = (Number) attributeValue;
if (maxNodes != null && license.getPermittedClusteredNodes() > maxNodes.intValue())
throw new SimpleRestrictionException("This license supports " + maxNodes + " nodes but the Atlassian license allows for " + license.getPermittedClusteredNodes() + ".");
}
public static void setMaxNodeCount(SimpleLicenseContent content, Integer maxNodeCount) {
content.setAttribute(NodeCountRestriction.class, maxNodeCount);
}
}
© 2015 - 2025 Weber Informatics LLC | Privacy Policy