mirror of
https://git.dev.opencascade.org/repos/occt.git
synced 2025-08-09 13:22:24 +03:00
0022573: Extend the range of status values returned by the method TDocStd_Application::SaveAs
This commit is contained in:
@@ -22,22 +22,8 @@ is
|
||||
|
||||
deferred class Application;
|
||||
|
||||
|
||||
---Category: Store in Database related classes.
|
||||
--
|
||||
private class StoreList;
|
||||
|
||||
enumeration StoreStatus is
|
||||
SS_OK,
|
||||
SS_DriverFailure,
|
||||
SS_WriteFailure,
|
||||
SS_Failure
|
||||
end StoreStatus from CDF;
|
||||
|
||||
|
||||
---Category: Retrieve from Database related classes.
|
||||
--
|
||||
|
||||
---Category: API for Store and retrieve
|
||||
--
|
||||
|
||||
@@ -46,30 +32,6 @@ is
|
||||
|
||||
enumeration TryStoreStatus is TS_OK,TS_NoCurrentDocument,TS_NoDriver,TS_NoSubComponentDriver
|
||||
end TryStoreStatus;
|
||||
|
||||
enumeration RetrievableStatus is
|
||||
RS_OK,
|
||||
RS_AlreadyRetrievedAndModified,
|
||||
RS_AlreadyRetrieved,
|
||||
RS_UnknownDocument,
|
||||
RS_NoDriver,
|
||||
RS_UnknownFileDriver,
|
||||
RS_WrongResource,
|
||||
RS_OpenError,
|
||||
RS_NoVersion,
|
||||
RS_NoModel,
|
||||
RS_NoSchema,
|
||||
RS_NoDocument,
|
||||
RS_ExtensionFailure,
|
||||
RS_WrongStreamMode,
|
||||
RS_FormatFailure,
|
||||
RS_TypeFailure,
|
||||
RS_TypeNotFoundInSchema,
|
||||
RS_UnrecognizedFileFormat,
|
||||
RS_MakeFailure,
|
||||
RS_PermissionDenied,
|
||||
RS_DriverFailure
|
||||
end RetrievableStatus;
|
||||
|
||||
enumeration SubComponentStatus is SCS_Consistent, SCS_Unconsistent,SCS_Stored,SCS_Modified
|
||||
end SubComponentStatus;
|
||||
@@ -105,4 +67,3 @@ is
|
||||
returns Boolean from Standard;
|
||||
|
||||
end CDF;
|
||||
|
||||
|
@@ -12,7 +12,7 @@ uses
|
||||
Document from CDM,
|
||||
Manager from Resource,
|
||||
MetaData from CDM,
|
||||
RetrievableStatus from CDF,
|
||||
ReaderStatus from PCDM,
|
||||
GUID from Standard,
|
||||
Reader from PCDM,
|
||||
Writer from PCDM,
|
||||
@@ -101,18 +101,18 @@ is
|
||||
|
||||
CanRetrieve(me: mutable; aFolder, aName: ExtendedString from TCollection)
|
||||
---Purpose:
|
||||
returns RetrievableStatus from CDF;
|
||||
returns ReaderStatus from PCDM;
|
||||
|
||||
CanRetrieve(me: mutable; aFolder, aName, aVersion: ExtendedString from TCollection)
|
||||
---Purpose:
|
||||
returns RetrievableStatus from CDF;
|
||||
returns ReaderStatus from PCDM;
|
||||
|
||||
Formats(me: mutable; Formats: out SequenceOfExtendedString from TColStd)
|
||||
is deferred;
|
||||
---Category: CurrentDocument methods.
|
||||
--
|
||||
|
||||
GetRetrieveStatus(me) returns RetrievableStatus from CDF;
|
||||
GetRetrieveStatus(me) returns ReaderStatus from PCDM;
|
||||
---C++: inline
|
||||
---Purpose: Checks status after Retrieve
|
||||
|
||||
@@ -200,12 +200,12 @@ is
|
||||
is private;
|
||||
|
||||
CanRetrieve(me: mutable; aMetaData: MetaData from CDM)
|
||||
returns RetrievableStatus from CDF
|
||||
returns ReaderStatus from PCDM
|
||||
is private;
|
||||
fields
|
||||
|
||||
myDefaultFolder: ExtendedString from TCollection;
|
||||
myRetrievableStatus : RetrievableStatus from CDF is protected;
|
||||
myRetrievableStatus : ReaderStatus from PCDM is protected;
|
||||
|
||||
friends
|
||||
class Session from CDF--,
|
||||
|
@@ -15,11 +15,11 @@
|
||||
#include <CDF_Session.hxx>
|
||||
#include <CDF_Directory.hxx>
|
||||
#include <CDF_MetaDataDriver.hxx>
|
||||
#include <CDF_RetrievableStatus.hxx>
|
||||
#include <PCDM_ReaderStatus.hxx>
|
||||
#include <PCDM_ReadWriter.hxx>
|
||||
#include <PCDM_RetrievalDriver.hxx>
|
||||
#include <PCDM_StorageDriver.hxx>
|
||||
#include <PCDM_ReaderStatus.hxx>
|
||||
|
||||
|
||||
#include <Plugin.hxx>
|
||||
#include <UTL.hxx>
|
||||
@@ -33,7 +33,7 @@
|
||||
//function :
|
||||
//purpose :
|
||||
//=======================================================================
|
||||
CDF_Application::CDF_Application():myRetrievableStatus(CDF_RS_OK) {}
|
||||
CDF_Application::CDF_Application():myRetrievableStatus(PCDM_RS_OK) {}
|
||||
|
||||
//=======================================================================
|
||||
//function : Load
|
||||
@@ -128,7 +128,7 @@ Handle(CDM_Document) CDF_Application::Retrieve(const TCollection_ExtendedString
|
||||
//function : CanRetrieve
|
||||
//purpose :
|
||||
//=======================================================================
|
||||
CDF_RetrievableStatus CDF_Application::CanRetrieve(const TCollection_ExtendedString& aFolder, const TCollection_ExtendedString& aName) {
|
||||
PCDM_ReaderStatus CDF_Application::CanRetrieve(const TCollection_ExtendedString& aFolder, const TCollection_ExtendedString& aName) {
|
||||
TCollection_ExtendedString aVersion;
|
||||
return CanRetrieve(aFolder,aName,aVersion);
|
||||
}
|
||||
@@ -137,16 +137,16 @@ CDF_RetrievableStatus CDF_Application::CanRetrieve(const TCollection_ExtendedStr
|
||||
//function : CanRetrieve
|
||||
//purpose :
|
||||
//=======================================================================
|
||||
CDF_RetrievableStatus CDF_Application::CanRetrieve(const TCollection_ExtendedString& aFolder, const TCollection_ExtendedString& aName, const TCollection_ExtendedString& aVersion) {
|
||||
PCDM_ReaderStatus CDF_Application::CanRetrieve(const TCollection_ExtendedString& aFolder, const TCollection_ExtendedString& aName, const TCollection_ExtendedString& aVersion) {
|
||||
|
||||
#ifdef DEB
|
||||
CDF_Timer theTimer;
|
||||
#endif
|
||||
|
||||
if (!theMetaDataDriver->Find(aFolder,aName,aVersion))
|
||||
return CDF_RS_UnknownDocument;
|
||||
return PCDM_RS_UnknownDocument;
|
||||
else if (!theMetaDataDriver->HasReadPermission(aFolder,aName,aVersion))
|
||||
return CDF_RS_PermissionDenied;
|
||||
return PCDM_RS_PermissionDenied;
|
||||
else {
|
||||
#ifdef DEB
|
||||
theTimer.ShowAndRestart("theMetaDataDriver->Find: ");
|
||||
@@ -160,7 +160,7 @@ CDF_RetrievableStatus CDF_Application::CanRetrieve(const TCollection_ExtendedStr
|
||||
|
||||
if(theMetaData->IsRetrieved()) {
|
||||
return theMetaData->Document()->IsModified()
|
||||
? CDF_RS_AlreadyRetrievedAndModified : CDF_RS_AlreadyRetrieved;
|
||||
? PCDM_RS_AlreadyRetrievedAndModified : PCDM_RS_AlreadyRetrieved;
|
||||
}
|
||||
else {
|
||||
TCollection_ExtendedString theFileName=theMetaData->FileName();
|
||||
@@ -172,12 +172,12 @@ CDF_RetrievableStatus CDF_Application::CanRetrieve(const TCollection_ExtendedStr
|
||||
theFormat=UTL::Value(Resources(),ResourceName);
|
||||
}
|
||||
else
|
||||
return CDF_RS_UnrecognizedFileFormat;
|
||||
return PCDM_RS_UnrecognizedFileFormat;
|
||||
}
|
||||
if(!FindReaderFromFormat(theFormat)) return CDF_RS_NoDriver;
|
||||
if(!FindReaderFromFormat(theFormat)) return PCDM_RS_NoDriver;
|
||||
}
|
||||
}
|
||||
return CDF_RS_OK;
|
||||
return PCDM_RS_OK;
|
||||
|
||||
}
|
||||
|
||||
@@ -241,64 +241,6 @@ Handle(CDM_Document) CDF_Application::Retrieve(const Handle(CDM_MetaData)& aMeta
|
||||
return Retrieve(aMetaData,UseStorageConfiguration,Standard_True);
|
||||
}
|
||||
|
||||
//=======================================================================
|
||||
//function : ConvertStatus
|
||||
//purpose :
|
||||
//=======================================================================
|
||||
static CDF_RetrievableStatus ConvertStatus(const PCDM_ReaderStatus theStatus) {
|
||||
CDF_RetrievableStatus aStatus;
|
||||
switch(theStatus) {
|
||||
case PCDM_RS_OK:
|
||||
aStatus=CDF_RS_OK;
|
||||
break;
|
||||
case PCDM_RS_NoDriver:
|
||||
aStatus=CDF_RS_NoDriver;
|
||||
break;
|
||||
case PCDM_RS_UnknownFileDriver:
|
||||
aStatus=CDF_RS_UnknownFileDriver;
|
||||
break;
|
||||
case PCDM_RS_OpenError:
|
||||
aStatus=CDF_RS_OpenError;
|
||||
break;
|
||||
case PCDM_RS_NoVersion:
|
||||
aStatus=CDF_RS_NoVersion;
|
||||
break;
|
||||
case PCDM_RS_NoSchema:
|
||||
aStatus=CDF_RS_NoSchema;
|
||||
break;
|
||||
case PCDM_RS_NoDocument:
|
||||
aStatus=CDF_RS_NoDocument;
|
||||
break;
|
||||
case PCDM_RS_ExtensionFailure:
|
||||
aStatus=CDF_RS_ExtensionFailure;
|
||||
break;
|
||||
case PCDM_RS_WrongStreamMode:
|
||||
aStatus=CDF_RS_WrongStreamMode;
|
||||
break;
|
||||
case PCDM_RS_FormatFailure:
|
||||
aStatus=CDF_RS_FormatFailure;
|
||||
break;
|
||||
case PCDM_RS_TypeFailure:
|
||||
aStatus=CDF_RS_TypeFailure;
|
||||
break;
|
||||
case PCDM_RS_TypeNotFoundInSchema:
|
||||
aStatus=CDF_RS_TypeNotFoundInSchema;
|
||||
break;
|
||||
case PCDM_RS_UnrecognizedFileFormat:
|
||||
aStatus=CDF_RS_UnrecognizedFileFormat;
|
||||
break;
|
||||
case PCDM_RS_MakeFailure:
|
||||
aStatus=CDF_RS_MakeFailure;
|
||||
break;
|
||||
case PCDM_RS_PermissionDenied:
|
||||
aStatus=CDF_RS_PermissionDenied;
|
||||
break;
|
||||
default:
|
||||
aStatus=CDF_RS_DriverFailure;
|
||||
}
|
||||
return aStatus;
|
||||
}
|
||||
|
||||
//=======================================================================
|
||||
//function : Retrieve
|
||||
//purpose :
|
||||
@@ -306,18 +248,18 @@ static CDF_RetrievableStatus ConvertStatus(const PCDM_ReaderStatus theStatus) {
|
||||
Handle(CDM_Document) CDF_Application::Retrieve(const Handle(CDM_MetaData)& aMetaData,const Standard_Boolean UseStorageConfiguration, const Standard_Boolean IsComponent) {
|
||||
|
||||
Handle(CDM_Document) theDocumentToReturn;
|
||||
myRetrievableStatus = CDF_RS_DriverFailure;
|
||||
myRetrievableStatus = PCDM_RS_DriverFailure;
|
||||
if(IsComponent) {
|
||||
Standard_SStream aMsg;
|
||||
switch (CanRetrieve(aMetaData)) {
|
||||
case CDF_RS_UnknownDocument:
|
||||
case PCDM_RS_UnknownDocument:
|
||||
aMsg << "could not find the referenced document: " << aMetaData->Path() << "; not found." <<(char)0 << endl;
|
||||
myRetrievableStatus = CDF_RS_UnknownDocument;
|
||||
myRetrievableStatus = PCDM_RS_UnknownDocument;
|
||||
Standard_Failure::Raise(aMsg);
|
||||
break;
|
||||
case CDF_RS_PermissionDenied:
|
||||
case PCDM_RS_PermissionDenied:
|
||||
aMsg << "Could not find the referenced document: " << aMetaData->Path() << "; permission denied. " <<(char)0 << endl;
|
||||
myRetrievableStatus = CDF_RS_PermissionDenied;
|
||||
myRetrievableStatus = PCDM_RS_PermissionDenied;
|
||||
Standard_Failure::Raise(aMsg);
|
||||
break;
|
||||
default:
|
||||
@@ -326,9 +268,9 @@ Handle(CDM_Document) CDF_Application::Retrieve(const Handle(CDM_MetaData)& aMeta
|
||||
|
||||
}
|
||||
Standard_Boolean AlreadyRetrieved=aMetaData->IsRetrieved();
|
||||
if(AlreadyRetrieved) myRetrievableStatus = CDF_RS_AlreadyRetrieved;
|
||||
if(AlreadyRetrieved) myRetrievableStatus = PCDM_RS_AlreadyRetrieved;
|
||||
Standard_Boolean Modified=AlreadyRetrieved && aMetaData->Document()->IsModified();
|
||||
if(Modified) myRetrievableStatus = CDF_RS_AlreadyRetrievedAndModified;
|
||||
if(Modified) myRetrievableStatus = PCDM_RS_AlreadyRetrievedAndModified;
|
||||
if(!AlreadyRetrieved || Modified) {
|
||||
|
||||
Handle(PCDM_Reader) theReader=Reader(aMetaData->FileName());
|
||||
@@ -353,17 +295,14 @@ Handle(CDM_Document) CDF_Application::Retrieve(const Handle(CDM_MetaData)& aMeta
|
||||
theReader->Read(aMetaData->FileName(),theDocument,this);
|
||||
}
|
||||
catch (Standard_Failure) {
|
||||
PCDM_ReaderStatus aStatus = theReader->GetStatus();
|
||||
myRetrievableStatus = ConvertStatus(aStatus);
|
||||
if(myRetrievableStatus > CDF_RS_AlreadyRetrieved){
|
||||
myRetrievableStatus = theReader->GetStatus();
|
||||
if(myRetrievableStatus > PCDM_RS_AlreadyRetrieved){
|
||||
Standard_SStream aMsg;
|
||||
aMsg << Standard_Failure::Caught() << endl;
|
||||
Standard_Failure::Raise(aMsg);
|
||||
}
|
||||
}
|
||||
PCDM_ReaderStatus aStatus = theReader->GetStatus();
|
||||
myRetrievableStatus = ConvertStatus(aStatus);
|
||||
|
||||
myRetrievableStatus = theReader->GetStatus();
|
||||
theDocument->SetMetaData(aMetaData);
|
||||
|
||||
theDocumentToReturn=theDocument;
|
||||
@@ -451,7 +390,7 @@ Handle(PCDM_Reader) CDF_Application::ReaderFromFormat(const TCollection_Extended
|
||||
if(!FindReaderFromFormat(aFormat,thePluginId,UnfoundResourceName)) {
|
||||
Standard_SStream aMsg;
|
||||
aMsg << "Could not found the item:" << UnfoundResourceName <<(char)0;
|
||||
myRetrievableStatus = CDF_RS_WrongResource;
|
||||
myRetrievableStatus = PCDM_RS_WrongResource;
|
||||
Standard_NoSuchObject::Raise(aMsg);
|
||||
}
|
||||
Handle(PCDM_Reader) R;
|
||||
@@ -460,7 +399,7 @@ Handle(PCDM_Reader) CDF_Application::ReaderFromFormat(const TCollection_Extended
|
||||
R = Handle(PCDM_Reader)::DownCast(Plugin::Load(thePluginId));
|
||||
}
|
||||
catch (Standard_Failure) {
|
||||
myRetrievableStatus = CDF_RS_WrongResource;
|
||||
myRetrievableStatus = PCDM_RS_WrongResource;
|
||||
Standard_SStream aMsg;
|
||||
aMsg << Standard_Failure::Caught() << endl;
|
||||
Standard_Failure::Raise(aMsg);
|
||||
@@ -470,7 +409,7 @@ Handle(PCDM_Reader) CDF_Application::ReaderFromFormat(const TCollection_Extended
|
||||
RD->SetFormat(aFormat);
|
||||
return RD;
|
||||
} else
|
||||
myRetrievableStatus = CDF_RS_WrongResource;
|
||||
myRetrievableStatus = PCDM_RS_WrongResource;
|
||||
return R;
|
||||
}
|
||||
|
||||
@@ -540,7 +479,7 @@ Standard_Boolean CDF_Application::FindReaderFromFormat(const TCollection_Extende
|
||||
//function : CanRetrieve
|
||||
//purpose :
|
||||
//=======================================================================
|
||||
CDF_RetrievableStatus CDF_Application::CanRetrieve(const Handle(CDM_MetaData)& aMetaData) {
|
||||
PCDM_ReaderStatus CDF_Application::CanRetrieve(const Handle(CDM_MetaData)& aMetaData) {
|
||||
if(aMetaData->HasVersion())
|
||||
return CanRetrieve(aMetaData->Folder(),aMetaData->Name(),aMetaData->Version());
|
||||
else
|
||||
|
@@ -10,7 +10,7 @@
|
||||
// ! szy ! Creation !26-06-2003! 5.0-20-%L%!
|
||||
// +---------------------------------------------------------------------------+
|
||||
|
||||
inline CDF_RetrievableStatus CDF_Application::GetRetrieveStatus() const {
|
||||
inline PCDM_ReaderStatus CDF_Application::GetRetrieveStatus() const {
|
||||
return myRetrievableStatus;
|
||||
}
|
||||
// @@SDM: begin
|
||||
|
@@ -12,7 +12,7 @@ uses Document from CDM,
|
||||
SubComponentStatus from CDF,
|
||||
ExtendedString from TCollection,
|
||||
StoreList from CDF,
|
||||
StoreStatus from CDF,
|
||||
StoreStatus from PCDM,
|
||||
ExtendedString from TCollection
|
||||
|
||||
is
|
||||
@@ -148,7 +148,7 @@ is
|
||||
-- be used just after Realize or Import -- method to know if
|
||||
-- thes methods worked correctly, and if not why.
|
||||
|
||||
StoreStatus(me) returns StoreStatus from CDF;
|
||||
StoreStatus(me) returns StoreStatus from PCDM;
|
||||
AssociatedStatusText(me) returns ExtString from Standard;
|
||||
|
||||
---Category: Private methods
|
||||
@@ -181,7 +181,7 @@ fields
|
||||
|
||||
myPath: ExtendedString from TCollection;
|
||||
myText: ExtendedString from TCollection;
|
||||
myStatus: StoreStatus from CDF;
|
||||
myStatus: StoreStatus from PCDM;
|
||||
|
||||
|
||||
end Store from CDF;
|
||||
|
@@ -2,7 +2,7 @@
|
||||
#include <CDF_Store.ixx>
|
||||
#include <CDF_Session.hxx>
|
||||
#include <CDF_Application.hxx>
|
||||
#include <CDF_StoreStatus.hxx>
|
||||
#include <PCDM_StoreStatus.hxx>
|
||||
#include <CDF_StoreSetNameStatus.hxx>
|
||||
#include <Standard_ProgramError.hxx>
|
||||
#include <CDF_MetaDataDriver.hxx>
|
||||
@@ -160,7 +160,7 @@ void CDF_Store::Realize() {
|
||||
Handle(CDM_MetaData) m;
|
||||
myText = "";
|
||||
myStatus = myList->Store(m,myText);
|
||||
if(myStatus==CDF_SS_OK) myPath = m->Path();
|
||||
if(myStatus==PCDM_SS_OK) myPath = m->Path();
|
||||
}
|
||||
Standard_ExtString CDF_Store::Path() const {
|
||||
return myPath.ToExtString();
|
||||
@@ -280,7 +280,7 @@ CDF_SubComponentStatus CDF_Store::SubComponentStatus(const Standard_ExtString aP
|
||||
|
||||
|
||||
|
||||
CDF_StoreStatus CDF_Store::StoreStatus() const {
|
||||
PCDM_StoreStatus CDF_Store::StoreStatus() const {
|
||||
return myStatus;
|
||||
}
|
||||
Standard_ExtString CDF_Store::AssociatedStatusText() const {
|
||||
|
@@ -6,7 +6,15 @@
|
||||
|
||||
private class StoreList from CDF inherits Transient from Standard
|
||||
|
||||
uses Document from CDM, StackOfDocument from CDM, MapOfDocument from CDM, MapIteratorOfMapOfDocument from CDM, StackIteratorOfStackOfDocument from CDM,MetaData from CDM, ExtendedString from TCollection, StoreStatus from CDF
|
||||
uses
|
||||
Document from CDM,
|
||||
StackOfDocument from CDM,
|
||||
MapOfDocument from CDM,
|
||||
MapIteratorOfMapOfDocument from CDM,
|
||||
StackIteratorOfStackOfDocument from CDM,
|
||||
MetaData from CDM,
|
||||
ExtendedString from TCollection,
|
||||
StoreStatus from PCDM
|
||||
|
||||
raises NoSuchObject from Standard
|
||||
is
|
||||
@@ -19,7 +27,7 @@ is
|
||||
|
||||
Store(me: mutable; aMetaData: out MetaData from CDM;
|
||||
aStatusAssociatedText: out ExtendedString from TCollection)
|
||||
returns StoreStatus from CDF
|
||||
returns StoreStatus from PCDM
|
||||
---Purpose: stores each object of the storelist in the reverse
|
||||
-- order of which they had been added.
|
||||
raises NoSuchObject from Standard;
|
||||
|
@@ -65,61 +65,60 @@ void CDF_StoreList::Next() {
|
||||
Handle(CDM_Document) CDF_StoreList::Value() const {
|
||||
return myIterator.Key();
|
||||
}
|
||||
CDF_StoreStatus CDF_StoreList::Store (Handle(CDM_MetaData)& aMetaData, TCollection_ExtendedString& aStatusAssociatedText) {
|
||||
PCDM_StoreStatus CDF_StoreList::Store (Handle(CDM_MetaData)& aMetaData, TCollection_ExtendedString& aStatusAssociatedText) {
|
||||
|
||||
Handle(CDF_MetaDataDriver) theMetaDataDriver = CDF_Session::CurrentSession()->MetaDataDriver();
|
||||
|
||||
static CDF_StoreStatus status ;
|
||||
status = CDF_SS_OK;
|
||||
PCDM_StoreStatus status = PCDM_SS_OK;
|
||||
{
|
||||
try {
|
||||
OCC_CATCH_SIGNALS
|
||||
for (; !myStack.IsEmpty(); myStack.Pop()) {
|
||||
|
||||
Handle(CDM_Document) theDocument = myStack.Top();
|
||||
if( theDocument == myMainDocument || theDocument->IsModified()) {
|
||||
|
||||
if(!PCDM::FindStorageDriver(theDocument)){
|
||||
Standard_SStream aMsg;
|
||||
aMsg <<"No storage driver does exist for this format: " << theDocument->StorageFormat() << (char)0;
|
||||
Standard_Failure::Raise(aMsg);
|
||||
}
|
||||
|
||||
|
||||
if(!theMetaDataDriver->FindFolder(theDocument->RequestedFolder())) {
|
||||
Standard_SStream aMsg; aMsg << "could not find the active dbunit";
|
||||
aMsg << TCollection_ExtendedString(theDocument->RequestedFolder())<< (char)0;
|
||||
Standard_NoSuchObject::Raise(aMsg);
|
||||
}
|
||||
TCollection_ExtendedString theName=theMetaDataDriver->BuildFileName(theDocument);
|
||||
Handle(CDM_Document) theDocument = myStack.Top();
|
||||
if( theDocument == myMainDocument || theDocument->IsModified()) {
|
||||
|
||||
CDF_Timer theTimer;
|
||||
|
||||
PCDM::StorageDriver(theDocument)->Write(theDocument,theName);
|
||||
theTimer.ShowAndRestart("Driver->Write: ");
|
||||
if(!PCDM::FindStorageDriver(theDocument)){
|
||||
Standard_SStream aMsg;
|
||||
aMsg <<"No storage driver does exist for this format: " << theDocument->StorageFormat() << (char)0;
|
||||
Standard_Failure::Raise(aMsg);
|
||||
}
|
||||
|
||||
aMetaData = theMetaDataDriver->CreateMetaData(theDocument,theName);
|
||||
theTimer.ShowAndStop("metadata creating: ");
|
||||
|
||||
theDocument->SetMetaData(aMetaData);
|
||||
|
||||
if(!theMetaDataDriver->FindFolder(theDocument->RequestedFolder())) {
|
||||
Standard_SStream aMsg; aMsg << "could not find the active dbunit";
|
||||
aMsg << TCollection_ExtendedString(theDocument->RequestedFolder())<< (char)0;
|
||||
Standard_NoSuchObject::Raise(aMsg);
|
||||
}
|
||||
TCollection_ExtendedString theName=theMetaDataDriver->BuildFileName(theDocument);
|
||||
|
||||
CDM_ReferenceIterator it(theDocument);
|
||||
for(; it.More();it.Next()) {
|
||||
theMetaDataDriver->CreateReference(aMetaData,it.Document()->MetaData(),it.ReferenceIdentifier(),it.DocumentVersion());
|
||||
}
|
||||
|
||||
}
|
||||
CDF_Timer theTimer;
|
||||
Handle(PCDM_StorageDriver) aDocumentStorageDriver = PCDM::StorageDriver(theDocument);
|
||||
|
||||
aDocumentStorageDriver->Write(theDocument,theName);
|
||||
status = aDocumentStorageDriver->GetStoreStatus();
|
||||
|
||||
theTimer.ShowAndRestart("Driver->Write: ");
|
||||
|
||||
aMetaData = theMetaDataDriver->CreateMetaData(theDocument,theName);
|
||||
theTimer.ShowAndStop("metadata creating: ");
|
||||
|
||||
theDocument->SetMetaData(aMetaData);
|
||||
|
||||
CDM_ReferenceIterator it(theDocument);
|
||||
for(; it.More();it.Next()) {
|
||||
theMetaDataDriver->CreateReference(aMetaData,it.Document()->MetaData(),it.ReferenceIdentifier(),it.DocumentVersion());
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
catch (CDF_MetaDataDriverError) {
|
||||
CAUGHT(aStatusAssociatedText,TCollection_ExtendedString("metadatadriver failed; reason:"));
|
||||
status = CDF_SS_DriverFailure;
|
||||
status = PCDM_SS_DriverFailure;
|
||||
}
|
||||
catch (Standard_Failure) {
|
||||
CAUGHT(aStatusAssociatedText,TCollection_ExtendedString("driver failed; reason:"));
|
||||
status = CDF_SS_Failure;
|
||||
status = PCDM_SS_Failure;
|
||||
}
|
||||
}
|
||||
|
||||
|
Reference in New Issue
Block a user