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 * <p>
43 * Host products that do not have sub-products would return only their host product license.
44 * </p>
45 *
46 * @return all products in this license that are specific to the current host product/platform
47 * @see #getEmbeddedLicenses()
48 */
49 @Nonnull
50 Set<ProductLicense> getProductLicenses();
51
52 /**
53 * Returns {@link ProductLicense}s for all products in this license that are not for this host product, and/or are
54 * not considered to be {@link #getProductLicenses() sub-products} by the host product/platform.
55 *
56 * @return
57 * @see #getProductLicenses()
58 */
59 @Nonnull
60 Set<ProductLicense> getEmbeddedLicenses();
61
62 /**
63 * Returns the individual product or embedded license with the given product key.
64 *
65 * @param productKey the product key.
66 * @return the individual product or embedded license with the given product key, or null if that product does not
67 * exist in this license.
68 */
69 @Nullable
70 ProductLicense getProductLicense(@Nonnull String productKey);
71 }