Query query = entityManager.createNamedQuery(ResourceConfigurationUpdate.QUERY_FIND_LATEST_BY_RESOURCE_ID);
query.setParameter("resourceId", resourceId);
ResourceConfigurationUpdate latestConfigUpdate = (ResourceConfigurationUpdate) query.getSingleResult();
if (!authorizationManager.hasResourcePermission(subject, Permission.CONFIGURE_READ, latestConfigUpdate
.getResource().getId())) {
throw new PermissionException("User [" + subject.getName()
+ "] does not have permission to view Resource configuration for ["
+ latestConfigUpdate.getResource() + "]");
}
updateInProgress = (latestConfigUpdate.getStatus() == ConfigurationUpdateStatus.INPROGRESS);
} catch (NoResultException nre) {