@Override public <T extends ObjectType> void deleteObject( Class<T> type, String oid, OperationResult parentResult) throws ObjectNotFoundException { repository.deleteObject(type, oid, parentResult); Cache cache = getCache(); if (cache != null) { cache.removeObject(oid); cache.clearQueryResults(type); } }
@Override public <T extends ObjectType> void modifyObject( Class<T> type, String oid, Collection<? extends ItemDelta> modifications, OperationResult parentResult) throws ObjectNotFoundException, SchemaException, ObjectAlreadyExistsException { repository.modifyObject(type, oid, modifications, parentResult); // this changes the object. We are too lazy to apply changes ourselves, so just invalidate // the object in cache Cache cache = getCache(); if (cache != null) { cache.removeObject(oid); cache.clearQueryResults(type); } }
@Override public <T extends ObjectType> String addObject( PrismObject<T> object, RepoAddOptions options, OperationResult parentResult) throws ObjectAlreadyExistsException, SchemaException { String oid = repository.addObject(object, options, parentResult); Cache cache = getCache(); // DON't cache the object here. The object may not have proper "JAXB" form, e.g. some pieces may // be // DOM element instead of JAXB elements. Not to cache it is safer and the performance loss // is acceptable. if (cache != null) { // Invalidate the cache entry if it happens to be there cache.removeObject(oid); cache.clearQueryResults(object.getCompileTimeClass()); } return oid; }