HashMap<String, String> ids;
if (identifier instanceof Map) {
ids = (HashMap<String, String>) identifier;
} else {
logger.error("Identifier should be a map with the field name and it's value");
throw new AppCatalogException("Identifier should be a map with the field name and it's value");
}
EntityManager em = null;
try {
em = AppCatalogJPAUtils.getEntityManager();
em.getTransaction().begin();
AppCatalogQueryGenerator generator = new AppCatalogQueryGenerator(GRIDFTP_ENDPOINT);
generator.setParameter(GridftpEndpointConstants.ENDPOINT, ids.get(GridftpEndpointConstants.ENDPOINT));
generator.setParameter(GridftpEndpointConstants.DATA_MOVEMENT_INTERFACE_ID, ids.get(GridftpEndpointConstants.DATA_MOVEMENT_INTERFACE_ID));
Query q = generator.selectQuery(em);
GridftpEndpoint gridftpEndpoint = (GridftpEndpoint) q.getSingleResult();
GridftpEndpointResource gridftpEndpointResource = (GridftpEndpointResource) AppCatalogJPAUtils.getResource(AppCatalogResourceType.GRIDFTP_ENDPOINT, gridftpEndpoint);
em.getTransaction().commit();
em.close();
return gridftpEndpointResource;
} 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();
}