if ( user == null ) { user = new Experimenter(); user.setOmeName(UUID.randomUUID().toString()); user.setFirstName("Get"); user.setLastName("Images"); user = iAdmin.createUser(user); }
    public void test_createObjects() throws Exception    {        // Forcing setup once now.        adaptSetUp();        // ~ ALL ROOT OBJECTS        // =====================================================================                loginRoot();        Project p1 = createProject();        Dataset d1 = createDataset();        Dataset d2 = createDataset();        Image i_d1 = createImage();        Image i_d2 = createImage();                p1.linkDataset( d1 );        p1.linkDataset( d2 );        d1.linkImage( i_d1 );        d2.linkImage( i_d2 );                rootOnlyMap.put(p1,i_d1);        rootOnlyMap.put(d1,i_d1);        rootOnlyMap.put(p1,i_d2);        rootOnlyMap.put(d2,i_d2);                CategoryGroup cg1 = createCategoryGroup();        Category c1 = createCategory();        Category c2 = createCategory();        Image i_c1 = createImage();        Image i_c2 = createImage();                cg1.linkCategory(c1);        cg1.linkCategory(c2);        c1.linkImage(i_c1);        c2.linkImage(i_c2);        rootOnlyMap.put(cg1,i_c1);        rootOnlyMap.put(c1,i_c1);        rootOnlyMap.put(cg1,i_c2);        rootOnlyMap.put(c2,i_c2);                // Saving the newly created links.        iUpdate.saveArray(new IObject[]{p1,d1,d2,i_d1,i_d2,cg1,c1,c2,i_c1,i_c2});        // ~ USER FILTER        // =====================================================================                // TODO submit bug. leaving out the e of "Experimenter e" throws a         // null pointer exception in org.hibernate.hql.ast.*        user = (Experimenter) iQuery.findByQuery(                "select e from Experimenter e " +                "where e.id != 0",                new Parameters( new Filter().unique().page(0,1)));        userPO = new PojoOptions().exp( user.getId() );        filterForUser = new Parameters().addOptions( userPO.map() );        noFilter = new Parameters().addOptions( null );        // ~ MIXED ROOT/USER ITEMS        // =====================================================================        loginRoot();        Project p1_root = createProject();        Dataset d1_root = createDataset();        Dataset d2_root = createDataset();        Image i_d1_root = createImage();        Image i_d2_root = createImage();                p1_root.linkDataset( d1_root );        p1_root.linkDataset( d2_root );        d1_root.linkImage( i_d1_root );        d2_root.linkImage( i_d2_root );                rootProjectMap.put(p1_root,i_d1_root);        rootProjectMap.put(d1_root,i_d1_root);        rootProjectMap.put(p1_root,i_d2_root);        rootProjectMap.put(d2_root,i_d2_root);                loginUser(user.getOmeName());        Image i_d1_user = createImage();        Image i_d2_user = createImage();                p1_root.linkDataset( d1_root );        p1_root.linkDataset( d2_root );        d1_root.linkImage( i_d1_user );        d2_root.linkImage( i_d2_user );                userImageRootProjectMap.put(p1_root,i_d1_user);        userImageRootProjectMap.put(d1_root,i_d1_user);        userImageRootProjectMap.put(p1_root,i_d2_user);        userImageRootProjectMap.put(d2_root,i_d2_user);        Project p11_user = createProject();        Dataset d11_user = createDataset();        Dataset d22_user = createDataset();        Image i_d11_user = createImage();        Image i_d22_user = createImage();                p11_user.linkDataset( d11_user );        p11_user.linkDataset( d22_user );        d11_user.linkImage( i_d11_user );        d22_user.linkImage( i_d22_user );                userProjectMap.put(p11_user,i_d11_user);        userProjectMap.put(d11_user,i_d11_user);        userProjectMap.put(p11_user,i_d22_user);        userProjectMap.put(d22_user,i_d22_user);        // TODO not working.//        setUser( user, //        i_d1_user,i_d2_user,//        p11_user,d11_user,d22_user,i_d11_user,i_d22_user);                // omitting CGC for now since this is only testing "enableFilters"                loginRoot();                // Saving the newly created links.        iUpdate.saveArray(                new IObject[]{                        p1_root,d1_root,d2_root,i_d1_root,i_d2_root,                        i_d1_user,i_d2_user,                        p11_user,d11_user,d22_user,i_d11_user,i_d22_user});                adaptTearDown();    }