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