1 package com.atlassian.sal.api.license;
2
3 import com.atlassian.annotations.PublicApi;
4
5 import javax.annotation.Nonnull;
6 import javax.annotation.Nullable;
7
8 /**
9 * Represents license information for an individual role-based "Product" that lives on a platform.
10 */
11 @SuppressWarnings ("UnusedDeclaration")
12 @PublicApi
13 public interface ProductLicense
14 {
15 static final int UNLIMITED_USER_COUNT = -1;
16
17 /**
18 * Returns the canonical product key as defined by the respective source license. Product keys both uniquely
19 * identify a product across all Atlassian products, but also define the product's license key namespace.
20 *<p>
21 * For example, a license containing {@code com.gliffy.integration.jira.active} would return a product key of
22 * {@code com.gliffy.integration.jira}, and every other license key relevant to this plugin is expected to be of
23 * form:
24 *<pre>
25 * com.gliffy.integration.jira.interestingProperty
26 *</pre>
27 *</p>
28 *
29 * @return the product key
30 */
31 @Nonnull
32 String getProductKey();
33
34 /**
35 * Returns true if this license authorises an unlimited number of users.
36 *
37 * @return true if this license authorises an unlimited number of users.
38 *
39 * @see #getNumberOfUsers()
40 */
41 boolean isUnlimitedNumberOfUsers();
42
43 /**
44 * Returns the number of users allowed by the current license.
45 *
46 * @return the number of user allowed by the license, {@link #UNLIMITED_USER_COUNT} if there is no limit, or the
47 * number of users is unlimited.
48 *
49 * @see #isUnlimitedNumberOfUsers()
50 */
51 int getNumberOfUsers();
52
53 /**
54 * Returns the "official" product name (e.g. "Service Desk") as it is defined in the license, otherwise on a
55 * best-effort basis. Typically, product names are expected to be defined by the plugin/product itself, or hardcoded
56 * in the host product/platform. The expected use-case for this method is providing a product name for the case
57 * where the license is installed but the plugin is not.
58 *
59 * Note that the product name is almost always a trademark and accordingly should never be internationalised.
60 *
61 * @return the "official" product name as it appears in the license, or otherwise on a best-effort basis.
62 */
63 @Nonnull
64 String getProductDisplayName();
65
66 /**
67 * Returns the license property value for the given property of this product. This is generally expected to be
68 * equivalent to the following expression:
69 *<pre>
70 * {@link BaseLicenseDetails#getProperty}({@link #getProductKey()} + "." + property)
71 *</pre>
72 *
73 * @param property the license property name, without this product's namespace.
74 * @return the license property value, or null if not defined.
75 */
76 @Nullable
77 String getProperty(@Nonnull String property);
78 }