HashMap<String, String> ids;
if (identifier instanceof Map){
ids = (HashMap)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(GSISSH_PREJOBCOMMAND);
generator.setParameter(GSISSHPreJobCommandConstants.SUBMISSION_ID,
ids.get(GSISSHPreJobCommandConstants.SUBMISSION_ID));
generator.setParameter(GSISSHPreJobCommandConstants.COMMAND, ids.get(GSISSHPreJobCommandConstants.COMMAND));
Query q = generator.selectQuery(em);
GSISSHPreJobCommand gsisshPreJobCommand = (GSISSHPreJobCommand) q.getSingleResult();
GSISSHPreJobCommandResource gsisshPreJobCommandResource =
(GSISSHPreJobCommandResource) AppCatalogJPAUtils.getResource(
AppCatalogResourceType.GSISSH_PREJOBCOMMAND, gsisshPreJobCommand);
em.getTransaction().commit();
em.close();
return gsisshPreJobCommandResource;
} 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();
}