if (!authorizationManager.canViewResource(subject, resource.getId())) {
throw new PermissionException("User [" + subject.getName()
+ "] does not have permission to view plugin configuration for [" + resource + "].");
}
PluginConfigurationUpdate current;
// Get the latest configuration as known to the server (i.e. persisted in the DB).
try {
Query query = entityManager.createNamedQuery(PluginConfigurationUpdate.QUERY_FIND_CURRENTLY_ACTIVE_CONFIG);
query.setParameter("resourceId", resourceId);
current = (PluginConfigurationUpdate) query.getSingleResult();
resource = current.getResource();
// Mask the configuration before returning the update.
Configuration configuration = current.getConfiguration();
configuration.getMap().size();
ConfigurationDefinition configurationDefinition = getPluginConfigurationDefinitionForResourceType(
subjectManager.getOverlord(), resource.getResourceType().getId());
// We do not want the masked configuration persisted, so detach all entities before masking the configuration.
entityManager.clear();