RequestRunInfo.cpp
2.82 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
#include "RequestRunInfo.h"
#include "../TimeManager/TimeManager.h"
#include "../Transformation/TransformationRequest.h"
using namespace TREPS::TimeManager;
using namespace TREPS::Transformation;
namespace TREPS
{
namespace RequestManager
{
RequestRunInfoClass::RequestRunInfoClass(void) : success(false), info()
{
this->info.srcVectors.clear();
}
RequestRunInfoClass::~RequestRunInfoClass(void)
{
this->info.srcVectors.clear();
}
string RequestRunInfoClass::getRequestId(void)
{
return "run_info";
}
bool RequestRunInfoClass::load(RequestLoaderClass *loader)
{
this->success = false;
this->info.srcVectors.clear();
//init request and lock working dir
if (!this->initOpId(loader,true))
{
LOG4CXX_ERROR(this->app->getLog()->getPtr(),"Cannot get op Id");
return false;
}
//get transformation request file path (to load information about the transformation request)
string requestPath = this->dirMgr->getTransformationRequestFromId(this->opId.c_str());
if (requestPath.compare("") == 0)
{
LOG4CXX_ERROR(this->app->getLog()->getPtr(),"Error to get transformation request path");
return false;
}
//get time manager instance
TimeManagerClass *timeMgr = TimeManagerClass::getInstance();
//load information about transformation request
TransformationRequestClass *transRequest = new TransformationRequestClass();
this->success = transRequest->loadFromFile(requestPath.c_str());
if (this->success)
{
this->info.srcFrame = transRequest->getSrcFrame();
this->info.dstFrame = transRequest->getDstFrame();
for (t_VectorList::iterator it=transRequest->getSrcVectors()->begin(); it != transRequest->getSrcVectors()->end(); ++it)
this->info.srcVectors.push_back(*it);
this->info.timeFieldId = transRequest->getTimeFieldId();
this->info.timeFormatId = timeMgr->getTimeIdFromFormatAndPattern(transRequest->getTimeFormat(),
transRequest->getTimePattern().c_str());
this->info.timePattern = transRequest->getTimePattern();
}
else
{
LOG4CXX_ERROR(this->app->getLog()->getPtr(),"Cannot load information about transformation request");
}
delete transRequest;
return this->success;
}
bool RequestRunInfoClass::run(void)
{
//nothing to do
return this->success;
}
void RequestRunInfoClass::writeResult(ResultWriterClass *writer)
{
if (!this->success)
writer->setError("Cannot get transformation info");
else
{
writer->setSuccess();
writer->addTransformationInfoArg("info",this->info);
}
}
string RequestRunInfoClass::getResultFileSuffix(void)
{
//nothing to do
return "";
}
string RequestRunInfoClass::getXMLFilePath(void)
{
//nothing to do
return "";
}
string RequestRunInfoClass::getStringResult(void)
{
//nothing to do
return "";
}
}
}