Summary
How to get entitlements with the latest Activation IDs using FlexNet Operations On-Premises Web Services API?
Question
How to get entitlements with the latest Activation IDs using FlexNet Operations On-Premises Web Services API?
Answer
The following is an example demonstrating how to use "getEntitlementsQuery":
Product Manuals 12.11.zip\Product Manuals 12.11\FlexNetOperationsWebServices12_11_0_2.zip\
FlexNetOperationsWebServices12_11_0_2\SamplePrograms\EntitlementOrder\GetEntitlementsQueryTest.java
As the query results contain line item objects, from which type "EntitlementLineItemDataType" element "createdOnDateTime" can be accessed.
Use "createdOnDateTime" to sort queried entitlements and locate the one which has the latest line item creation date.
The following code demonstrates how entitlement query results are sorted.
(A complete example is available in the attachment.)
===
// "simpleEntitlements" is the result extracted from "getEntitlementsQuery" response.
// Sort simple entitlements based on latest line item creation date.
Collections.sort(simpleEntitlements, new Comparator<SimpleEntitlementDataType>()
{
// Compare line item by their created datetime.
private int compareLineItems(EntitlementLineItemDataType lineItem1, EntitlementLineItemDataType lineItem2)
{
Calendar createdDateTime1 = lineItem1.getCreatedOnDateTime();
Calendar createdDateTime2 = lineItem2.getCreatedOnDateTime();
return createdDateTime1.compareTo(createdDateTime2);
}
// Get last created line item.
private EntitlementLineItemDataType getLastCreatedLineItem(EntitlementLineItemDataType[] lineItems)
{
EntitlementLineItemDataType lastCreatedLineItem = null;
for (EntitlementLineItemDataType lineItem : lineItems)
{
if (lastCreatedLineItem == null)
{
lastCreatedLineItem = lineItem;
}
else
{
if (this.compareLineItems(lastCreatedLineItem, lineItem) < 0)
{
lastCreatedLineItem = lineItem;
}
}
}
return lastCreatedLineItem;
}
@Override
public int compare(SimpleEntitlementDataType simpleEntitlement1, SimpleEntitlementDataType simpleEntitlement2)
{
EntitlementLineItemDataType[] lineItems1 = simpleEntitlement1.getLineItems();
EntitlementLineItemDataType[] lineItems2 = simpleEntitlement2.getLineItems();
EntitlementLineItemDataType lastCreatedLineItem1 = this.getLastCreatedLineItem(lineItems1);
EntitlementLineItemDataType lastCreatedLineItem2 = this.getLastCreatedLineItem(lineItems2);
// Convert positive to negative and vice versa as we want to list the latest first.
return -1 * this.compareLineItems(lastCreatedLineItem1, lastCreatedLineItem2);
}
}
);
===Related Articles
Start/Stop of FlexNet Operation On-Premises is not working using FlexNet setup 7Number of Views What Version of OpenSSL is Part of Your Latest Release of FlexNet Embedded? 11Number of Views How to Use a FlexNet Operations On-Premises API to Provide Company Information? 5Number of Views Where to check which version of AdminStudio is supported and which version is already at the End Of the Life Cycle. 22Number of Views How to create TEST Entitlement using Web service 3Number of Views
Hi, I am Reva - Ask me anything.
No new updates
Thanks for the feedback!
Your feedback has been saved.Rate this response:
Add Additional feedback ( Optional )
Are you sure you want to cancel
the case creation?
Are you sure you want to cancel the case creation?
Are you sure you want to close this case
| Products | Region | Phone Numbers |
|---|---|---|
| FlexNet Operations FlexNet Embedded FlexNet Publisher FlexNet Connect FlexNet Code Insight InstallAnywhere InstallShield |
North America * |
+1 630-332-2513 (toll) +1 877-279-2853 (toll-free in North America) |
| Europe * |
+44 1925 944367 (toll) +44 800 047 8642 (toll-free in Europe) |
|
| Japan * | +81 3-4540-5335 (select option 2) | |
| Australia * |
+61 3 9895 2177 +61 1800 560 603 (toll-free in Australia) |
|
|
Usage Intelligence (formerly
Revulytics) Compliance Intelligence |
Please use the Case Portal to submit your support ticket or reach out to your Revenera contact. | |
Case id: 00001065
Activity: Status change: 2 hours ago