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


C++ Artifact::CreateRelatedItem方法代码示例

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


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

示例1: RelateDocument

void FacadeDocumentProviderImpl::RelateDocument(WSDocNonCom& newDocument,  const std::wstring& sExistingDocumentID)
{
	Artifact artifact = GetArtifactByWorkshareId(sExistingDocumentID);	
	Artifact related = artifact.CreateRelatedItem(newDocument.GetLocalFile(), CStdStringW(newDocument.GetExtension()), L"", false );
	PopulateWSDocMembersFromArtifact(related, newDocument);

	newDocument.SetFlags(DOCUMENT_LOCKED_BY_US);
	related.Lock();
}
开发者ID:killbug2004,项目名称:WSProf,代码行数:9,代码来源:FacadeDocumentProviderImpl.cpp

示例2: GetSaveInfo

HRESULT FacadeDocumentProviderImpl::GetSaveInfo(HWND hWnd, const std::wstring& formatString, long lFlags, long& lFormatIndex, WSDocNonCom& wsDoc)
{
	//-- ArtifactImpl
	//TODO: Replace Existing Version
	//TODO: Create a relation

	//-- Connector
	// Create new artifact (Add Files)
	UNREFERENCED_PARAMETER(lFormatIndex);
	if(DF_NEW_DOCUMENT & lFlags)
	{
		std::wstring newFileName = wsDoc.GetDescription();
		Artifact artifact = GetConnector().CreateArtifact(hWnd, formatString, newFileName);
		if (artifact.IsNull())
			return E_DOCUMENT_NOT_FOUND;
		PopulateWSDocMembersFromArtifact(artifact, wsDoc);
		wsDoc.SetFlags(DOCUMENT_LOCKED_BY_US);
		lFormatIndex = CalculateFormatIndex(formatString, artifact.GetFileExtension());
		artifact.Lock();
	}
	// Create a relation
	else if(DF_ATTACH & lFlags)
	{
		Artifact existing = GetArtifactByWorkshareId(wsDoc.GetDocId());	

		if (existing.IsNull())
			return E_DOCUMENT_NOT_FOUND;

		CStdString sDummyFile = CTempFileManager::GetTempFileName();;
		CStdString sExt; 
		DocUtilities::GetExtensionFromFileName(sDummyFile,sExt);

		Artifact related = existing.CreateRelatedItem(CStdStringW(sDummyFile),GetDefaultSaveExtensionFromFormatString(formatString, lFormatIndex), formatString, true);

		if (related.IsNull())
			return E_DOCUMENT_NOT_FOUND;

		related.Lock();

		PopulateWSDocMembersFromArtifact(related, wsDoc);
		lFormatIndex = CalculateFormatIndex(formatString, related.GetFileExtension());

		wsDoc.SetFlags(DOCUMENT_LOCKED_BY_US);
	}
	// Create a new version
	else if(DF_VERSION & lFlags)
	{
		std::wstring repositoryId;
		std::wstring artifactId;
		std::wstring versionLabel;
		DecodeWorkshareId(wsDoc.GetDocId().c_str(), artifactId, versionLabel, repositoryId);
		Repository repository = GetConnector().GetRepositoryById(repositoryId.c_str());
		Artifact artifact = repository.GetArtifactById(artifactId.c_str(), versionLabel.c_str());
		Artifact artifactVersion = artifact.CreateNewVersion(L"", formatString);
		PopulateWSDocMembersFromArtifact(artifactVersion, wsDoc);
		artifactVersion.Lock(); 
		wsDoc.SetFlags(DOCUMENT_LOCKED_BY_US);
		lFormatIndex = CalculateFormatIndex(formatString, artifactVersion.GetFileExtension());

	}
	return S_OK;
}
开发者ID:killbug2004,项目名称:WSProf,代码行数:62,代码来源:FacadeDocumentProviderImpl.cpp


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