Exemplo n.º 1
0
void User::create_relations_meta(Yb::Relations &rels)
{
    {
        Yb::Relation::AttrMap attr1, attr2;
        attr1[_T("property")] = _T("login_sessions");
        attr2[_T("property")] = _T("user");
        Yb::Relation::Ptr r(new Yb::Relation(Yb::Relation::ONE2MANY, _T("User"), attr1, _T("LoginSession"), attr2, Yb::Relation::Restrict));
        rels.push_back(r);
    }
    {
        Yb::Relation::AttrMap attr1, attr2;
        attr1[_T("property")] = _T("classes");
        attr2[_T("key")] = _T("TEACHER_ID");
        attr2[_T("property")] = _T("teacher");
        Yb::Relation::Ptr r(new Yb::Relation(Yb::Relation::ONE2MANY, _T("User"), attr1, _T("Schedule"), attr2, Yb::Relation::Restrict));
        rels.push_back(r);
    }
    {
        Yb::Relation::AttrMap attr1, attr2;
        attr1[_T("property")] = _T("subscriptions");
        attr2[_T("key")] = _T("RECEIVER_ID");
        attr2[_T("property")] = _T("receiver");
        Yb::Relation::Ptr r(new Yb::Relation(Yb::Relation::ONE2MANY, _T("User"), attr1, _T("Schedule"), attr2, Yb::Relation::Restrict));
        rels.push_back(r);
    }
}
void ScheduleGroup::create_relations_meta(Yb::Relations &rels)
{
    {
        Yb::Relation::AttrMap attr1, attr2;
        attr1[_T("property")] = _T("groups");
        attr2[_T("property")] = _T("schedule");
        Yb::Relation::Ptr r(new Yb::Relation(Yb::Relation::ONE2MANY, _T("Schedule"), attr1, _T("ScheduleGroup"), attr2, Yb::Relation::Delete));
        rels.push_back(r);
    }
    {
        Yb::Relation::AttrMap attr1, attr2;
        attr2[_T("property")] = _T("group");
        Yb::Relation::Ptr r(new Yb::Relation(Yb::Relation::ONE2MANY, _T("StudGroup"), attr1, _T("ScheduleGroup"), attr2, Yb::Relation::Delete));
        rels.push_back(r);
    }
}
Exemplo n.º 3
0
void Subject::create_relations_meta(Yb::Relations &rels)
{
    {
        Yb::Relation::AttrMap attr1, attr2;
        attr1[_T("property")] = _T("classes");
        attr2[_T("property")] = _T("subject");
        Yb::Relation::Ptr r(new Yb::Relation(Yb::Relation::ONE2MANY, _T("Subject"), attr1, _T("Schedule"), attr2, Yb::Relation::Restrict));
        rels.push_back(r);
    }
}