public void writeRelation(final EdmEntitySet sourceEntitySet, final Object sourceData,
final EdmEntitySet targetEntitySet, final Map<String, Object> targetKeys) throws ODataNotImplementedException,
ODataNotFoundException, EdmException, ODataApplicationException {
if (ENTITYSET_1_1.equals(targetEntitySet.getName())) {
final Employee employee = (Employee) readData(targetEntitySet, targetKeys);
if (ENTITYSET_1_2.equals(sourceEntitySet.getName())) {
if (employee.getTeam() != null) {
employee.getTeam().getEmployees().remove(employee);
}
employee.setTeam((Team) sourceData);
((Team) sourceData).getEmployees().add(employee);
} else if (ENTITYSET_1_3.equals(sourceEntitySet.getName())) {
if (employee.getRoom() != null) {
employee.getRoom().getEmployees().remove(employee);
}
employee.setRoom((Room) sourceData);
((Room) sourceData).getEmployees().add(employee);
} else if (ENTITYSET_1_4.equals(sourceEntitySet.getName())) {
if (employee.getManager() != null) {
employee.getManager().getEmployees().remove(employee);
}
employee.setManager((Manager) sourceData);
((Manager) sourceData).getEmployees().add(employee);
}
} else if (ENTITYSET_1_2.equals(targetEntitySet.getName())) {
final Team team = (Team) readData(targetEntitySet, targetKeys);