@Override public Person personAendern(Person person) throws Exception { // check params if (person == null) { throw new PersonException("person == null"); } // check oid String oid = person.getOid(); if (oid == null || oid.isEmpty()) { String message = String.format("oid(%) invalid", oid); throw new PersonException(message); } // check existence if (!personStore.containsKey(oid)) { String message = String.format("oid(%) unknown", oid); throw new PersonException(message); } // replace personStore.put(oid, person); // notify listeners listenerApi.personGeaendert(person); // return result return person; }
@Override public Person personAnlegen(Person person) throws Exception { // check params if (person == null) { throw new PersonException("person == null"); } // generate oid String newOid = generateOid(); person.setOid(newOid); // put clone in map personStore.put(newOid, new Person(person)); // notify listeners listenerApi.personAngelegt(person); // return person return person; }
@Override public void personLoeschen(Person person) throws Exception { // check params if (person == null) { throw new PersonException("person == null"); } // check oid String oid = person.getOid(); if (oid == null || oid.isEmpty()) { String message = String.format("oid(%) invalid", oid); throw new PersonException(message); } // remove from map if (personStore.remove(oid) == null) { String message = String.format("oid(%) unknown", oid); throw new PersonException(message); } // notify listeners listenerApi.personGeloescht(person); }