+ string CreateAttributes(_PTR(Study) theStudyDocument,
+ const char* theFatherEntry, const char* theRefFatherEntry,
+ const char* theIOR, const char* theName,
+ const char* thePersistentRef, const char* theComment,
+ CORBA::Boolean theCreateNew)
+ {
+ _PTR(StudyBuilder) aStudyBuilder = theStudyDocument->NewBuilder();
+ _PTR(SObject) aFather = theStudyDocument->FindObjectID(theFatherEntry);
+ _PTR(SObject) newObj;
+ if (theCreateNew)
+ newObj = aStudyBuilder->NewObject(aFather);
+ else
+ newObj = aFather;
+
+ _PTR(GenericAttribute) anAttr;
+ if (strcmp(theIOR, "") != 0) {
+ anAttr = aStudyBuilder->FindOrCreateAttribute(newObj, "AttributeIOR");
+ _PTR(AttributeIOR) anIOR (anAttr);
+ anIOR->SetValue(theIOR);
+ }
+ if (strcmp(theName, "") != 0) {
+ anAttr = aStudyBuilder->FindOrCreateAttribute(newObj, "AttributeName");
+ _PTR(AttributeName) aName (anAttr);
+ aName->SetValue(theName);
+ }
+ if (strcmp(thePersistentRef, "") != 0) {
+ anAttr = aStudyBuilder->FindOrCreateAttribute(newObj, "AttributePersistentRef");
+ _PTR(AttributePersistentRef) aPRef (anAttr);
+ aPRef->SetValue(thePersistentRef);
+ }
+ if (strcmp(theComment, "") != 0) {
+ anAttr = aStudyBuilder->FindOrCreateAttribute(newObj, "AttributeComment");
+ _PTR(AttributeComment) aCmnt (anAttr);
+ aCmnt->SetValue(theComment);
+ if (MYDEBUG) INFOS("CreateAttributes - Comment = " << theComment);
+ }
+ if (strcmp(theRefFatherEntry, "") != 0) {
+ _PTR(SObject) aRefFather = theStudyDocument->FindObjectID(theRefFatherEntry);
+ _PTR(SObject) anObj = aStudyBuilder->NewObject(aRefFather);
+ aStudyBuilder->Addreference(anObj, newObj);
+ }
+ string aRet = newObj->GetID();
+ if (MYDEBUG)
+ INFOS("CreateAttributes - StudyId = " << theStudyDocument->StudyId()
+ << "; anEntry = " << aRet << "; IOR = '" << theIOR << "'");
+ return aRet;
+ }
+
+ QString GenerateName(const string& theFmt, int theId){
+ static QString aName;
+ if(theId > 0)
+ aName.sprintf("%s:%d",theFmt.c_str(),theId);
+ else
+ aName.sprintf("%s",theFmt.c_str());
+ return aName;
+ }