Пример #1
0
//-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~
GroupModel::pFutureGroup_type 
GroupModel::createGroup(Common::I_Session& _session, const std::string& _name, const std::string& _description)
{
    /// TODO Check session (i.e. session user) against permissions.

    /// TODO Make this async
    pFutureGroup_type returnValue(new FutureGroup_type);

    // Get the data map.
    Community::Account::I_GroupDataMap::pGroupDataMap_type pGroupDM =
        Community::Account::I_GroupDataMap::create(
            m_service.getApplicationServer().getDatabaseConnection(
                m_service.getDatabaseConnectionName()
            )
        );

    // Create a new domain object.
    Community::Account::I_GroupDataMap::pGroupDomainObject_type pGroupDO =
        pGroupDM->createNew();

    // Populate the values.
    pGroupDO->getGroupName()        = _name;
    pGroupDO->getGroupDescription() = _description;

    // Update the object (and in this case, insert it).
    boost::uint64_t newGroupId      = pGroupDM->update(pGroupDO)->getValue();
    pGroupDO->getGroupId()          = newGroupId;

    Group* pRawGroup = new Group(m_service, pGroupDO);

    pGroup_type pGroup(
        pRawGroup,
        &destroyGroup
    );

    m_groups[_name] = pGroup;

    onAddGroup(pGroup);

    returnValue->setValue(pGroup);

    return returnValue;
}
Пример #2
0
void BookmarkView::onMenuItem(wxCommandEvent& event) {

    if (event.GetId() == wxCONTEXT_ADD_GROUP_ID) {
        onAddGroup(event);
    }
}