@Override
public void save() throws AppCatalogException {
EntityManager em = null;
try {
em = AppCatalogJPAUtils.getEntityManager();
DataMovementInterface existingDataMovementInterface = em.find(DataMovementInterface.class, new DataMovementInterface_PK(computeResourceId, dataMovementInterfaceId));
em.close();
DataMovementInterface dataMovementInterface;
em = AppCatalogJPAUtils.getEntityManager();
em.getTransaction().begin();
if (existingDataMovementInterface == null) {
dataMovementInterface = new DataMovementInterface();
} else {
dataMovementInterface = existingDataMovementInterface;
}
dataMovementInterface.setComputeResourceId(getComputeResourceId());
ComputeResource computeResource = em.find(ComputeResource.class, getComputeResourceId());
dataMovementInterface.setComputeResource(computeResource);
dataMovementInterface.setDataMovementProtocol(getDataMovementProtocol());
dataMovementInterface.setDataMovementInterfaceId(getDataMovementInterfaceId());
dataMovementInterface.setPriorityOrder(getPriorityOrder());
if (existingDataMovementInterface == null) {
em.persist(dataMovementInterface);
} else {
em.merge(dataMovementInterface);
}