当前位置: 首页>>代码示例>>C++>>正文


C++ ActivityBuilder::SetPersist方法代码示例

本文整理汇总了C++中ActivityBuilder::SetPersist方法的典型用法代码示例。如果您正苦于以下问题:C++ ActivityBuilder::SetPersist方法的具体用法?C++ ActivityBuilder::SetPersist怎么用?C++ ActivityBuilder::SetPersist使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在ActivityBuilder的用法示例。


在下文中一共展示了ActivityBuilder::SetPersist方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。

示例1: BuildOutboxWatch

void SmtpActivityFactory::BuildOutboxWatch(ActivityBuilder& ab, const MojObject& accountId, const MojObject& folderId)
{
	ActivityBuilder actBuilder;

	MojString name;

	name.format(OUTBOX_WATCH_ACTIVITY_FMT, AsJsonString(accountId).c_str());

	ab.SetName(name);
	ab.SetDescription("Watches SMTP outbox for new emails");
	ab.SetPersist(true);
	ab.SetExplicit(true);
	ab.SetRequiresInternet(false); // don't trigger until we also have connectivity
	ab.SetImmediate(true, ActivityBuilder::PRIORITY_LOW);

	// Callback
	MojObject callbackParams;
	MojErr err = callbackParams.put("accountId", accountId);
	ErrorToException(err);
	err = callbackParams.put("folderId", folderId);
	ErrorToException(err);

	ab.SetCallback(OUTBOX_BUS_METHOD, callbackParams);
	ab.SetMetadata(callbackParams);
}
开发者ID:hatsada1,项目名称:app-services,代码行数:25,代码来源:SmtpActivityFactory.cpp

示例2: BuildPreferencesWatch

void ImapActivityFactory::BuildPreferencesWatch(ActivityBuilder& ab, const MojObject& accountId, MojInt64 rev)
{
	MojErr err;

	ab.SetName( GetPreferencesWatchName(accountId) );
	ab.SetDescription("IMAP account preferences watch");
	ab.SetPersist(true);
	ab.SetForeground(true);

	// Metadata
	MojObject metadata;
	SetMetadata(metadata, PREFS_WATCH_NAME, accountId);
	ab.SetMetadata(metadata);

	MojDbQuery trigger;
	err = trigger.from(ImapAccountAdapter::SCHEMA);
	ErrorToException(err);
	err = trigger.where(ImapAccountAdapter::ACCOUNT_ID, MojDbQuery::OpEq, accountId);
	ErrorToException(err);
	err = trigger.where(ImapAccountAdapter::CONFIG_REV, MojDbQuery::OpGreaterThan, rev);
	ErrorToException(err);
	ab.SetDatabaseWatchTrigger(trigger);

	MojObject params;
	err = params.put("accountId", accountId);
	ErrorToException(err);

	ab.SetCallback(PREFS_WATCH_CALLBACK, params);
}
开发者ID:Garfonso,项目名称:app-services,代码行数:29,代码来源:ImapActivityFactory.cpp

示例3: BuildDeleteEmailsWatch

void ActivityBuilderFactory::BuildDeleteEmailsWatch(ActivityBuilder& builder)
{
	MojString name;
	GetDeleteEmailsActivityName(name);

	MojString desc;
	GetDeleteEmailsActivityDesc(desc);

	builder.SetName(name.data());
	builder.SetDescription(desc.data());
	builder.SetPersist(true);
	builder.SetExplicit(true);
	builder.SetImmediate(true, "low");

	// setup trigger
	MojDbQuery trigger;
	MojErr err = trigger.from(PopEmailAdapter::POP_EMAIL_KIND);
	ErrorToException(err);
	err = trigger.where("_del", MojDbQuery::OpEq, true);
	ErrorToException(err);
	builder.SetDatabaseWatchTrigger(trigger);

	// setup parameters (to be sent when trigger is called)
	MojObject params;
	err = params.put(PopFolderAdapter::ACCOUNT_ID, m_accountId);
	ErrorToException(err);
	builder.SetCallback(DELETE_EMAILS_CALLBACK, params);

	// put accountId in metadata
	MojObject metadata;
	err = metadata.put(PopFolderAdapter::ACCOUNT_ID, m_accountId);
	ErrorToException(err);
	builder.SetMetadata(metadata);
}
开发者ID:hatsada1,项目名称:app-services,代码行数:34,代码来源:ActivityBuilderFactory.cpp

