@Test public void doInHibernateDoesNothingWhenFamiliesHaveNoPedigreeBaseObjects() throws XWikiException { when(this.query.list()).thenReturn(Collections.singletonList(FAMILY_1)); when(this.xDocument1.getXObject(any(EntityReference.class))).thenReturn(null); this.component.doInHibernate(this.session); verify(this.xwiki, times(1)).getDocument(any(DocumentReference.class), any(XWikiContext.class)); verify(this.xDocument1, times(1)).getXObject(any(EntityReference.class)); verifyNoMoreInteractions(this.xwiki, this.xDocument1); }
@Override public Object doInHibernate(final Session session) throws HibernateException, XWikiException { final Query query = session.createQuery("select distinct o.name from BaseObject o where o.className= '" + this.serializer.serialize(PEDIGREE_CLASS_REFERENCE) + "' and o.name <> 'PhenoTips.FamilyTemplate'"); @SuppressWarnings("unchecked") List<String> docs = query.list(); this.logger.debug("Found {} documents", docs.size()); final XWikiContext context = getXWikiContext(); final XWiki xwiki = context.getWiki(); docs.forEach(docName -> migrateFamily(docName, session, context, xwiki)); return null; }
R71506PhenoTips3292DataMigration extends AbstractHibernateDataMigration implements HibernateCallback<Object> { @Override public Object doInHibernate(final Session session) throws HibernateException, XWikiException { final Query query = session.createQuery("select distinct o.name from BaseObject o where o.className= '" + this.serializer.serialize(PEDIGREE_CLASS_REFERENCE) + "' and o.name <> 'PhenoTips.FamilyTemplate'"); @SuppressWarnings("unchecked") List<String> docs = query.list(); this.logger.debug("Found {} documents", docs.size()); final XWikiContext context = getXWikiContext(); final XWiki xwiki = context.getWiki(); docs.forEach(docName -> migrateFamily(docName, session, context, xwiki)); return null; } }
R71506PhenoTips3292DataMigration extends AbstractHibernateDataMigration implements HibernateCallback<Object> { @Override public Object doInHibernate(final Session session) throws HibernateException, XWikiException { final Query query = session.createQuery("select distinct o.name from BaseObject o where o.className= '" + this.serializer.serialize(PEDIGREE_CLASS_REFERENCE) + "' and o.name <> 'PhenoTips.FamilyTemplate'"); @SuppressWarnings("unchecked") List<String> docs = query.list(); this.logger.debug("Found {} documents", docs.size()); final XWikiContext context = getXWikiContext(); final XWiki xwiki = context.getWiki(); docs.forEach(docName -> migrateFamily(docName, session, context, xwiki)); return null; }  }
R71506PhenoTips3292DataMigration extends AbstractHibernateDataMigration implements HibernateCallback<Object> { @Override public Object doInHibernate(final Session session) throws HibernateException, XWikiException { final Query query = session.createQuery("select distinct o.name from BaseObject o where o.className= '" + this.serializer.serialize(PEDIGREE_CLASS_REFERENCE) + "' and o.name <> 'PhenoTips.FamilyTemplate'"); @SuppressWarnings("unchecked") List<String> docs = query.list(); this.logger.debug("Found {} documents", docs.size()); final XWikiContext context = getXWikiContext(); final XWiki xwiki = context.getWiki(); docs.forEach(docName -> migrateFamily(docName, session, context, xwiki)); return null; }  @Override Object doInHibernate(final Session session); @Override String getDescription(); @Override XWikiDBVersion getVersion(); }
R71506PhenoTips3292DataMigration extends AbstractHibernateDataMigration implements HibernateCallback<Object> { @Override public Object doInHibernate(final Session session) throws HibernateException, XWikiException { final Query query = session.createQuery("select distinct o.name from BaseObject o where o.className= '" + this.serializer.serialize(PEDIGREE_CLASS_REFERENCE) + "' and o.name <> 'PhenoTips.FamilyTemplate'"); @SuppressWarnings("unchecked") List<String> docs = query.list(); this.logger.debug("Found {} documents", docs.size()); final XWikiContext context = getXWikiContext(); final XWiki xwiki = context.getWiki(); docs.forEach(docName -> migrateFamily(docName, session, context, xwiki)); return null; }  @Override Object doInHibernate(final Session session); @Override String getDescription(); @Override XWikiDBVersion getVersion();  }