use of org.apache.airavata.registry.core.app.catalog.model.GridftpDataMovement in project airavata by apache.
the class GridftpDataMovementResource method get.
@Override
public AppCatalogResource get(Object identifier) throws AppCatalogException {
EntityManager em = null;
try {
em = AppCatalogJPAUtils.getEntityManager();
em.getTransaction().begin();
AppCatalogQueryGenerator generator = new AppCatalogQueryGenerator(GRIDFTP_DATA_MOVEMENT);
generator.setParameter(GridftpDataMovementConstants.DATA_MOVEMENT_INTERFACE_ID, identifier);
Query q = generator.selectQuery(em);
GridftpDataMovement gridftpDataMovement = (GridftpDataMovement) q.getSingleResult();
GridftpDataMovementResource gridftpDataMovementResource = (GridftpDataMovementResource) AppCatalogJPAUtils.getResource(AppCatalogResourceType.GRIDFTP_DATA_MOVEMENT, gridftpDataMovement);
em.getTransaction().commit();
if (em.isOpen()) {
if (em.getTransaction().isActive()) {
em.getTransaction().rollback();
}
em.close();
}
return gridftpDataMovementResource;
} catch (ApplicationSettingsException e) {
logger.error(e.getMessage(), e);
throw new AppCatalogException(e);
} finally {
if (em != null && em.isOpen()) {
if (em.getTransaction().isActive()) {
em.getTransaction().rollback();
}
em.close();
}
}
}
Aggregations