示例4: CreateActivity

void NetworkStatusMonitor::CreateActivity()
{
	ActivityBuilder ab;

	static MojInt64 uniqueId = 0;

	string serviceName = m_busClient.GetServiceName();

	// FIXME
	if(serviceName.empty()) {
		throw MailException("no service name", __FILE__, __LINE__);
	}

	MojString name;
	MojErr err = name.format("%s network status check - %lld", serviceName.c_str(), ++uniqueId);
	ErrorToException(err);

	ab.SetName(name.data());
	ab.SetDescription("Monitors network status");
	ab.SetExplicit(false);
	ab.SetPersist(false);
	ab.SetForeground(true);
	ab.SetRequiresInternet(true);

	m_activity = Activity::PrepareNewActivity(ab, true, true);
	m_activity->SetSlots(m_activityUpdateSlot, m_activityErrorSlot);
	m_activity->Create(m_busClient);
}
开发者ID:Garfonso,项目名称:app-services,代码行数:28,代码来源:NetworkStatusMonitor.cpp

示例5: BuildScheduledSync

void ActivityBuilderFactory::BuildScheduledSync(ActivityBuilder &builder, int intervalMins)
{
	// activity to setup watch
	MojString name;
	GetScheduledSyncActivityName(name);

	// description of watch
	MojString desc;
	GetScheduledSyncActivityDesc(desc);

	// sync interval in seconds
	int intervalSecs = MinsToSecs(intervalMins);

	builder.SetName(name.data());
	builder.SetDescription(desc.data());
	builder.SetPersist(true);
	builder.SetExplicit(true);
	builder.SetRequiresInternet(false);
	builder.SetSyncInterval(0, intervalSecs);
	builder.SetImmediate(true, "low");

	// setup parameters (to be sent when trigger is called)
	MojObject params;
	MojErr err = params.put(PopAccountAdapter::ACCOUNT_ID, m_accountId);
	ErrorToException(err);
	builder.SetCallback(SCHEDULED_SYNC_CALLBACK, params);

	// put accountId in metadata
	MojObject metadata;
	err = metadata.put("accountId", m_accountId);
	ErrorToException(err);
	builder.SetMetadata(metadata);
}
开发者ID:hatsada1,项目名称:app-services,代码行数:33,代码来源:ActivityBuilderFactory.cpp

示例6: BuildAccountPrefsWatch

void ActivityBuilderFactory::BuildAccountPrefsWatch(ActivityBuilder& builder, MojObject& accountRev)
{
	MojString name;
	GetAccountPrefsWatchActivityName(name);

	MojString desc;
	GetAccountPrefsWatchActivityDesc(desc);

	builder.SetName(name.data());
	builder.SetDescription(desc.data());
	builder.SetPersist(true);
	builder.SetExplicit(true);
	builder.SetImmediate(true, "low");

	MojDbQuery trigger;
	MojErr err = trigger.from(PopAccountAdapter::POP_ACCOUNT_KIND);
	ErrorToException(err);
	err = trigger.where(PopAccountAdapter::ACCOUNT_ID, MojDbQuery::OpEq, m_accountId);
	ErrorToException(err);
	err = trigger.where("_revPop", MojDbQuery::OpGreaterThan, accountRev);
	ErrorToException(err);
	builder.SetDatabaseWatchTrigger(trigger);

	MojObject params;
	err = params.put(PopAccountAdapter::ACCOUNT_ID, m_accountId);
	ErrorToException(err);
	builder.SetCallback(ACCOUNT_PREFS_WATCH_CALLBACK, params);

	MojObject metadata;
	err = metadata.put(PopAccountAdapter::ACCOUNT_ID, m_accountId);
	ErrorToException(err);
	builder.SetMetadata(metadata);
}
开发者ID:hatsada1,项目名称:app-services,代码行数:33,代码来源:ActivityBuilderFactory.cpp

