We’ve a requirement to calculate cloudlifecycle state attribute for that our architect asked to create cloud rule, Where I’m able achieve most of the scenario except one edge scenario,
Edge Scenario 1:
If identity Hr status is terminated and end date is future date and state date is not future date here expected outcome is active This applicable for Identity that already exists if new identity comes this should return null.
Now, the out of the nox Java Function which you are using for Date Comparison is : isAfter().
This function requires data in a particular format. Therefore, the input string has to be converted into LocalDate foomat and then, you can use the isAfter() function.
Refer the below code example and if you dont have the logic as per below, then, perform the required changes and then, retry.
import java.time.LocalDate;
import java.time.format.DateTimeFormatter;
public class DateComparison {
public static void main(String[] args) {
DateTimeFormatter formatter = DateTimeFormatter.ofPattern("yyyy-MM-dd");
String startDateStr = "2023-09-15"; // Example value
String endDateStr = "2024-10-05"; // Example value
LocalDate startDate = LocalDate.parse(startDateStr, formatter);
LocalDate endDate = LocalDate.parse(endDateStr, formatter);
LocalDate today = LocalDate.now();
if (endDate.isAfter(today) && !startDate.isAfter(today)) {
System.out.println("endDate is after today's date and startDate is not after today's date.");
} else {
System.out.println("Dates do not satisfy the condition.");
}
}
}
I used the isAfter() to calculate LCS, Confusion here is to check identity exists or not check by using
int count =
countIdentitiesBySearchableIdentityAttribute(“uid”, “Equals” , hasUid);
Need to find where I’m making mistakes.