@Override public boolean save(Workspace ws, boolean force) { if (ws.getDataSource() == null) return false; if (!saveWorkspace(ws)) return false; for (WorkspaceItem<?> item : ws.getItems()) { if (item.isDirty() || (force && !item.getStatus().isVolatile())) { if (!saveItem(item)) { return false; } } } return true; }
@Override public boolean saveItem(WorkspaceItem<?> item) { if (!item.getStatus().canBeSaved()) { return true; } List<IWorkspaceItemRepository> repos = getRepositories(item); if (repos == null) { return true; } for (IWorkspaceItemRepository repo : repos) { if (repo.save(item)) { return true; } } return false; }
@Override public boolean deleteItem(WorkspaceItem<?> item) { if (!item.getStatus().hasStorage()) { return true; } List<IWorkspaceItemRepository> repos = getRepositories(item); if (repos == null) { return true; } for (IWorkspaceItemRepository repo : repos) { if (repo.delete(item)) { return true; } } return false; }