.getEntitiesClass();
String thisEntitiesClass = getConceptConfig()
.getEntitiesClass();
if (!entitiesArgumentClass.equals(thisEntitiesClass)) {
String error = "Intersection input entities must be of the same type.";
throw new SelectionException(error);
}
ModelMeta modelMeta = domainModel.getModelMeta();
intersection = (Entities<T>) modelMeta
.createEntities(getConceptConfig().getEntitiesClass());
intersection.setPropagateToSource(false);
for (T entity : this) {
if (entities.contain(entity)) {
intersection.add(entity);
}
}
for (T entity : entities) {
if (!intersection.contain(entity) && this.contain(entity)) {
intersection.add(entity);
}
}
modelMeta.setParents(intersection, this);
if (getSourceEntities() != null
&& entities.getSourceEntities() != null
&& getSourceEntities() == entities.getSourceEntities()) {
intersection.setSourceEntities(getSourceEntities());
intersection.setPropagateToSource(true);
}
} else {
String error = "There is no domain model.";
throw new SelectionException(error);
}
} catch (Exception e) {
log.error("Error in Entities.intersection: " + e.getMessage());
throw new SelectionException(e.getMessage());
}
return (IEntities<T>) intersection;
}