void FacadeDocumentProviderImpl::LockDocument(const std::wstring& id, long flags)
{   
	Artifact artifact = GetArtifactByWorkshareId(id);
	if(flags & LOCK_DOCUMENT)
		artifact.Lock();
	else if(flags & UNLOCK_DOCUMENT)
		artifact.Unlock();
}
void FacadeDocumentProviderImpl::CloseDocument(WSDocNonCom& wsDoc, long flags)
{   
	Artifact artifact = GetArtifactByWorkshareId(wsDoc.GetDocId());

	// only unlock if the document was locked by current user.
	if( wsDoc.GetFlags() == DOCUMENT_LOCKED_BY_CURRENT_USER )
	{
		artifact.Unlock();
	}

	if(!(flags & DF_UNLOCK_ONLY))
	{
		artifact.Close();
		LONG oldFlags = wsDoc.GetFlags();
		wsDoc.SetFlags(oldFlags & ~DOCUMENT_LOCKED_BY_US);
	}

	PopulateWSDocMembersFromArtifact(artifact, wsDoc);
}