示例7: BuildScheduledSync

void ImapActivityFactory::BuildScheduledSync(ActivityBuilder& ab, const MojObject& accountId, const MojObject& folderId, int seconds, bool requireFair)
{
	MojErr err;

	ab.SetName( GetScheduledSyncName(accountId, folderId) );

	MojString desc;
	err = desc.format("Scheduled sync every %d minutes", seconds/60);
	ErrorToException(err);

	ab.SetDescription(desc.data());
	ab.SetExplicit(true);
	ab.SetPersist(true);
	ab.SetImmediate(true, "low");
	SetNetworkRequirements(ab, requireFair);

	// Metadata
	MojObject metadata;
	SetMetadata(metadata, SCHEDULED_SYNC_NAME, accountId, folderId);
	ab.SetMetadata(metadata);

	// Wakeup
	ab.SetSyncInterval(0, seconds);

	// Callback
	MojObject params;
	err = params.put("accountId", accountId);
	ErrorToException(err);

	ab.SetCallback(SCHEDULED_SYNC_CALLBACK, params);
}
开发者ID:Garfonso,项目名称:app-services,代码行数:31,代码来源:ImapActivityFactory.cpp

示例8: BuildStartIdle

void ImapActivityFactory::BuildStartIdle(ActivityBuilder& ab, const MojObject& accountId, const MojObject& folderId)
{
	MojErr err;

	ab.SetName( GetStartIdleName(accountId, folderId) );
	ab.SetDescription("Starts a push connection when the network is available");
	ab.SetExplicit(false);
	ab.SetPersist(true);
	ab.SetImmediate(true, "low");
	SetNetworkRequirements(ab, false);

	// Metadata
	MojObject metadata;
	SetMetadata(metadata, MAINTAIN_IDLE_NAME, accountId, folderId);
	ab.SetMetadata(metadata);

	// Callback
	MojObject params;
	err = params.put("accountId", accountId);
	ErrorToException(err);
	err = params.put("folderId", folderId);
	ErrorToException(err);

	ab.SetCallback(MAINTAIN_IDLE_CALLBACK, params);
}
开发者ID:Garfonso,项目名称:app-services,代码行数:25,代码来源:ImapActivityFactory.cpp

示例9: BuildIdleWakeup

void ImapActivityFactory::BuildIdleWakeup(ActivityBuilder& ab, const MojObject& accountId, const MojObject& folderId, int seconds)
{
	ab.SetName( GetIdleWakeupName(accountId, folderId) );
	ab.SetDescription("Wakes up idle connection");
	ab.SetExplicit(false); // goes away after a cancel
	ab.SetPersist(false);
	ab.SetForeground(true); // must run immediately
	ab.SetPowerOptions(false, true);

	// Wakeup
	ab.SetStartDelay(seconds);
}
开发者ID:Garfonso,项目名称:app-services,代码行数:12,代码来源:ImapActivityFactory.cpp

示例10: BuildConnect

// This is used if we don't have any other activity to get network status from
void ImapActivityFactory::BuildConnect(ActivityBuilder& ab, const MojObject& accountId, MojUInt64 uniqueId)
{
	MojString name;
	MojErr err = name.format("%s - %lld", CONNECT_NAME, uniqueId);
	ErrorToException(err);

	ab.SetName( FormatName(name.data(), accountId) );
	ab.SetDescription("Activity for connecting to server");
	ab.SetExplicit(false);
	ab.SetPersist(false);
	ab.SetForeground(true);
	ab.SetRequiresInternet(false);
}
开发者ID:Garfonso,项目名称:app-services,代码行数:14,代码来源:ImapActivityFactory.cpp

示例11: BuildSyncRetry

