public static Employee fetchEmployee(EOEditingContext editingContext, EOQualifier qualifier) { NSArray<Employee> eoObjects = _Employee.fetchEmployees(editingContext, qualifier, null); Employee eoObject; int count = eoObjects.count(); if (count == 0) { eoObject = null; } else if (count == 1) { eoObject = (Employee) eoObjects.objectAtIndex(0); } else { throw new IllegalStateException( "There was more than one Employee that matched the qualifier '" + qualifier + "'."); } return eoObject; }
public static PDBPresentation fetchPDBPresentation( EOEditingContext editingContext, EOQualifier qualifier) { NSArray<PDBPresentation> eoObjects = _PDBPresentation.fetchPDBPresentations(editingContext, qualifier, null); PDBPresentation eoObject; int count = eoObjects.count(); if (count == 0) { eoObject = null; } else if (count == 1) { eoObject = eoObjects.objectAtIndex(0); } else { throw new IllegalStateException( "There was more than one PDBPresentation that matched the qualifier '" + qualifier + "'."); } return eoObject; }