/** @see salomon.engine.task.ITaskManager#addTask(salomon.platform.task.ITask) */ public void addTask(ITask task) throws PlatformException { try { task.getInfo().save(); _dbManager.commit(); } catch (Exception e) { _dbManager.rollback(); LOGGER.fatal("", e); throw new PlatformException(e.getLocalizedMessage()); } _tasks.add(task); }
public void saveTasks() throws PlatformException { try { for (ITask task : _tasks) { ((Task) task).getInfo().save(); } _dbManager.commit(); } catch (Exception e) { _dbManager.rollback(); LOGGER.fatal("", e); throw new PlatformException(e.getLocalizedMessage()); } }
public void testDelete() { LOGGER.debug("DescriptionTest.testDelete()"); boolean success = false; // PluginInfo desc = new PluginInfo(); // desc.setPluginID(40); try { // desc.delete(); success = true; _manager.commit(); } catch (Exception e) { LOGGER.fatal("", e); _manager.rollback(); } assertTrue(success); }
/** * Removes given tasks. * * @see salomon.engine.task.ITaskManager#removeTask(salomon.engine.task.ITask) */ public boolean removeTask(ITask task) throws PlatformException { SQLDelete delete = new SQLDelete(TaskInfo.TABLE_NAME); IProject currProject = _managerEngine.getProjectManager().getCurrentProject(); delete.addCondition("project_id =", currProject.getInfo().getId()); delete.addCondition("task_id = ", task.getInfo().getId()); boolean retVal = false; int deletedRows = 0; try { deletedRows = _dbManager.delete(delete); _dbManager.commit(); // removing from list _tasks.remove(task); retVal = (deletedRows > 0); } catch (SQLException e) { _dbManager.rollback(); LOGGER.fatal("", e); throw new PlatformException(e.getLocalizedMessage()); } return retVal; }
public void testSave() { LOGGER.debug("DescriptionTest.testSave()"); boolean success = false; // PluginInfo desc = new PluginInfo(); // desc.setName("test_plugin"); // try { // desc.setLocation(new URL("http://www.test_description.pl")); // success = true; // } catch (MalformedURLException e) { // LOGGER.fatal("", e); // } assertTrue(success); success = false; try { // desc.save(); _manager.commit(); success = true; } catch (Exception e) { LOGGER.fatal("", e); _manager.rollback(); } assertTrue(success); }