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   import java.util.Set;
8   
9   /**
10   * Provides access to the one or more individual {@link com.atlassian.sal.api.license.ProductLicense products} that may
11   * appear in a single license. At the most basic level, licenses are collections of products. Licenses and products
12   * across Atlassian vary considerably with respect to the number of licenses that any given product may accept (1-many),
13   * but also in terms of the number of products that may be granted within license (also 1-many). Heterogeneous mixes of
14   * single-product licenses together with multi-product licenses (e.g. Enterprise Licensing Agreements, ELAs) are also
15   * possible within a single product.
16   * <p>
17   * This interface partitions the products granted by a license into 2 sets:
18   * <ul>
19   * <li>products that are considered by the host product as sub-products, and/or products that are intrinsic or
20   * specific to this host product. For example, in JIRA 7.0, JIRA Service Desk, JIRA Software, and JIRA Core are
21   * sub-products.
22   * </li>
23   * <li>everything else. This typically includes host product and other product add-ons, but also licenses for other
24   * top-level Atlassian products, e.g. HipChat, FeCru, etc.</li>
25   * </ul>
26   * The former are returned by {@link #getProductLicenses()}, the latter by {@link #getEmbeddedLicenses()}. These
27   * collections are expected to be mutually exclusive (<code>getEmbeddedLicenses().retainAll(getEmbeddedLicenses())</code>
28   * equals the empty set), and the union of these Sets (<code>getEmbeddedLicenses().addAll(getEmbeddedLicenses())</code>)
29   * is expected to represent all products found in the source license.
30   */
31  @SuppressWarnings("UnusedDeclaration")
32  @PublicApi
33  public interface MultiProductLicenseDetails extends BaseLicenseDetails {
34      /**
35       * Returns {@link ProductLicense}s for the host product license (if relevant) as well as all products in this
36       * license that are direct sub-products of the current host product/platform.
37       * <p>
38       * By convention, starting with JIRA 7.0, these properties are expected to conform to the
39       * naming convention {@code "[host-product-namespace].product.[sub-product-namespace].[property-name]"}, eg:
40       * {@code jira.product.jira-software.NumberOfUsers}.
41       * <p>
42       * Host products that do not have sub-products would return only their host product license.
43       *
44       * @return all products in this license that are specific to the current host product/platform
45       * @see #getEmbeddedLicenses()
46       */
47      @Nonnull
48      Set<ProductLicense> getProductLicenses();
49  
50      /**
51       * @return {@link ProductLicense}s for all products in this license that are not for this host product, and/or are
52       * not considered to be {@link #getProductLicenses() sub-products} by the host product/platform.
53       *
54       * @see #getProductLicenses()
55       */
56      @Nonnull
57      Set<ProductLicense> getEmbeddedLicenses();
58  
59      /**
60       * Returns the individual product or embedded license with the given product key.
61       *
62       * @param productKey the product key.
63       * @return the individual product or embedded license with the given product key, or null if that product does not
64       * exist in this license.
65       */
66      @Nullable
67      ProductLicense getProductLicense(@Nonnull String productKey);
68  }