void ImapActivityFactory::BuildSyncRetry(ActivityBuilder& ab, const MojObject& accountId, const MojObject& folderId, int seconds, const std::string& reason)
{
	MojErr err;

	ab.SetName( GetSyncRetryName(accountId, folderId) );

	MojString desc;
	err = desc.format("Retry sync after %d seconds", seconds);
	ErrorToException(err);

	ab.SetDescription(desc.data());
	ab.SetExplicit(true);
	ab.SetPersist(true);
	ab.SetImmediate(true, "low");
	SetNetworkRequirements(ab, seconds <= 5 * 60);

	// Metadata
	MojObject metadata;
	SetMetadata(metadata, SYNC_RETRY_NAME, accountId, folderId);
	ab.SetMetadata(metadata);

	// Wakeup
	ab.SetSyncInterval(seconds, 0);

	// Callback
	MojObject params;
	err = params.put("accountId", accountId);
	ErrorToException(err);
	err = params.put("folderId", folderId);
	ErrorToException(err);

	MojObject retry;
	if(!reason.empty()) {
		err = retry.putString("reason", reason.c_str());
		ErrorToException(err);
	}

	err = retry.put("interval", seconds);
	ErrorToException(err);

	err = params.put("retry", retry);
	ErrorToException(err);

	ab.SetCallback(SYNC_RETRY_CALLBACK, params);
}
开发者ID:Garfonso,项目名称:app-services,代码行数:45,代码来源:ImapActivityFactory.cpp

示例12: BuildSentEmailsWatch

void ActivityBuilderFactory::BuildSentEmailsWatch(ActivityBuilder& builder, const MojObject& outboxFolderId, const MojObject& sentFolderId)
{
	// activity to setup watch
	MojString name;
	GetSentEmailsWatchActivityName(name);

	// description of watch
	MojString desc;
	GetSentEmailsWatchActivityDesc(desc);

	builder.SetName(name.data());
	builder.SetDescription(desc.data());
	builder.SetPersist(true);
	builder.SetExplicit(true);
	builder.SetForeground(true);

	// setup trigger
	MojDbQuery trigger;
	MojErr err = trigger.from(EmailSchema::Kind::EMAIL);
	ErrorToException(err);
	err = trigger.where(EmailSchema::FOLDER_ID, MojDbQuery::OpEq, outboxFolderId);
	ErrorToException(err);
	err = trigger.where("sendStatus.sent", MojDbQuery::OpEq, true);
	ErrorToException(err);
	builder.SetDatabaseWatchTrigger(trigger);

	// setup parameters (to be sent when trigger is called)
	MojObject params;
	err = params.put(PopFolderAdapter::ACCOUNT_ID, m_accountId);
	ErrorToException(err);
	err = params.put(PopFolderAdapter::OUTBOX_FOLDER_ID, outboxFolderId);
	ErrorToException(err);
	err = params.put(PopFolderAdapter::SENT_FOLDER_ID, sentFolderId);
	ErrorToException(err);
	builder.SetCallback(SENT_EMAILS_WATCH_CALLBACK, params);

	// put accountId in metadata
	MojObject metadata;
	err = metadata.put("accountId", m_accountId);
	ErrorToException(err);
	builder.SetMetadata(metadata);
}
开发者ID:hatsada1,项目名称:app-services,代码行数:42,代码来源:ActivityBuilderFactory.cpp

示例13: BuildSmtpConfigWatch

void SmtpActivityFactory::BuildSmtpConfigWatch(ActivityBuilder& ab, const MojObject& accountId, MojInt64 rev)
{
	MojErr err;

	MojString name;
	err = name.format(ACCOUNT_WATCH_ACTIVITY_FMT, AsJsonString(accountId).c_str());
	ErrorToException(err);

	// description of watch
	MojString desc;
	err = desc.format("Watches SMTP config on account %s", AsJsonString(accountId).c_str());
	ErrorToException(err);

	// activity to setup watch
	ab.SetName(name);
	ab.SetDescription(desc.data());
	ab.SetPersist(true);
	ab.SetExplicit(true);
	ab.SetRequiresInternet(false); // trigger even if we don't have a network connection
	ab.SetImmediate(true, ActivityBuilder::PRIORITY_LOW);

	// setup trigger
	// NOTE: how to trigger only on SMTP config change?
	MojDbQuery trigger;
	err = trigger.from("com.palm.mail.account:1");
	ErrorToException(err);
	err = trigger.where("accountId", MojDbQuery::OpEq, accountId);
	ErrorToException(err);

	if (rev > 0) {
		trigger.where("_revSmtp", MojDbQuery::OpGreaterThan, rev);
	}
	ab.SetDatabaseWatchTrigger(trigger);

	MojObject params;
	err = params.put("accountId", accountId);
	ErrorToException(err);

	ab.SetCallback(ACCOUNT_UPDATED_BUS_METHOD, params);
	ab.SetMetadata(params);
}
开发者ID:hatsada1,项目名称:app-services,代码行数:41,代码来源:SmtpActivityFactory.cpp

