@Override
public void save() throws AppCatalogException {
EntityManager em = null;
try {
em = AppCatalogJPAUtils.getEntityManager();
ResourceJobManager existingResourceJobManager = em.find(ResourceJobManager.class, resourceJobManagerId);
em.close();
ResourceJobManager resourceJobManager;
em = AppCatalogJPAUtils.getEntityManager();
em.getTransaction().begin();
if (existingResourceJobManager == null) {
resourceJobManager = new ResourceJobManager();
} else {
resourceJobManager = existingResourceJobManager;
}
resourceJobManager.setResourceJobManagerId(getResourceJobManagerId());
resourceJobManager.setPushMonitoringEndpoint(getPushMonitoringEndpoint());
resourceJobManager.setJobManagerBinPath(getJobManagerBinPath());
resourceJobManager.setResourceJobManagerType(getResourceJobManagerType());
if (existingResourceJobManager == null) {
em.persist(resourceJobManager);
} else {
em.merge(resourceJobManager);
}