bool EntityImporterBase::getEntity(const std::string & id, OpVector & res)
{
    std::map<std::string, Root>::const_iterator I = mPersistedEntities.find(id);
    if (I == mPersistedEntities.end()) {
        S_LOG_VERBOSE("Could not find entity with id " << id << "; this one was probably transient.");
        //This will often happen if the child entity was transient, and therefore wasn't exported (but is still references from the parent entity).
        return false;
    }
    const RootEntity& obj = smart_dynamic_cast<RootEntity>(I->second);
    if (!obj.isValid()) {
        S_LOG_FAILURE("Corrupt dump - non entity found " << id << ".");
        return false;
    }

    m_state = ENTITY_WALKING;
    mTreeStack.emplace_back(obj);

    Anonymous get_arg;
    get_arg->setId(id);
    get_arg->setObjtype("obj");

    Get get;
    get->setArgs1(get_arg);
    get->setFrom(mAccountId);
    get->setSerialno(newSerialNumber());
    res.push_back(get);
    S_LOG_VERBOSE("EntityImporterBase: Getting entity with id " << id);
    return true;
}
bool EntityImporterBase::getRule(const std::string & id, OpVector & res)
{
    auto I = mPersistedRules.find(id);
    if (I == mPersistedRules.end()) {
        S_LOG_WARNING("Could not find rule with id " << id << ".");
        return false;
    }

    auto definition = I->second;

    m_state = RULE_WALKING;

    std::list<std::string> children;
    extractChildren(definition, children);

    RuleStackEntry entry = { id, definition, children };
    mRuleStack.push_back(entry);

    Get get;
    Anonymous arg;
    arg->setId(id);
    get->setArgs1(arg);
//  get->setObjtype("op");
    get->setSerialno(newSerialNumber());

    res.push_back(get);

    Anonymous get_arg;
    get_arg->setId(id);
    get_arg->setObjtype("obj");

    return true;
}
示例#3
0
void RuleTraversalTask::getRule(const std::string & id, OpVector & res)
{
    Get get;
    Anonymous arg;
    arg->setId(id);
    get->setArgs1(arg);
    get->setObjtype("op");
    get->setSerialno(newSerialNo());
    mSerial = get->getSerialno();
    res.push_back(get);
}
示例#4
0
void Connection::refreshServerInfo()
{
    if (_status != CONNECTED) {
        warning() << "called refreshServerInfo while not connected, ignoring";
        return;
    }

    m_info.setStatus(ServerInfo::QUERYING);
    Get gt;
    gt->setSerialno(getNewSerialno());
    send(gt);
}