@Override public void remove(EntityRef entityRef) throws Exception { em.delete( entityRef ); }
em.delete( itemRef ); return;
@Override public void remove(Entity entity) throws Exception { em.delete( entity ); }
@Override public void deleteJob( UUID jobId ) { /** * just delete our target job data. This is easier than attempting to delete * from the queue. The runner should catch this and treat the queued message * as discarded */ try { if (logger.isDebugEnabled()) { logger.debug("deleteJob {}", jobId); } getEm().delete( new SimpleEntityRef( Schema.getDefaultSchema().getEntityType(JobData.class), jobId ) ); } catch ( Exception e ) { throw new JobRuntimeException( e ); } }
} catch (Exception e) { logger.info("notifier testConnection() failed", e); em.delete(notifier); throw e;
@Test public void testCreateAndDelete() throws Exception { logger.info( "EntityDaoTest.testCreateAndDelete" ); EntityManager em = app.getEntityManager(); String name = "test.thing" + UUIDUtils.newTimeUUID(); Map<String, Object> properties = new LinkedHashMap<String, Object>(); properties.put( "name", name ); properties.put( "foo", "bar" ); logger.info( "Starting entity create" ); Entity thing = em.create( "thing", properties ); logger.info( "Entity created" ); app.waitForQueueDrainAndRefreshIndex(); logger.info( "Starting entity delete" ); em.delete( thing ); logger.info( "Entity deleted" ); app.waitForQueueDrainAndRefreshIndex(); // now search by username, no results should be returned final Query emailQuery = Query.fromQL( "name = '" + name + "'" ); Results r = em.searchCollection( em.getApplicationRef(), "thing", emailQuery ); assertEquals( 0, r.size() ); }
logger.debug("delete job data {}", data.getUuid()); getEm().delete( data );
@Override public boolean deleteAdminUser( UUID userId ) throws Exception { // make sure user is not attached to any orgs BiMap<UUID, String> orgMap = getOrganizationsForAdminUser(userId); if (!orgMap.isEmpty()) { // cannot delete admin user that is attached to orgs logger.info("Cannot delete admin user {} -- admin user is attached to {} orgs", userId, orgMap.size()); return false; } EntityRef userRef = new SimpleEntityRef(User.ENTITY_TYPE, userId); // delete mongo password deleteUserMongoPassword(smf.getManagementAppId(), userRef); // delete user password deleteUserPassword(smf.getManagementAppId(), userRef); // delete user token deleteUserToken(smf.getManagementAppId(), userRef); // delete user entity emf.getEntityManager(smf.getManagementAppId()).delete(userRef); return true; }
@Ignore( "Pending https://issues.apache.org/jira/browse/USERGRID-1120. ") // needs to have elasticsearch refreshes implemented @Test public void testIncrementAndDecrement() throws Exception { logger.info( "CounterIT.testIncrementAndDecrement" ); EntityManager em = app.getEntityManager(); assertNotNull( em ); final UUID applicationId = em.getApplicationId(); Map<String, Long> counters = em.getEntityCounters( applicationId ); assertEquals( null, counters.get( "application.collection.users" ) ); UUID uuid = UUIDUtils.newTimeUUID(); // UUID.(); Map<String, Object> userProperties = new HashMap<String, Object>(); userProperties.put( "name", "test-name" ); userProperties.put( "username", "test-username" ); userProperties.put( "email", "test-email" ); User user = ( User ) em.create( uuid, "user", userProperties ).toTypedEntity(); logger.debug( "user={}", user ); em.refreshIndex(); counters = em.getEntityCounters( applicationId ); assertEquals( new Long( 1 ), counters.get( "application.collection.users" ) ); em.delete( user ); em.refreshIndex(); counters = em.getEntityCounters( applicationId ); assertEquals( new Long( 0 ), counters.get( "application.collection.users" ) ); }
em.delete( user ); logger.info( "Entity deleted" );
results.getEntities().stream().forEach(entity -> { try { em.delete(entity); }catch (Exception e){
try { if ( oldAppEntity != null ) { managementEm.delete( oldAppEntity ); applicationIdCache.evictAppId( oldAppEntity.getName() );
emApp1.delete( importedThing );
for ( int i = 5; i < 10; i++ ) { Entity entity = r.getEntities().get( i ); em.delete( entity ); entityIds.remove( entity.getUuid() ); numDeleted++;
rootEm.delete( applicationInfo ); deletedApps.add( applicationInfo );
assertTrue(Double.parseDouble( entity.getMetadata("distance").toString())>0); em.delete(user);
assertEquals(0, listResults.size()); em.delete(user);
assertEquals(0, listResults.size()); em.delete(user);