void FacadeDocumentProviderImpl::PopulateWSDocMembersFromArtifact(Artifact artifact, WSDocNonCom& wsdoc)
{   
	std::tostringstream msg;
	msg << _T("The following artifact will be returned to Workshare:") << std::endl;
	msg << _T("Name:") << artifact.Name << std::endl;
	std::wstring id = EncodeWorkshareId(artifact.Id, artifact.VersionLabel, artifact.GetRepository().Id);
	msg << _T("Artifact Id:") << artifact.Id << std::endl;
	msg << _T("Artifact Version Label:") << artifact.VersionLabel << std::endl;
	msg << _T("Repository Id:") << artifact.GetRepository().Id << std::endl;
	msg << _T("Workshare Id:") << id << std::endl;
	msg << _T("Extension:") << artifact.FileExtension << std::endl;

	wsdoc.SetDescription(artifact.Name);
	wsdoc.SetDocId(id);
	wsdoc.SetExtension(artifact.FileExtension.c_str());
	CStdString sWorkingFile;
	try
	{
		sWorkingFile = artifact.WorkingFileName;
	}
	catch(...)
	{
		//dont worry if there is no working file just continue
	}
	if(sWorkingFile.IsEmpty())
	{
		wsdoc.SetModifiedTime(0);
		wsdoc.SetFileSizeLow(0);
		wsdoc.SetFileSizeHigh(0);
		msg << _T("Working File Name: <none>") << std::endl;
	}
	else
	{
		wsdoc.SetLocalFile(artifact.WorkingFileName);
		wsdoc.SetModifiedTime((DATE)artifact.ModifiedTime);
		wsdoc.SetFileSizeLow(artifact.FileSize);
		wsdoc.SetFileSizeHigh(0);
		msg << _T("Working File Name: ") << artifact.WorkingFileName << std::endl;
		msg << _T("File Size: ") << artifact.FileSize << std::endl;
		msg << _T("Modified Time: ") << artifact.ModifiedTime << std::endl;
	}
	msg << std::ends;
	LOG_WS_INFO(msg.str().c_str());
}
std::wstring FacadeDocumentProviderImpl::TranslateOdmaID(const std::wstring& id)
{
	std::wstring repositoryId, artifactId, artifactVersionLabel;
	bool supports = GetConnector().GetInfoFromOdmaId(id, repositoryId, artifactId, artifactVersionLabel);     
	if(supports)
	{
		// TODO: We do the following to ensure that we always have a fully qualified workshare id.
		// Some connectors may not include the version label for the most current document in the ODMA id
		Artifact artifact = GetConnector().GetRepositoryById(repositoryId).GetArtifactById(artifactId, artifactVersionLabel);
		return EncodeWorkshareId(artifact.Id, artifact.VersionLabel, artifact.GetRepository().Id);
	}
	else
		return L"";

}
bool FacadeDocumentProviderImpl::SelectDocumentEx(LONG_PTR lHwnd, const std::wstring& formatString, const std::wstring& /*previousSelectedDocumentId*/, std::wstring& documentId)
{
	// TODO: We need a SelectArtifactVersion if previousSelectedDocumentId has something.
	LOG_WS_FUNCTION_SCOPE();

	Connector& connector = GetConnector();
	LOG_WS_INFO(L"Retrieved connector" );
	
	Artifact document = connector.SelectArtifact((HWND)lHwnd, formatString);
	if(document.IsNull())
	{
		LOG_WS_INFO(L"document == NULL" );
		return false;
	}

	documentId = EncodeWorkshareId(document.Id, document.VersionLabel, document.GetRepository().Id);	
	return true;
}
예제 #4
0
void DominoDocManager::SetDocumentToDelete(Artifact artifact)
{
   m_documentId = artifact.Id;
   m_versionLabel = artifact.VersionLabel;
   m_libraryUrl = artifact.GetRepository().Id;
}