Search in sources :

Example 6 with BulkUpload

use of org.jbei.ice.storage.model.BulkUpload in project ice by JBEI.

the class BulkUploadDAO method getEntryIds.

public List<Long> getEntryIds(BulkUpload upload) {
    try {
        CriteriaQuery<Long> query = getBuilder().createQuery(Long.class);
        Root<BulkUpload> from = query.from(BulkUpload.class);
        Join<BulkUpload, Entry> contents = from.join("contents");
        query.select(contents.get("id")).where(getBuilder().equal(from.get("id"), upload.getId()));
        return currentSession().createQuery(query).list();
    } catch (HibernateException e) {
        Logger.error(e);
        throw new DAOException(e);
    }
}
Also used : DAOException(org.jbei.ice.storage.DAOException) Entry(org.jbei.ice.storage.model.Entry) HibernateException(org.hibernate.HibernateException) BulkUpload(org.jbei.ice.storage.model.BulkUpload)

Example 7 with BulkUpload

use of org.jbei.ice.storage.model.BulkUpload in project ice by JBEI.

the class BulkUploadDAO method retrieveByStatus.

public List<BulkUpload> retrieveByStatus(BulkUploadStatus status) {
    try {
        CriteriaQuery<BulkUpload> query = getBuilder().createQuery(BulkUpload.class);
        Root<BulkUpload> from = query.from(BulkUpload.class);
        query.where(getBuilder().equal(from.get("status"), status));
        return currentSession().createQuery(query).list();
    } catch (HibernateException he) {
        Logger.error(he);
        throw new DAOException(he);
    }
}
Also used : DAOException(org.jbei.ice.storage.DAOException) HibernateException(org.hibernate.HibernateException) BulkUpload(org.jbei.ice.storage.model.BulkUpload)

Example 8 with BulkUpload

use of org.jbei.ice.storage.model.BulkUpload in project ice by JBEI.

the class BulkEntryCreatorTest method testCreateBulkUpload.

@Test
public void testCreateBulkUpload() throws Exception {
    Account account = AccountCreator.createTestAccount("testCreateBulkUpload", false);
    long id = creator.createBulkUpload(account.getEmail(), EntryType.PLASMID);
    Assert.assertTrue(id > 0);
    BulkUpload bulkUpload = DAOFactory.getBulkUploadDAO().get(id);
    Assert.assertNotNull(bulkUpload);
    Assert.assertEquals(BulkUploadStatus.IN_PROGRESS, bulkUpload.getStatus());
    Assert.assertEquals(account.getEmail(), bulkUpload.getAccount().getEmail());
}
Also used : Account(org.jbei.ice.storage.model.Account) BulkUpload(org.jbei.ice.storage.model.BulkUpload)

Aggregations

BulkUpload (org.jbei.ice.storage.model.BulkUpload)8 HibernateException (org.hibernate.HibernateException)5 DAOException (org.jbei.ice.storage.DAOException)5 Entry (org.jbei.ice.storage.model.Entry)5 BulkUploadDAO (org.jbei.ice.storage.hibernate.dao.BulkUploadDAO)2 Account (org.jbei.ice.storage.model.Account)2 BulkUploadAuthorization (org.jbei.ice.lib.bulkupload.BulkUploadAuthorization)1 BulkUploadInfo (org.jbei.ice.lib.bulkupload.BulkUploadInfo)1 PartData (org.jbei.ice.lib.dto.entry.PartData)1