@Override
public void save() throws AppCatalogException {
EntityManager em = null;
try {
em = AppCatalogJPAUtils.getEntityManager();
ComputeResourceFileSystem existingComputeResourceFileSystem = em.find(ComputeResourceFileSystem.class, new ComputeResourceFileSystem_PK(computeResourceId, fileSystem));
em.close();
ComputeResourceFileSystem computeResourceFileSystem;
em = AppCatalogJPAUtils.getEntityManager();
em.getTransaction().begin();
if (existingComputeResourceFileSystem == null) {
computeResourceFileSystem = new ComputeResourceFileSystem();
} else {
computeResourceFileSystem = existingComputeResourceFileSystem;
}
computeResourceFileSystem.setComputeResourceId(getComputeResourceId());
ComputeResource computeResource = em.find(ComputeResource.class, getComputeResourceId());
computeResourceFileSystem.setComputeResource(computeResource);
computeResourceFileSystem.setPath(getPath());
computeResourceFileSystem.setFileSystem(getFileSystem());
if (existingComputeResourceFileSystem == null) {
em.persist(computeResourceFileSystem);
} else {
em.merge(computeResourceFileSystem);
}