View Javadoc

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      static final 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       * </p>
27       *
28       * @return the product key
29       */
30      @Nonnull
31      String getProductKey();
32  
33      /**
34       * Returns true if this license authorises an unlimited number of users.
35       *
36       * @return true if this license authorises an unlimited number of users.
37       * @see #getNumberOfUsers()
38       */
39      boolean isUnlimitedNumberOfUsers();
40  
41      /**
42       * Returns the number of users allowed by the current license.
43       *
44       * @return the number of user allowed by the license, {@link #UNLIMITED_USER_COUNT} if there is no limit, or the
45       * number of users is unlimited.
46       * @see #isUnlimitedNumberOfUsers()
47       */
48      int getNumberOfUsers();
49  
50      /**
51       * Returns the "official" product name (e.g. "Service Desk") as it is defined in the license, otherwise on a
52       * best-effort basis. Typically, product names are expected to be defined by the plugin/product itself, or hardcoded
53       * in the host product/platform. The expected use-case for this method is providing a product name for the case
54       * where the license is installed but the plugin is not.
55       *
56       * Note that the product name is almost always a trademark and accordingly should never be internationalised.
57       *
58       * @return the "official" product name as it appears in the license, or otherwise on a best-effort basis.
59       */
60      @Nonnull
61      String getProductDisplayName();
62  
63      /**
64       * Returns the license property value for the given property of this product. This is generally expected to be
65       * equivalent to the following expression:
66       * <pre>
67       *      {@link BaseLicenseDetails#getProperty}({@link #getProductKey()} + "." + property)
68       * </pre>
69       *
70       * @param property the license property name, without this product's namespace.
71       * @return the license property value, or null if not defined.
72       */
73      @Nullable
74      String getProperty(@Nonnull String property);
75  }