CE-2035: Change the query for IOC's deployment status
Checking the last deployment instead of the active deployment of the IOC gain more information of its deployment status. Checking only the active deployment it not enough because it only changes when the deployment/undeployment was successful.
The rules are the following for a deployment status:
- If the DEPLOYMENT was successful, it's DEPLOYED
- If the DEPLOYMENT failed, it's DEPLOYED - but with alert raised for issues
- If the UNDEPLOYMENT failed, it's DEPLOYED - but with alert raised for issues
- If the UNDEPLOYMENT was successful, it's UNDEPLOYED
So basically I checking just the last condition, otherwise its DEPLOYED.
Unfortunately JPQL does not support joins with subqueries, so I made a view entity for that.
Edited by Domonkos Gulyas