}
if ((patchName != null) && (moduleName != null) && (specVersion != null) && (nbVersion != null)) {
Utils.processPersistable(new Persistable.Transaction() {
public TransactionResult runQuery(EntityManager em) {
Nbversion entity = (Nbversion) PersistenceUtils.getExist(em, "Nbversion.findByVersion", nbVersion);
Patch newPatch = new Patch(patchName, moduleName, specVersion, entity);
em.persist(newPatch);
return TransactionResult.COMMIT;
}
});
} else {
if (moduleName != null) {
request.setAttribute("last_module_name", moduleName);
}
if (specVersion != null) {
request.setAttribute("last_spec_version", specVersion);
}
}
if (drop != null) {
final Integer dropId = Integer.parseInt(drop);
Utils.processPersistable(new Persistable.Transaction() {
public TransactionResult runQuery(EntityManager em) {
Patch removedPatch = em.find(Patch.class, dropId);
em.remove(removedPatch);
return TransactionResult.COMMIT;
}
});
}