private boolean checkMetadataConsistency(String fileName,
Representation representation) {
boolean result = true;
if (representation != null) {
Variant var = new Variant();
Entity.updateMetadata(fileName, var, false, getMetadataService());
// "var" contains the theoretical correct metadata
if (!var.getLanguages().isEmpty()
&& !representation.getLanguages().isEmpty()
&& !var.getLanguages().containsAll(
representation.getLanguages())) {
result = false;
}
if ((var.getMediaType() != null)
&& (representation.getMediaType() != null)
&& !(var.getMediaType().includes(representation
.getMediaType()))) {
result = false;
}
if (!var.getEncodings().isEmpty()
&& !representation.getEncodings().isEmpty()
&& !var.getEncodings().containsAll(
representation.getEncodings())) {
result = false;
}
}
return result;