本文整理汇总了C++中Owned::createWorkUnit方法的典型用法代码示例。如果您正苦于以下问题:C++ Owned::createWorkUnit方法的具体用法?C++ Owned::createWorkUnit怎么用?C++ Owned::createWorkUnit使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Owned
的用法示例。
在下文中一共展示了Owned::createWorkUnit方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: createBrowseWU
bool QueryDataSource::createBrowseWU()
{
StringAttr dataset, datasetDefs;
StringAttrAdaptor a1(dataset), a2(datasetDefs);
wuResult->getResultDataset(a1, a2);
if (!dataset || !datasetDefs)
return false;
StringBuffer fullText;
fullText.append(datasetDefs).append(dataset);
OwnedHqlExpr parsed = parseQuery(fullText.str());
if (!parsed)
return false;
HqlExprAttr selectFields = parsed.getLink();
if (selectFields->getOperator() == no_output)
selectFields.set(selectFields->queryChild(0));
OwnedHqlExpr browseWUcode = buildQueryViewerEcl(selectFields);
if (!browseWUcode)
return false;
returnedRecord.set(browseWUcode->queryChild(0)->queryRecord());
StringAttr tempAttr;
StringAttrAdaptor temp(tempAttr);
Owned<IWorkUnitFactory> factory = getWorkUnitFactory();
Owned<IConstWorkUnit> parent = factory->openWorkUnit(wuid, false);
SCMStringBuffer user;
StringAttrAdaptor acluster(cluster);
parent->getClusterName(acluster);
parent->getUser(user);
Owned<IWorkUnit> workunit = factory->createWorkUnit(NULL, "fileViewer", user.str());
workunit->setUser(user.str());
workunit->setClusterName(cluster);
workunit->setCustomerId(parent->getCustomerId(temp).str());
workunit->setCompareMode(CompareModeOff); // ? parent->getCompareMode()
StringAttrAdaptor bwa(browseWuid); workunit->getWuid(bwa);
workunit->setDebugValueInt("importImplicitModules", false, true);
workunit->setDebugValueInt("importAllModules", false, true);
workunit->setDebugValueInt("forceFakeThor", 1, true);
StringBuffer jobName;
jobName.append("FileView for ").append(wuid).append(":").append("x");
workunit->setJobName(jobName.str());
StringBuffer eclText;
toECL(browseWUcode, eclText, true);
Owned<IWUQuery> query = workunit->updateQuery();
query->setQueryText(eclText.str());
query->setQueryName(jobName.str());
return true;
}
示例2: onRunEclEx
bool CEclDirectEx::onRunEclEx(IEspContext &context, IEspRunEclExRequest & req, IEspRunEclExResponse & resp)
{
if (!context.validateFeatureAccess(ECLDIRECT_ACCESS, SecAccess_Full, false))
throw MakeStringException(-1, "EclDirect access permission denied.");
const char* eclText = req.getEclText();
if (!eclText || !*eclText)
{
resp.setResults("<Exception><Source>ESP</Source><Message>No Ecl Text provided</Message></Exception>");
return true;
}
StringBuffer user;
if (!context.getUserID(user).length())
user.append(req.getUserName());
Owned <IWorkUnitFactory> factory = getWorkUnitFactory(context.querySecManager(), context.queryUser());
Owned <IWorkUnit> workunit;
if (!user.length())
workunit.setown(factory->createWorkUnit(NULL, "ECL-Direct", ""));
else
{
workunit.setown(factory->createWorkUnit(NULL, "ECL-Direct", user.str()));
workunit->setUser(user.str());
}
Owned<IWUQuery> query = workunit->updateQuery();
query->setQueryText(eclText);
query.clear();
const char* cluster = req.getCluster();
if (!cluster || !*cluster || !stricmp(cluster, "default"))
cluster = defaultCluster.str();
if (!cluster || !*cluster)
throw MakeStringException(-1, "No Cluster Specified");
if (!isValidCluster(cluster))
throw MakeStringException(-1, "Invalid TargetCluster %s Specified", cluster);
workunit->setClusterName(cluster);
const char* snapshot = req.getSnapshot();
if (snapshot && *snapshot)
workunit->setSnapshot(snapshot);
if (req.getResultLimit())
workunit->setResultLimit(req.getResultLimit());
// Execute it
SCMStringBuffer wuid;
workunit->getWuid(wuid);
workunit->setAction(WUActionRun);
workunit->setState(WUStateSubmitted);
workunit.clear();
resp.setWuid(wuid.str());
submitWorkUnit(wuid.str(), context.querySecManager(), context.queryUser());
if (!waitForWorkUnitToComplete(wuid.str(), (req.getWait_isNull()) ? defaultWait : req.getWait()))
{
StringBuffer result;
result.appendf("<Exception><Source>ESP</Source><Message>Timed out waiting for job to complete: %s</Message></Exception>", wuid.str());
resp.setResults(result.str());
return true;
}
if (!deleteWorkunits && context.queryRequestParameters()->hasProp("redirect"))
{
StringBuffer url("/WsWorkunits/WUInfo?Wuid=");
resp.setRedirectUrl(url.append(wuid).str());
return true;
}
Owned<IConstWorkUnit> cw = factory->openWorkUnit(wuid.str(), false);
EclDirectWUExceptions errors(*cw);
resp.setErrors(errors);
if (req.getIncludeResults())
{
StringBuffer results;
CRunEclExFormat outputFormat = req.getFormat();
Owned<IWuWebView> web = createWuWebView(wuid.str(), NULL, NULL, getCFD(), true);
if (!web)
results.appendf("<Exception><Source>ESP</Source><Message>Failed loading result workunit %s</Message></Exception>", wuid.str());
else if (outputFormat == CRunEclExFormat_Table)
{
StringBuffer xsltfile(getCFD());
web->applyResultsXSLT(xsltfile.append("xslt/wsecl3_result.xslt").str(), results);
}
else
{
unsigned xmlflags = 0;
if (outputFormat != CRunEclExFormat_ExtendedXml)
xmlflags |= WWV_OMIT_SCHEMAS;
if (context.queryRequestParameters()->hasProp("display_xslt"))
xmlflags |= WWV_USE_DISPLAY_XSLT;
else
xmlflags |= WWV_OMIT_XML_DECLARATION;
//.........这里部分代码省略.........
示例3: onRunEcl
bool CEclDirectEx::onRunEcl(IEspContext &context, IEspRunEclRequest & req, IEspRunEclResponse & resp)
{
if (!context.validateFeatureAccess(ECLDIRECT_ACCESS, SecAccess_Full, false))
throw MakeStringException(-1, "EclDirect access permission denied.");
StringBuffer user;
if (!context.getUserID(user).length())
user.append(req.getUserName());
Owned <IWorkUnitFactory> factory = getWorkUnitFactory(context.querySecManager(), context.queryUser());
Owned <IWorkUnit> workunit;
if (!user.length())
workunit.setown(factory->createWorkUnit(NULL, "ECL-Direct", ""));
else
{
workunit.setown(factory->createWorkUnit(NULL, "ECL-Direct", user.str()));
workunit->setUser(user.str());
}
Owned<IWUQuery> query = workunit->updateQuery();
query->setQueryText(req.getEclText());
query.clear();
const char* clustername = req.getCluster();
if (!clustername || !*clustername || strieq(clustername, "default"))
clustername = defaultCluster.str();
if (!clustername || !*clustername)
throw MakeStringException(-1, "No Cluster Specified");
if (!isValidCluster(clustername))
throw MakeStringException(-1, "Invalid TargetCluster %s Specified", clustername);
workunit->setClusterName(clustername);
if (req.getLimitResults())
workunit->setResultLimit(100);
const char* snapshot = req.getSnapshot();
if (snapshot && *snapshot)
workunit->setSnapshot(snapshot);
// Execute it
SCMStringBuffer wuid;
workunit->getWuid(wuid);
workunit->setAction(WUActionRun);
workunit->setState(WUStateSubmitted);
workunit.clear();
submitWorkUnit(wuid.str(), context.querySecManager(), context.queryUser());
if (waitForWorkUnitToComplete(wuid.str(), defaultWait))
{
Owned<IConstWorkUnit> cw = factory->openWorkUnit(wuid.str(), false);
SCMStringBuffer resultXML;
getFullWorkUnitResultsXML(context.queryUserId(), context.queryPassword(), cw.get(), resultXML);
resp.setResults(resultXML.str());
cw.clear();
if (deleteWorkunits)
deleteEclDirectWorkunit(factory, wuid.str());
}
else
{
// Don't delete these ones...
DBGLOG("WorkUnit %s timed out", wuid.str());
StringBuffer result;
result.appendf("<Exception><Source>ESP</Source><Message>Timed out waiting for job to complete: %s</Message></Exception>", wuid.str());
resp.setResults(result.str());
}
return true;
}