示例14: BuildFolderRetrySync

void ActivityBuilderFactory::BuildFolderRetrySync(ActivityBuilder &builder, const MojObject& folderId, int currInterval)
{
	// activity to setup watch
	MojString name;
	GetFolderRetrySyncActivityName(name, folderId);

	// description of watch
	MojString desc;
	GetFolderRetrySyncActivityDesc(desc, folderId);

	// retry interval in seconds
	int nextRetryInterval = GetNextRetryIntervalMins(currInterval);
	int intervalSecs = MinsToSecs(nextRetryInterval);

	builder.SetName(name.data());
	builder.SetDescription(desc.data());
	builder.SetPersist(true);
	builder.SetExplicit(true);
	builder.SetRequiresInternet(false);
	builder.SetImmediate(true, "low");
	builder.SetSyncInterval(0, intervalSecs);

	// setup parameters (to be sent when trigger is called)
	MojObject params;
	MojErr err = params.put(PopAccountAdapter::ACCOUNT_ID, m_accountId);
	ErrorToException(err);
	err = params.put("folderId", folderId);
	ErrorToException(err);
	err = params.put("lastRetryInterval", nextRetryInterval);
	ErrorToException(err);
	builder.SetCallback(FOLDER_RETRY_SYNC_CALLBACK, params);

	// put accountId in metadata
	MojObject metadata;
	err = metadata.put("accountId", m_accountId);
	ErrorToException(err);
	builder.SetMetadata(metadata);
}
开发者ID:hatsada1,项目名称:app-services,代码行数:38,代码来源:ActivityBuilderFactory.cpp

示例15: BuildFolderWatch

void ImapActivityFactory::BuildFolderWatch(ActivityBuilder& ab, const MojObject& accountId, const MojObject& folderId, MojInt64 rev)
{
	MojErr err;
	MojDbQuery query;

	ab.SetName( GetFolderWatchName(accountId, folderId) );
	ab.SetDescription("Watches for updates to emails");
	ab.SetExplicit(true);
	ab.SetPersist(true);
	SetNetworkRequirements(ab, true);
	ab.SetImmediate(true, "low");

	// Metadata
	MojObject metadata;
	SetMetadata(metadata, FOLDER_WATCH_NAME, accountId, folderId);
	ab.SetMetadata(metadata);

	// Query
	err = query.from(ImapEmailAdapter::IMAP_EMAIL_KIND);
	ErrorToException(err);
	err = query.where(EmailSchema::FOLDER_ID, MojDbQuery::OpEq, folderId);
	ErrorToException(err);
	err = query.where(ImapEmailAdapter::UPSYNC_REV, MojDbQuery::OpGreaterThan, rev);
	ErrorToException(err);
	err = query.includeDeleted(true);
	ErrorToException(err);

	ab.SetDatabaseWatchTrigger(query);

	// Callback
	MojObject callbackParams;
	err = callbackParams.put("accountId", accountId);
	ErrorToException(err);
	err = callbackParams.put("folderId", folderId);
	ErrorToException(err);

	ab.SetCallback(FOLDER_WATCH_CALLBACK, callbackParams);
}
开发者ID:Garfonso,项目名称:app-services,代码行数:38,代码来源:ImapActivityFactory.cpp


注:本文中的ActivityBuilder::SetPersist方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。