:
CAppTask(
"Project Service Concurrency Test",
true),
56m_SrvLocator(srv_locator),
72 LOG_POST(
Info<<
"CProjectServiceTestTask::x_Run() - BEGIN");
79disp.
StartJob(*job,
"ThreadPool");
82disp.
StartJob(*job,
"ThreadPool");
85disp.
StartJob(*job,
"ThreadPool");
88disp.
StartJob(*job,
"ThreadPool");
90 LOG_POST(
Info<<
"CProjectServiceTestTask::x_Run() - BEGIN(completed)");
101m_ProjectService(service),
109sType =
"eCreateItems";
113sType =
"eModifyItems";
117sType =
"eDeleteItems";
121sType =
"ePrintItems";
125 m_Descr=
"Test Job - "+ sType;
131 static const char* kLogMsg =
"CProjectServiceTestJob::Run() - exception in x_Run() ";
132 static stringkErrorMsg =
"Unhandled exception in CProjectServiceTestJob::Run()";
176 if(err_msg.empty()) {
179 strings = kErrorMsg + err_msg;
187vector<int> projectIds;
190 if(doc && doc->IsLoaded()) {
191projectIds.push_back(doc->GetId());
204doc->SetDescr().SetTitle(new_name);
208doc->SetCreateDate(date);
209doc->SetModifiedDate(date);
214srv->x_OnProjectChanged(doc->GetId());
215srv->x_OnWorkspaceChanged(ws.
GetId());
223 static intitem_counter = 0;
240 if(projectIds.empty()) {
247 for(
size_t i= 0;
i< projectIds.size();
i++) {
253 static intkItemsN = 2;
254 LOG_POST(
Info<<
"Creating "<< kItemsN <<
" items in project "<< doc->GetDescr().GetTitle());
256 for(
intj = 0; j < kItemsN; j++ ) {
258 id->Set(
"19568015");
265doc->AddItem(*item, data_folder);
268doc->SetDirty(
true);
297 for(
size_t i= 0;
i< projectIds.size();
i++) {
300 LOG_POST(
Info<<
"Renaming items "<< doc->GetDescr().GetTitle());
308 if((*it)->IsSetLabel())
309name = (*it)->GetLabel();
311string::size_type pos = name.find_first_of(
':');
312 if(pos != string::npos) {
316(*it)->SetLabel(doc->MakeUniqueItemLabel(name));
320doc->SetDirty(
true);
348 for(
size_t i= 0;
i< projectIds.size();
i++) {
351 LOG_POST(
Info<<
"Deleting items from project "<< doc->GetDescr().GetTitle());
355vector<int> projectItems;
357projectItems.push_back((*it)->GetId());
359 ITERATE(vector<int>, it, projectItems) {
368doc->SetDirty(
true);
394 for(
size_t i= 0;
i< projectIds.size();
i++) {
397 LOG_POST(
Info<<
m_Descr<<
" printing items in project "<< doc->GetDescr().GetTitle());
User-defined methods of the data storage class.
User-defined methods of the data storage class.
User-defined methods of the data storage class.
CAppJobError Default implementation for IAppJobError - encapsulates a text error message.
CAppJob - default implementation of IAppJob that could be used as a base class.
CAppTask - default implementation of IAppTask, use it as a base class for custom tasks.
void DetachProjectItem(objects::CProjectItem *item)
virtual void CreateProjectScope()
bool RemoveProjectItem(objects::CProjectItem *item)
void AttachProjectItem(objects::CProjectItem *item)
string MakeUniqueProjectTitle(const string &label) const
Create a unique label for a project.
CProjectItem * FindProjectItemById(CProjectItem::TId id)
void SetObject(CSerialObject &object)
wrapper for setting the object pointed to by this item
CProjectServiceTestJob(CProjectService *service, EType type, int sleep_ms)
CProjectServiceTestJob.
CProjectService * m_ProjectService
virtual EJobState Run()
Function that does all the useful work, called by the Engine.
IServiceLocator * m_SrvLocator
overriding CAppTask::x_Run()
CProjectServiceTestTask(IServiceLocator *srv_locator)
virtual ETaskState x_Run()
override this function in derived classes
virtual ~CProjectServiceTestTask()
CProjectService * m_Service
CProjectService - a service providing API for operations with Workspaces and Projects.
CRef< objects::CGBWorkspace > GetGBWorkspace()
Template class for iteration on objects of class C (non-medifiable version)
IServiceLocator - an abstract mechanism for locating services.
#define ITERATE(Type, Var, Cont)
ITERATE macro to sequence through container elements.
#define NON_CONST_ITERATE(Type, Var, Cont)
Non constant version of ITERATE macro.
#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< T > GetServiceByType()
retrieves a typed reference to a service, the name of C++ type is used as the name of the service.
ETaskState
List of task states defining the task management FSM.
@ eCompleted
successfully finished
CRef< CAppJobError > m_Error
string m_Descr
mutex to sync our internals
static CAppJobDispatcher & GetInstance()
virtual void x_ResetState()
virtual bool IsCanceled() const override
EJobState
Job states (describe FSM)
TJobID StartJob(IAppJob &job, const string &engine_name, IEngineParams *params=NULL)
Starts a Job on the specified engine in "passive mode" - no notifications or progress reports will be...
virtual string GetDescr() const override
Returns a human readable description of the Job (optional)
void Reset(void)
Reset reference object.
#define END_NCBI_SCOPE
End previously defined NCBI scope.
#define BEGIN_NCBI_SCOPE
Define ncbi namespace.
static string IntToString(int value, TNumToStringFlags flags=0, int base=10)
Convert int to string.
@ eCurrent
Use current time. See also CCurrentTime.
static const char label[]
list< CRef< CProjectItem > > TItems
void SetLabel(const TLabel &value)
Assign a value to Label data member.
TId GetId(void) const
Get the Id member data.
const TLabel & GetLabel(void) const
Get the Label member data.
bool CanGetItems(void) const
Check if it is safe to call GetItems method.
const TItems & GetItems(void) const
Get the Items member data.
TItems & SetItems(void)
Assign a value to Items data member.
void SetWorkspace(TWorkspace &value)
Assign a value to Workspace data member.
void SleepMilliSec(unsigned long ml_sec, EInterruptOnSignal onsignal=eRestartOnSignal)
Defines classes: CDirEntry, CFile, CDir, CSymLink, CMemoryFile, CFileUtil, CFileLock,...
static CRef< CGBDocument > s_CreateNewProject(CProjectService *srv, CGBWorkspace &ws)
static vector< int > s_GetProjectIds(const CWorkspaceFolder &folder)
RetroSearch is an open source project built by @garambo | Open a GitHub Issue
Search and Browse the WWW like it's 1997 | Search results from DuckDuckGo
HTML:
3.2
| Encoding:
UTF-8
| Version:
0.7.4