[CSID-36] Improved vulnerability calculation

Please look at the following JIRA: https://geosolutions.atlassian.net/browse/CSID-36.