42 #include <wx/dirdlg.h>
73 static const char* kLogMsg =
"CDataLoadingAppJob::x_Run() - exception ";
78 bool err_user_level =
false;
87 err_user_level =
true;
89 }
catch( std::exception& ee ){
90 err_msg = kLogMsg +
GetDescr() +
". " + ee.what();
93 err_user_level =
false;
98 if( !err_msg.empty() ){
107 <<
"CDataLoadingAppJob::Run(): Finished job " <<
m_Descr
195 :
CAppJobTask( job,
true, descr.
empty() ? job.GetDescr() : descr ), m_Service(service), m_Options(options)
220 vector<CRef<CProjectItem> > items;
223 items.push_back(*it2);
229 wxString resTitle, resHTML;
232 if (!resHTML.empty()) {
CAppJobError Default implementation for IAppJobError - encapsulates a text error message.
CAppJobProgress Default implementation for IAppJobProgress - the class encapsulates a text message an...
CAppJobTask CAppJobTask is an adapter that allows for running IAppJobs as Tasks in App Task Service.
CAppJobTextResult Default implementation for result object - encapsulates a text error message.
CDataLoadingAppJobProgress(const TData &data, float done, const string &text)
const TData & GetData() const
CDataLoadingAppJob - a base class for Jobs loading data into projects.
virtual void x_ResetState()
prepares job for execution by clearing state variables
void AddProjectItem(objects::CProjectItem &item)
virtual CRef< CObject > GetResult()
Returns the Job Result.
void AddDataLoader(objects::CLoaderDescriptor &loader)
virtual EJobState Run()
Function that does all the useful work, called by the Engine.
virtual void x_CreateProjectItems()=0
override this function in derived classes and populate m_Items.
virtual CConstIRef< IAppJobProgress > GetProgress()
implement Run() in derived classes, make sure that exceptions are handled and m_StopRequested flag is...
CSelectProjectOptions::TData m_Data
virtual ~CDataLoadingAppJob()
virtual void GetHTMLResults(wxString &, wxString &)
void x_SetTextResult(const string &result)
const CSelectProjectOptions::TData & GetData() const
CDataLoadingAppJob()
constructor for derived classes
CIRef< CProjectService > m_Service
CSelectProjectOptions m_Options
CDataLoadingAppTask(CProjectService *service, CSelectProjectOptions &options, CDataLoadingAppJob &job, const string &descr=kEmptyStr)
CDataLoadingAppTask.
virtual ETaskState Run()
we override this function because our logic is a bit more complex than one implemented in CAppJobTask...
void x_OnAppJobProgress(const IAppJobProgress &progress)
void SetHTML(wxString value)
bool Create(wxWindow *parent, wxWindowID id=10049, const wxString &caption=_("Job Results"), const wxPoint &pos=wxDefaultPosition, const wxSize &size=wxSize(400, 300), long style=wxCAPTION|wxRESIZE_BORDER|wxSYSTEM_MENU|wxCLOSE_BOX|wxTAB_TRAVERSAL)
static void PrefetchSeqDescr(IServiceLocator *serviceLocator, const vector< CRef< objects::CProjectItem > > &items)
CProjectService - a service providing API for operations with Workspaces and Projects.
CProjectSelectOptions - describes how new Project Items shall be added to a workspace.
bool AddItemsToWorkspace(CProjectService *service, const TData &data)
vector< TItemRef > TItems
#define ITERATE(Type, Var, Cont)
ITERATE macro to sequence through container elements.
#define LOG_POST(message)
This macro is deprecated and it's strongly recomended to move in all projects (except tests) to macro...
void Error(CExceptionArgs_Base &args)
const string & GetMsg(void) const
Get message string.
string ReportAll(TDiagPostFlags flags=eDPF_Exception) const
Report all exceptions.
void Info(CExceptionArgs_Base &args)
CIRef< IAppJob > GetJob()
ETaskState
List of task states defining the task management FSM.
void x_SetOnAppJobProgress(TOnAppJobProgressCallback callback)
virtual ETaskState Run()
execute the task, this function is called on the main UI thread if a task needs to execute in backgro...
@ eCanceled
canceled by Task Manager
@ eCompleted
successfully finished
CRef< CAppJobError > m_Error
string m_Descr
mutex to sync our internals
virtual void x_ResetState()
virtual bool IsCanceled() const override
virtual CConstIRef< IAppJobProgress > GetProgress() override
implement Run() in derived classes, make sure that exceptions are handled and m_StopRequested flag is...
EJobState
Job states (describe FSM)
virtual void x_SetStatusText(const string &text)
string m_Status
Current status of the Job.
virtual string GetDescr() const override
Returns a human readable description of the Job (optional)
CLockerGuard x_GetGuard()
TObjectType * GetPointer(void) THROWS_NONE
Get pointer,.
void Reset(void)
Reset reference object.
#define END_NCBI_SCOPE
End previously defined NCBI scope.
#define BEGIN_NCBI_SCOPE
Define ncbi namespace.
static void text(MDB_val *v)
constexpr bool empty(list< Ts... >) noexcept