} else {
spec = MetadataRelationSpecs.hasRelatedId(id);
}
HashSet<Integer> results = new HashSet<Integer>();
for (MetadataRelation metadataRelation : relationRepository.findAll(spec)) {
if (findMetadataId) {
results.add(metadataRelation.getId().getMetadataId());
} else {
results.add(metadataRelation.getId().getRelatedId());
}