* @param query the query
*/
private void addRelationForTheView(IModelEntity parent, ModelViewEntity view, IModelEntity child, Set<ViewRalationClause> viewRelations, Map entityAliases, Query query){
List<ViewRelationship> relations = view.getRelationships();
IModelEntity inEntity,outEntity;
ViewRelationship relation;
for(int i=0; i<relations.size(); i++){
relation = relations.get(i);
outEntity = relation.getSourceEntity();
inEntity = relation.getDestinationEntity();
if( (view.getInnerEntities().contains(inEntity) && parent!=null && outEntity.getType().equals(parent.getType())) || //income relation
(view.getInnerEntities().contains(outEntity) && child!=null && inEntity.getType().equals(child.getType()))){ //outcome relation
//build the relation constraints
viewRelations.addAll(buildRelationConditionString(relation.getSourceFileds(), relation.getDestinationFileds(), entityAliases, query));
}
}
}